Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RegeneratingScrapTweak v1.1.0
RegeneratingScrapTweak.dll
Decompiled 2 weeks agousing System; 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.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using R2API.Utils; using RoR2; using RoR2.Audio; using RoR2.Items; using UnityEngine; using UnityEngine.AddressableAssets; [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("RegeneratingScrapTweak")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RegeneratingScrapTweak")] [assembly: AssemblyTitle("RegeneratingScrapTweak")] [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 RegeneratingScrapTweak { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } [BepInPlugin("Tero.RegeneratingScrapTweak", "RegeneratingScrapTweak", "1.1.0")] [R2APISubmoduleDependency(new string[] { "LanguageAPI" })] public class RegeneratingScrapTweak : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Init <>9__14_0; public static hook_IsAffordable <>9__14_1; public static hook_PayCost <>9__14_2; internal void <Awake>b__14_0(orig_Init orig) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); if ((Object)(object)Items.RegeneratingScrap != (Object)null) { ItemDef itemDef = ItemCatalog.GetItemDef(Items.RegeneratingScrap.itemIndex); Log.LogDebug(itemDef.descriptionToken); Log.LogDebug(itemDef.pickupToken); } if (TradeForRed && TradeForYellow) { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with ANY 3D Printer. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with ANY 3D Printer. At the start of each stage, it regenerates.", "en"); } else if (TradeForYellow) { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsDamage>Overgrown</style> 3D Printers. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsDamage>Overgrown</style> 3D Printers. At the start of each stage, it regenerates.", "en"); } else if (TradeForRed) { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsHealth>Legendary</style> 3D Printers. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsHealth>Legendary</style> 3D Printers. At the start of each stage, it regenerates.", "en"); } else { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with Common or <style=cIsHealing>Uncommon</style> 3D Printers. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with Common or <style=cIsHealing>Uncommon</style> 3D Printers. At the start of each stage, it regenerates.", "en"); } } internal bool <Awake>b__14_1(orig_IsAffordable orig, CostTypeDef self, int cost, Interactor activator) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Invalid comparison between Unknown and I4 //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Invalid comparison between Unknown and I4 if (self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 0) { CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } Inventory inventory = component.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return false; } int num = 0; if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num = inventory.GetItemCountEffective(Items.RegeneratingScrap); } if (num >= cost) { return true; } return inventory.HasAtLeastXTotalRemovablePermanentItemsOfTier((ItemTier)0, cost - num); } if (TradeForRed && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 2) { CharacterBody component2 = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component2)) { return false; } Inventory inventory2 = component2.inventory; if (!Object.op_Implicit((Object)(object)inventory2)) { return false; } int num2 = 0; if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num2 = inventory2.GetItemCountEffective(Items.RegeneratingScrap); } if (num2 >= cost) { return true; } return inventory2.HasAtLeastXTotalRemovablePermanentItemsOfTier((ItemTier)2, cost - num2); } if (TradeForYellow && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 4) { CharacterBody component3 = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component3)) { return false; } Inventory inventory3 = component3.inventory; if (!Object.op_Implicit((Object)(object)inventory3)) { return false; } int num3 = 0; if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num3 = inventory3.GetItemCountEffective(Items.RegeneratingScrap); } if (num3 >= cost) { return true; } return inventory3.HasAtLeastXTotalRemovablePermanentItemsOfTier((ItemTier)4, cost - num3); } return orig.Invoke(self, cost, activator); } internal void <Awake>b__14_2(orig_PayCost orig, CostTypeDef self, PayCostContext context, PayCostResults results) { //IL_0014: 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_003b: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown if ((self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 0) || (TradeForRed && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 2) || (TradeForYellow && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 4)) { int num = 0; CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { orig.Invoke(self, context, results); return; } Inventory activatorInventory = context.activatorInventory; if (!Object.op_Implicit((Object)(object)activatorInventory)) { orig.Invoke(self, context, results); return; } if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num = activatorInventory.GetItemCountEffective(Items.RegeneratingScrap); } ItemTransformation val; if (num >= context.cost) { val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = Items.RegeneratingScrap.itemIndex; ((ItemTransformation)(ref val)).newItemIndex = Items.RegeneratingScrapConsumed.itemIndex; ((ItemTransformation)(ref val)).maxToTransform = context.cost; ((ItemTransformation)(ref val)).forbidTempItems = true; ItemTransformation val2 = val; TryTransformResult val3 = default(TryTransformResult); if (((ItemTransformation)(ref val2)).TryTransform(activatorInventory, ref val3)) { results.AddTakenItemsFromTransformation(ref val3); } } else { context.cost -= num; orig.Invoke(self, context, results); if (num > 0) { val = default(ItemTransformation); ((ItemTransformation)(ref val)).originalItemIndex = Items.RegeneratingScrap.itemIndex; ((ItemTransformation)(ref val)).newItemIndex = Items.RegeneratingScrapConsumed.itemIndex; ((ItemTransformation)(ref val)).maxToTransform = num; ((ItemTransformation)(ref val)).forbidTempItems = true; ItemTransformation val4 = val; TryTransformResult val5 = default(TryTransformResult); if (((ItemTransformation)(ref val4)).TryTransform(activatorInventory, ref val5)) { results.AddTakenItemsFromTransformation(ref val5); } context.cost = num; } } if (num <= 0) { return; } EntitySoundManager.EmitSoundServer(NetworkSoundEventCatalog.FindNetworkSoundEventIndex("Play_item_proc_regenScrap_consume"), ((Component)context.activatorBody).gameObject); ModelLocator component2 = ((Component)context.activatorBody).GetComponent<ModelLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform modelTransform = component2.modelTransform; if (Object.op_Implicit((Object)(object)modelTransform)) { CharacterModel component3 = ((Component)modelTransform).GetComponent<CharacterModel>(); if (Object.op_Implicit((Object)(object)component3)) { List<GameObject> itemDisplayObjects = component3.GetItemDisplayObjects(Items.RegeneratingScrap.itemIndex); if (itemDisplayObjects.Count > 0) { GameObject val6 = itemDisplayObjects[0]; GameObject val7 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionDisplay.prefab").WaitForCompletion(); EffectData val8 = new EffectData { origin = val6.transform.position, rotation = val6.transform.rotation }; EffectManager.SpawnEffect(val7, val8, true); } } } } EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionInPrinter.prefab").WaitForCompletion(), context.purchasedObject, "DropPivot", true); CharacterMasterNotificationQueue.SendTransformNotification(context.activatorBody.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)0); MultiShopCardUtils.OnNonMoneyPurchase(context); } else { orig.Invoke(self, context, results); } } } public const string PluginGUID = "Tero.RegeneratingScrapTweak"; public const string PluginAuthor = "Tero"; public const string PluginName = "RegeneratingScrapTweak"; public const string PluginVersion = "1.1.0"; public static bool TradeForYellow; public static bool TradeForRed; public static ConfigEntry<bool> CanTradeForYellow { get; set; } public static ConfigEntry<bool> CanTradeForRed { get; set; } public void Awake() { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); try { CanTradeForYellow = ((BaseUnityPlugin)this).Config.Bind<bool>("RegeneratingScrapTweak", "CanTradeForYellow", false, "Whether or not Regenerating Scrap can count as a Yellow item"); TradeForYellow = CanTradeForYellow.Value; } catch (Exception) { } try { CanTradeForRed = ((BaseUnityPlugin)this).Config.Bind<bool>("RegeneratingScrapTweak", "CanTradeForRed", false, "Whether or not Regenerating Scrap can count as a Red item"); TradeForRed = CanTradeForRed.Value; } catch (Exception) { } object obj = <>c.<>9__14_0; if (obj == null) { hook_Init val = delegate(orig_Init orig) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(); if ((Object)(object)Items.RegeneratingScrap != (Object)null) { ItemDef itemDef = ItemCatalog.GetItemDef(Items.RegeneratingScrap.itemIndex); Log.LogDebug(itemDef.descriptionToken); Log.LogDebug(itemDef.pickupToken); } if (TradeForRed && TradeForYellow) { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with ANY 3D Printer. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with ANY 3D Printer. At the start of each stage, it regenerates.", "en"); } else if (TradeForYellow) { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsDamage>Overgrown</style> 3D Printers. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsDamage>Overgrown</style> 3D Printers. At the start of each stage, it regenerates.", "en"); } else if (TradeForRed) { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsHealth>Legendary</style> 3D Printers. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with Common, <style=cIsHealing>Uncommon</style>, or <style=cIsHealth>Legendary</style> 3D Printers. At the start of each stage, it regenerates.", "en"); } else { LanguageAPI.Add("ITEM_REGENERATINGSCRAP_PICKUP", "Prioritized when used with Common or <style=cIsHealing>Uncommon</style> 3D Printers. Usable once per stage.", "en"); LanguageAPI.Add("ITEM_REGENERATINGSCRAP_DESC", "Does nothing. Prioritized when used with Common or <style=cIsHealing>Uncommon</style> 3D Printers. At the start of each stage, it regenerates.", "en"); } }; <>c.<>9__14_0 = val; obj = (object)val; } ItemCatalog.Init += (hook_Init)obj; object obj2 = <>c.<>9__14_1; if (obj2 == null) { hook_IsAffordable val2 = delegate(orig_IsAffordable orig, CostTypeDef self, int cost, Interactor activator) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Invalid comparison between Unknown and I4 //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Invalid comparison between Unknown and I4 if (self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 0) { CharacterBody component4 = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component4)) { return false; } Inventory inventory = component4.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return false; } int num2 = 0; if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num2 = inventory.GetItemCountEffective(Items.RegeneratingScrap); } if (num2 >= cost) { return true; } return inventory.HasAtLeastXTotalRemovablePermanentItemsOfTier((ItemTier)0, cost - num2); } if (TradeForRed && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 2) { CharacterBody component5 = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component5)) { return false; } Inventory inventory2 = component5.inventory; if (!Object.op_Implicit((Object)(object)inventory2)) { return false; } int num3 = 0; if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num3 = inventory2.GetItemCountEffective(Items.RegeneratingScrap); } if (num3 >= cost) { return true; } return inventory2.HasAtLeastXTotalRemovablePermanentItemsOfTier((ItemTier)2, cost - num3); } if (TradeForYellow && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 4) { CharacterBody component6 = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component6)) { return false; } Inventory inventory3 = component6.inventory; if (!Object.op_Implicit((Object)(object)inventory3)) { return false; } int num4 = 0; if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num4 = inventory3.GetItemCountEffective(Items.RegeneratingScrap); } if (num4 >= cost) { return true; } return inventory3.HasAtLeastXTotalRemovablePermanentItemsOfTier((ItemTier)4, cost - num4); } return orig.Invoke(self, cost, activator); }; <>c.<>9__14_1 = val2; obj2 = (object)val2; } CostTypeDef.IsAffordable += (hook_IsAffordable)obj2; object obj3 = <>c.<>9__14_2; if (obj3 == null) { hook_PayCost val3 = delegate(orig_PayCost orig, CostTypeDef self, PayCostContext context, PayCostResults results) { //IL_0014: 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_003b: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown if ((self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 0) || (TradeForRed && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 2) || (TradeForYellow && self.costStringFormatToken == "COST_ITEM_FORMAT" && (int)self.itemTier == 4)) { int num = 0; CharacterBody component = ((Component)context.activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { orig.Invoke(self, context, results); } else { Inventory activatorInventory = context.activatorInventory; if (!Object.op_Implicit((Object)(object)activatorInventory)) { orig.Invoke(self, context, results); } else { if ((Object)(object)Items.RegeneratingScrap != (Object)null) { num = activatorInventory.GetItemCountEffective(Items.RegeneratingScrap); } ItemTransformation val4; if (num >= context.cost) { val4 = default(ItemTransformation); ((ItemTransformation)(ref val4)).originalItemIndex = Items.RegeneratingScrap.itemIndex; ((ItemTransformation)(ref val4)).newItemIndex = Items.RegeneratingScrapConsumed.itemIndex; ((ItemTransformation)(ref val4)).maxToTransform = context.cost; ((ItemTransformation)(ref val4)).forbidTempItems = true; ItemTransformation val5 = val4; TryTransformResult val6 = default(TryTransformResult); if (((ItemTransformation)(ref val5)).TryTransform(activatorInventory, ref val6)) { results.AddTakenItemsFromTransformation(ref val6); } } else { context.cost -= num; orig.Invoke(self, context, results); if (num > 0) { val4 = default(ItemTransformation); ((ItemTransformation)(ref val4)).originalItemIndex = Items.RegeneratingScrap.itemIndex; ((ItemTransformation)(ref val4)).newItemIndex = Items.RegeneratingScrapConsumed.itemIndex; ((ItemTransformation)(ref val4)).maxToTransform = num; ((ItemTransformation)(ref val4)).forbidTempItems = true; ItemTransformation val7 = val4; TryTransformResult val8 = default(TryTransformResult); if (((ItemTransformation)(ref val7)).TryTransform(activatorInventory, ref val8)) { results.AddTakenItemsFromTransformation(ref val8); } context.cost = num; } } if (num > 0) { EntitySoundManager.EmitSoundServer(NetworkSoundEventCatalog.FindNetworkSoundEventIndex("Play_item_proc_regenScrap_consume"), ((Component)context.activatorBody).gameObject); ModelLocator component2 = ((Component)context.activatorBody).GetComponent<ModelLocator>(); if (Object.op_Implicit((Object)(object)component)) { Transform modelTransform = component2.modelTransform; if (Object.op_Implicit((Object)(object)modelTransform)) { CharacterModel component3 = ((Component)modelTransform).GetComponent<CharacterModel>(); if (Object.op_Implicit((Object)(object)component3)) { List<GameObject> itemDisplayObjects = component3.GetItemDisplayObjects(Items.RegeneratingScrap.itemIndex); if (itemDisplayObjects.Count > 0) { GameObject val9 = itemDisplayObjects[0]; GameObject val10 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionDisplay.prefab").WaitForCompletion(); EffectData val11 = new EffectData { origin = val9.transform.position, rotation = val9.transform.rotation }; EffectManager.SpawnEffect(val10, val11, true); } } } } EffectManager.SimpleMuzzleFlash(Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/RegeneratingScrap/RegeneratingScrapExplosionInPrinter.prefab").WaitForCompletion(), context.purchasedObject, "DropPivot", true); CharacterMasterNotificationQueue.SendTransformNotification(context.activatorBody.master, Items.RegeneratingScrap.itemIndex, Items.RegeneratingScrapConsumed.itemIndex, (TransformationType)0); MultiShopCardUtils.OnNonMoneyPurchase(context); } } } } else { orig.Invoke(self, context, results); } }; <>c.<>9__14_2 = val3; obj3 = (object)val3; } CostTypeDef.PayCost += (hook_PayCost)obj3; } } }