using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; 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 EntityStates; using EntityStates.Barrel; using EntityStates.DroneVendor; using HG; using HG.Reflection; using IL.RoR2; using IL.RoR2.UI; using ItemQualities; using ItemQualities.Items; using Logger; using Md.ItemQualities.ItemCostQualityPatch; using Md.ItemQualities.Items.LowerPricedChests; using Microsoft.CodeAnalysis; using MiscFixes.Modules; using Mono.Cecil; using Mono.Cecil.Cil; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using MonoMod.Cil; using On.EntityStates.Barrel; using On.EntityStates.DroneVendor; using On.RoR2; using On.RoR2.Items; using R2API; using R2API.Models; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.ContentManagement; using RoR2.Items; using RoR2.UI; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MonoDetourTargets(typeof(LowerPricedChests))] [assembly: MonoDetourTargets(typeof(ItemCostQualityPatch))] [assembly: MonoDetourTargets(typeof(ItemQualitiesContent))] [assembly: OptIn] [assembly: IgnoresAccessChecksTo("ItemQualities")] [assembly: IgnoresAccessChecksTo("ItemQualities.Patcher")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RetroactiveMacro")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+2b119d60263c12e80c8e0dd3296ff288638d9f5b")] [assembly: AssemblyProduct("RetroactiveMacro")] [assembly: AssemblyTitle("RetroactiveMacro")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Md.ItemQualities.ItemQualitiesContent { internal static class get_identifier { } internal static class _ctor { } internal static class Register { } internal static class collectContentPackProviders { } internal static class LoadStaticContentAsync { } internal static class GenerateContentPackAsync { } internal static class FinalizeAsync { } internal static class QualityTiers { internal static class _cctor { } } internal static class ItemQualityGroups { internal static class _cctor { } } internal static class EquipmentQualityGroups { internal static class _cctor { } } internal static class BuffQualityGroups { internal static class _cctor { } } internal static class SpawnCards { internal static class get_AllSpawnCards { } internal static class set_AllSpawnCards { } internal static class _cctor { } } internal static class TMP_SpriteAssets { internal static class _cctor { } } internal static class __c { internal static class _ctor { } } internal static class _LoadStaticContentAsync_d__8 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } internal static class _GenerateContentPackAsync_d__11 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } internal static class _FinalizeAsync_d__12 { internal static class _ctor { } internal static class System_IDisposable_Dispose { } internal static class MoveNext { } internal static class System_Collections_Generic_IEnumerator_System_Object__get_Current { } internal static class System_Collections_IEnumerator_Reset { } internal static class System_Collections_IEnumerator_get_Current { } } } namespace Md.ItemQualities.ItemCostQualityPatch { internal static class tryUpgradeQualityFromCost { public delegate void PrefixSignature(ref PickupIndex intendedDropPickupIndex, ref GameObject dropperObject); public delegate void PostfixSignature(ref PickupIndex intendedDropPickupIndex, ref GameObject dropperObject, ref PickupIndex returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(ItemCostQualityPatch).GetMethod("tryUpgradeQualityFromCost", (BindingFlags)(-1), null, new Type[2] { typeof(PickupIndex), typeof(GameObject) }, null) ?? throw new MissingMethodException("ItemQualities.ItemCostQualityPatch", "tryUpgradeQualityFromCost"); } } internal static class Init { public delegate void PrefixSignature(); public delegate void PostfixSignature(); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(ItemCostQualityPatch).GetMethod("Init", (BindingFlags)(-1), null, Array.Empty(), null) ?? throw new MissingMethodException("ItemQualities.ItemCostQualityPatch", "Init"); } } internal static class ChestBehavior_BaseItemDrop { public delegate void PrefixSignature(ref ILContext il); public delegate void PostfixSignature(ref ILContext il); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(ItemCostQualityPatch).GetMethod("ChestBehavior_BaseItemDrop", (BindingFlags)(-1), null, new Type[1] { typeof(ILContext) }, null) ?? throw new MissingMethodException("ItemQualities.ItemCostQualityPatch", "ChestBehavior_BaseItemDrop"); } } internal static class CostTypeCatalog_IsAffordableItem { } internal static class CostTypeCatalog_PayCostItems { } internal static class getOutputQualityTierFromCost { } internal static class OptionChestBehavior_ItemDrop { } internal static class ShopTerminalBehavior_DropPickup { } internal static class CostTypeCatalog_IsAffordableItem_orig { internal static class _ctor { } internal static class Invoke { } internal static class BeginInvoke { } internal static class EndInvoke { } } internal static class SetTransformedItemQualityDelegate { internal static class _ctor { } internal static class Invoke { } internal static class BeginInvoke { } internal static class EndInvoke { } } internal static class __c__DisplayClass3_0 { internal static class _ctor { } } internal static class __c__DisplayClass3_1 { internal static class _ctor { } } internal static class __c__DisplayClass3_2 { internal static class _ctor { } } internal static class __c { internal static class _ctor { } } } namespace Md.ItemQualities.Items.LowerPricedChests { internal static class generateQualityDropTiersFromSaleStars { public delegate void PrefixSignature(ref GameObject purchasedObject, ref int dropCount, ref bool useFirstInteractionCost, ref Xoroshiro128Plus rng); public delegate void PostfixSignature(ref GameObject purchasedObject, ref int dropCount, ref bool useFirstInteractionCost, ref Xoroshiro128Plus rng, ref QualityTier[] returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(LowerPricedChests).GetMethod("generateQualityDropTiersFromSaleStars", (BindingFlags)(-1), null, new Type[4] { typeof(GameObject), typeof(int), typeof(bool), typeof(Xoroshiro128Plus) }, null) ?? throw new MissingMethodException("ItemQualities.Items.LowerPricedChests", "generateQualityDropTiersFromSaleStars"); } } internal static class tryUpgradePickupQualityFromSaleStars { public delegate void PrefixSignature(ref UniquePickup pickup, ref QualityTier[] saleStarDropQualityTiers, ref int pickupSequenceIndex); public delegate void PostfixSignature(ref UniquePickup pickup, ref QualityTier[] saleStarDropQualityTiers, ref int pickupSequenceIndex, ref UniquePickup returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(LowerPricedChests).GetMethod("tryUpgradePickupQualityFromSaleStars", (BindingFlags)(-1), null, new Type[3] { typeof(UniquePickup), typeof(QualityTier[]), typeof(int).MakeByRefType() }, null) ?? throw new MissingMethodException("ItemQualities.Items.LowerPricedChests", "tryUpgradePickupQualityFromSaleStars"); } } internal static class Init { public delegate void PrefixSignature(); public delegate void PostfixSignature(); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(LowerPricedChests).GetMethod("Init", (BindingFlags)(-1), null, Array.Empty(), null) ?? throw new MissingMethodException("ItemQualities.Items.LowerPricedChests", "Init"); } } internal static class ChestBehavior_BaseItemDrop { public delegate void PrefixSignature(ref ILContext il); public delegate void PostfixSignature(ref ILContext il); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(LowerPricedChests).GetMethod("ChestBehavior_BaseItemDrop", (BindingFlags)(-1), null, new Type[1] { typeof(ILContext) }, null) ?? throw new MissingMethodException("ItemQualities.Items.LowerPricedChests", "ChestBehavior_BaseItemDrop"); } } internal static class PurchaseInteraction_OnInteractionBegin { public delegate void PrefixSignature(ref ILContext il); public delegate void PostfixSignature(ref ILContext il); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { return typeof(LowerPricedChests).GetMethod("PurchaseInteraction_OnInteractionBegin", (BindingFlags)(-1), null, new Type[1] { typeof(ILContext) }, null) ?? throw new MissingMethodException("ItemQualities.Items.LowerPricedChests", "PurchaseInteraction_OnInteractionBegin"); } } internal static class CharacterMaster_TrySaleStar { } internal static class RouletteChestController_EjectPickupServer { } internal static class QualitySaleStarState { internal static class _ctor { } } internal static class ConsumeQualitySaleStarsDelegate { internal static class _ctor { } internal static class Invoke { } internal static class BeginInvoke { } internal static class EndInvoke { } } internal static class TryUpgradePickupQualityFromSaleStarsDelegate { internal static class _ctor { } internal static class Invoke { } internal static class BeginInvoke { } internal static class EndInvoke { } } internal static class __c__DisplayClass3_0 { internal static class _ctor { } } internal static class __c { internal static class _ctor { } } internal static class __c__DisplayClass9_0 { internal static class _ctor { } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute(Type? targetType = null) : Attribute(), IMonoDetourTargets { public Type? TargetType { get; } = targetType; public bool IncludeNestedTypes { get; set; } = true; public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } } } namespace Logger { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void message(object data) { } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { MethodBase method = new StackFrame(1).GetMethod(); _logSource.LogInfo((object)("[" + method.Name + "]: " + data)); } internal static void Message(object data) { message(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace RetroactiveMacro { public static class Card { [CompilerGenerated] private static class <>O { public static hook_UpdatePickupDisplayAndAnimations <0>__UpdatePickupDisplayAndAnimations; public static Action <1>__PrePopulateSceneServer; public static hook_OnExit <2>__DroneVendorAssumeIdle_OnExit; public static hook_RecalculateStats <3>__RecalculateStats; public static hook_OnPurchase <4>__MultiShopCardUtils_OnPurchase; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown if (!RetroactiveMacro.ChangeCard.Value) { return; } AsyncOperationHandle val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_TripleShop.TripleShop_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle x) { x.Result.AddComponent(); }; if (!RetroactiveMacro.ExcludeEquipShops.Value) { val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_TripleShopEquipment.TripleShopEquipment_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle x) { x.Result.AddComponent(); }; } val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_TripleShopLarge.TripleShopLarge_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle x) { x.Result.AddComponent(); }; val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_DLC1_FreeChestMultiShop.FreeChestMultiShop_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle x) { x.Result.AddComponent(); }; val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_DLC3_TripleDroneShop.TripleDroneShop_prefab), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle x) { x.Result.AddComponent(); }; object obj = <>O.<0>__UpdatePickupDisplayAndAnimations; if (obj == null) { hook_UpdatePickupDisplayAndAnimations val2 = UpdatePickupDisplayAndAnimations; <>O.<0>__UpdatePickupDisplayAndAnimations = val2; obj = (object)val2; } ShopTerminalBehavior.UpdatePickupDisplayAndAnimations += (hook_UpdatePickupDisplayAndAnimations)obj; SceneDirector.onPrePopulateSceneServer += PrePopulateSceneServer; object obj2 = <>O.<2>__DroneVendorAssumeIdle_OnExit; if (obj2 == null) { hook_OnExit val3 = DroneVendorAssumeIdle_OnExit; <>O.<2>__DroneVendorAssumeIdle_OnExit = val3; obj2 = (object)val3; } DroneVendorAssumeIdle.OnExit += (hook_OnExit)obj2; object obj3 = <>O.<3>__RecalculateStats; if (obj3 == null) { hook_RecalculateStats val4 = RecalculateStats; <>O.<3>__RecalculateStats = val4; obj3 = (object)val4; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj3; object obj4 = <>O.<4>__MultiShopCardUtils_OnPurchase; if (obj4 == null) { hook_OnPurchase val5 = MultiShopCardUtils_OnPurchase; <>O.<4>__MultiShopCardUtils_OnPurchase = val5; obj4 = (object)val5; } MultiShopCardUtils.OnPurchase += (hook_OnPurchase)obj4; } private static void MultiShopCardUtils_OnPurchase(orig_OnPurchase orig, PayCostContext context, int moneyCost) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(context, moneyCost); GameObject purchasedObject = context.purchasedObject; ShopTerminalBehavior val = default(ShopTerminalBehavior); PurchaseInteraction val2 = default(PurchaseInteraction); if (Object.op_Implicit((Object)(object)purchasedObject) && purchasedObject.TryGetComponent(ref val) && purchasedObject.TryGetComponent(ref val2) && PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex) && Object.op_Implicit((Object)(object)val.serverMultiShopController)) { val.serverMultiShopController.SetCloseOnTerminalPurchase(val2, false); } } private static void RecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (self.isPlayerControlled) { checkCardAvailability(); } } public static void checkCardAvailability() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex)) { foreach (MacroCardItemHandler instances in InstanceTracker.GetInstancesList()) { instances.tryRecoverShop(); } { foreach (MacroCardDroneHandler instances2 in InstanceTracker.GetInstancesList()) { instances2.tryRecoverShop(); } return; } } foreach (MacroCardItemHandler instances3 in InstanceTracker.GetInstancesList()) { instances3.TryCloseShop(); } foreach (MacroCardDroneHandler instances4 in InstanceTracker.GetInstancesList()) { instances4.TryCloseShop(); } } private static void PrePopulateSceneServer(SceneDirector director) { MultiShopController val = default(MultiShopController); DroneVendorMultiShopController val2 = default(DroneVendorMultiShopController); foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { Transform parent = ((Component)instances).transform.parent; if (Object.op_Implicit((Object)(object)parent)) { if (((Component)parent).TryGetComponent(ref val)) { ((Component)parent).gameObject.AddComponent(); } if (((Component)parent).TryGetComponent(ref val2)) { ((Component)parent).gameObject.AddComponent(); } } } } private static void UpdatePickupDisplayAndAnimations(orig_UpdatePickupDisplayAndAnimations orig, ShopTerminalBehavior self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (self.hasStarted && Object.op_Implicit((Object)(object)self.animator) && !self.hasBeenPurchased && self.pickup != UniquePickup.none) { int layerIndex = self.animator.GetLayerIndex("Body"); self.animator.PlayInFixedTime("Reopen", layerIndex); } } private static bool PlayerTeamHasEquipment(EquipmentIndex equipment) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && instance.isConnected && instance.master.hasBody && Object.op_Implicit((Object)(object)instance.master.GetBody().healthComponent) && instance.master.GetBody().healthComponent.alive && HasEquipment(instance.master.inventory, equipment)) { return true; } } return false; } private static bool HasEquipment(Inventory inventory, EquipmentIndex equipment) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) for (uint num = 0u; num < inventory.GetEquipmentSlotCount(); num++) { for (uint num2 = 0u; num2 < inventory.GetEquipmentSetCount(); num2++) { EquipmentLocation val = new EquipmentLocation { slot = num, set = num2 }; EquipmentState equipment2 = inventory.GetEquipment(ref val); EquipmentIndex val2 = equipment2.equipmentIndex; if (QualityCompat.enabled) { val2 = QualityCompat.GetBaseEquipmentIndex(val2); } if (val2 == equipment && (equipment2.charges > 0 || (double)((FixedTimeStamp)(ref equipment2.chargeFinishTime)).timeUntil < 0.5)) { return true; } } } return false; } private static void DroneVendorAssumeIdle_OnExit(orig_OnExit orig, DroneVendorAssumeIdle self) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex)) { ((MonoBehaviour)RetroactiveMacro.Instance).StartCoroutine(WaitToReenable()); } static IEnumerator WaitToReenable() { yield return (object)new WaitForFixedUpdate(); checkCardAvailability(); } } } public class MacroCardItemHandler : MonoBehaviour { public MultiShopController multiShopController; public UniquePickup[] savedPickups; public bool[] hidden; public bool recoveredShop; private void Awake() { multiShopController = ((Component)this).GetComponent(); } private void OnPurchase(PayCostContext arg0, PayCostResults arg1) { bool[] doCloseOnTerminalPurchase = multiShopController.doCloseOnTerminalPurchase; foreach (bool flag in doCloseOnTerminalPurchase) { recoveredShop &= !flag; } } private void Start() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } savedPickups = (UniquePickup[])(object)new UniquePickup[multiShopController.terminalGameObjects.Length]; hidden = new bool[multiShopController.terminalGameObjects.Length]; ShopTerminalBehavior val = default(ShopTerminalBehavior); PurchaseInteraction val2 = default(PurchaseInteraction); for (int i = 0; i < multiShopController.terminalGameObjects.Length; i++) { GameObject obj = multiShopController.terminalGameObjects[i]; if (obj.TryGetComponent(ref val)) { savedPickups[i] = val.pickup; hidden[i] = val.hidden; } if (obj.TryGetComponent(ref val2)) { ((UnityEvent)(object)val2.onDetailedPurchaseServer).AddListener((UnityAction)OnPurchase); } } } public void tryRecoverShop() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) GameObject[] terminalGameObjects = multiShopController.terminalGameObjects; ShopTerminalBehavior val = default(ShopTerminalBehavior); for (int i = 0; i < terminalGameObjects.Length; i++) { if (terminalGameObjects[i].TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.animator) && !val.hasBeenPurchased && !terminalGameObjects[i].GetComponent().available) { recoveredShop = true; multiShopController.Networkavailable = true; terminalGameObjects[i].GetComponent().SetAvailable(true); Util.PlaySound("Play_UI_tripleChestShutter", ((Component)val).gameObject); if (NetworkServer.active) { val.SetPickup(savedPickups[i], hidden[i]); val.UpdatePickupDisplayAndAnimations(); } } } } public void TryCloseShop() { if (!NetworkServer.active || !recoveredShop) { return; } GameObject[] terminalGameObjects = multiShopController.terminalGameObjects; ShopTerminalBehavior val = default(ShopTerminalBehavior); for (int i = 0; i < terminalGameObjects.Length; i++) { if (terminalGameObjects[i].TryGetComponent(ref val) && Object.op_Implicit((Object)(object)val.animator) && !val.hasBeenPurchased) { multiShopController.Networkavailable = false; terminalGameObjects[i].GetComponent().SetAvailable(false); val.SetNoPickup(); } } } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } } public class MacroCardDroneHandler : MonoBehaviour { public DroneVendorMultiShopController multiShopController; public UniquePickup[] savedPickups; public bool recoveredShop; private void Awake() { multiShopController = ((Component)this).GetComponent(); } private void OnPurchase(PayCostContext arg0, PayCostResults arg1) { bool[] doCloseOnTerminalPurchase = multiShopController.doCloseOnTerminalPurchase; foreach (bool flag in doCloseOnTerminalPurchase) { recoveredShop &= !flag; } } private void Start() { //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) if (NetworkServer.active) { savedPickups = (UniquePickup[])(object)new UniquePickup[multiShopController._terminals.Length]; for (int i = 0; i < multiShopController._terminals.Length; i++) { DroneVendorTerminalBehavior val = multiShopController._terminals[i]; savedPickups[i] = val.currentPickup; ((UnityEvent)(object)val.purchaseInteraction.onDetailedPurchaseServer).AddListener((UnityAction)OnPurchase); } } } public void tryRecoverShop() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = default(EntityStateMachine); if (!NetworkServer.active || (((Component)multiShopController).TryGetComponent(ref val) && !(val.state is Idle))) { return; } DroneVendorTerminalBehavior[] terminals = multiShopController._terminals; for (int i = 0; i < terminals.Length; i++) { if (!terminals[i].hasBeenPurchased && !terminals[i].purchaseInteraction.available) { recoveredShop = true; if (((Component)terminals[i]).GetComponent().state is Idle) { multiShopController.Networkavailable = true; } ((Component)terminals[i]).GetComponent().SetAvailable(true); terminals[i].SetPickup(savedPickups[i], false); } } } public void TryCloseShop() { if (!recoveredShop) { return; } DroneVendorTerminalBehavior[] terminals = multiShopController._terminals; for (int i = 0; i < terminals.Length; i++) { if (!terminals[i].hasBeenPurchased) { multiShopController.Networkavailable = false; terminals[i].purchaseInteraction.SetAvailable(false); terminals[i].SetNoPickup(); } } } private void OnEnable() { InstanceTracker.Add(this); } private void OnDisable() { InstanceTracker.Remove(this); } } internal static class Options { public static bool IsEnabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public static void Init() { RetroactiveMacro.ChangeSaleStar = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind("Sale Star", "Change Sale Star", true, "Reopen chests instead"); RetroactiveMacro.ExcludeSaleStarChest = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind("Sale Star", "Exclude Sale Star Chests", true, "Chests that drop a Sale Star cannot be reopened"); RetroactiveMacro.SaleStarNerf = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind("Sale Star", "Nerf/Rework", false, "Reopening a chest has a 50% (-25% per stack) chance to fail up to 3 times. Failing does not consume Sale Stars"); RetroactiveMacro.ChangeCard = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind("Executive Card", "Change Credit Card", true, "While holding the card, reopen all closed multishops"); RetroactiveMacro.ExcludeEquipShops = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind("Executive Card", "Exclude Equipment Shops", true, "Exclude equipment tri shops from all card changes"); if (IsEnabled) { RiskOfOptionsConfig(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RiskOfOptionsConfig() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RetroactiveMacro.ChangeSaleStar, true), "Onyx.RetroactiveMacro", "RetroactiveMacro"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RetroactiveMacro.ExcludeSaleStarChest, true), "Onyx.RetroactiveMacro", "RetroactiveMacro"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RetroactiveMacro.SaleStarNerf, false), "Onyx.RetroactiveMacro", "RetroactiveMacro"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RetroactiveMacro.ChangeCard), "Onyx.RetroactiveMacro", "RetroactiveMacro"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RetroactiveMacro.ExcludeEquipShops), "Onyx.RetroactiveMacro", "RetroactiveMacro"); ModSettingsManager.SetModDescription("Options for RetroactiveMacro", "Onyx.RetroactiveMacro", "RetroactiveMacro"); FileInfo fileInfo = null; DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); do { FileInfo[] files = directoryInfo.GetFiles("icon.png", SearchOption.TopDirectoryOnly); if (files != null && files.Length != 0) { fileInfo = files[0]; break; } directoryInfo = directoryInfo.Parent; } while (directoryInfo != null && directoryInfo.Exists && !string.Equals(directoryInfo.Name, "plugins", StringComparison.OrdinalIgnoreCase)); if (fileInfo != null) { Texture2D val = new Texture2D(256, 256); if (ImageConversion.LoadImage(val, File.ReadAllBytes(fileInfo.FullName))) { Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); ((Object)obj).name = "RetroactiveMacroIcon"; ModSettingsManager.SetModIcon(obj, "Onyx.RetroactiveMacro", "RetroactiveMacro"); } } } } public static class QualityCompat { public class LastBuyTracker : MonoBehaviour { public QualityTier qualityTier = (QualityTier)(-1); } [CompilerGenerated] private static class <>O { public static Manipulator <0>__generateQualityDropTiersFromSaleStars; public static Manipulator <1>__tryUpgradePickupQualityFromSaleStars; public static tryUpgradeQualityFromCost.PostfixSignature <2>__tryUpgradeQualityFromCost; public static Func <3>__makeFirstItemQuality; } private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); } return _enabled.Value; } } [SystemInitializer(new Type[] { })] public static void Init() { if (enabled) { InitContent(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void InjectQualityInitializer() { SystemInitializerInjector.InjectDependency(typeof(QualityCompat), typeof(QualityCatalog)); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void InitContent() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (RetroactiveMacro.ChangeSaleStar.Value) { object obj = <>O.<0>__generateQualityDropTiersFromSaleStars; if (obj == null) { Manipulator val = generateQualityDropTiersFromSaleStars; <>O.<0>__generateQualityDropTiersFromSaleStars = val; obj = (object)val; } Md.ItemQualities.Items.LowerPricedChests.generateQualityDropTiersFromSaleStars.ILHook((Manipulator)obj); object obj2 = <>O.<1>__tryUpgradePickupQualityFromSaleStars; if (obj2 == null) { Manipulator val2 = tryUpgradePickupQualityFromSaleStars; <>O.<1>__tryUpgradePickupQualityFromSaleStars = val2; obj2 = (object)val2; } Md.ItemQualities.Items.LowerPricedChests.tryUpgradePickupQualityFromSaleStars.ILHook((Manipulator)obj2); Md.ItemQualities.ItemCostQualityPatch.tryUpgradeQualityFromCost.Postfix(tryUpgradeQualityFromCost); } AsyncOperationHandle val3 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_EquipmentBarrel.animEquipmentBarrel_controller), (AsyncReferenceHandleUnloadType)2); val3.Completed += delegate(AsyncOperationHandle controller) { AnimatorModifications val4 = AnimatorModifications.CreateFromDiff(RetroactiveMacro.Bundle.LoadAsset("Assets/Animations/EquipBarrel/Closing.controllerdiff"), RetroactiveMacro.bepInPlugin); GameObject prefab = ((SpawnCard)SpawnCards.QualityEquipmentBarrel).prefab; AnimationsAPI.AddModifications(RetroactiveMacro.GetBaseBundlePath("ror2-base-equipmentbarrel_static_assets_all"), controller.Result, val4); RetroactiveMacro.RegisterPurchaseReplacementAnimation(controller.Result, prefab, "ModelBase/mdlQualityEquipmentBarrel"); }; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static EquipmentIndex GetBaseEquipmentIndex(EquipmentIndex equipmentIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) if ((int)equipmentIndex == -1) { return equipmentIndex; } return PickupCatalog.GetPickupDef(QualityCatalog.GetPickupIndexOfQuality(PickupCatalog.equipmentIndexToPickupIndex[equipmentIndex], (QualityTier)(-1))).equipmentIndex; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static ItemIndex GetBaseItemIndex(ItemIndex itemIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) if ((int)itemIndex == -1) { return itemIndex; } return QualityCatalog.GetItemIndexOfQuality(itemIndex, (QualityTier)(-1)); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddLastbuyTracker(GameObject gameObject) { gameObject.AddComponent(); } private static void tryUpgradeQualityFromCost(ref PickupIndex intendedDropPickupIndex, ref GameObject dropperObject, ref PickupIndex returnValue) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) LastBuyTracker lastBuyTracker = default(LastBuyTracker); if (dropperObject.TryGetComponent(ref lastBuyTracker)) { if (lastBuyTracker.qualityTier > QualityCatalog.GetQualityTier(returnValue)) { returnValue = QualityCatalog.GetPickupIndexOfQuality(intendedDropPickupIndex, lastBuyTracker.qualityTier); } lastBuyTracker.qualityTier = QualityCatalog.GetQualityTier(returnValue); } } private static void tryUpgradePickupQualityFromSaleStars(ILManipulationInfo info) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(info.Context); ILLabel val2 = default(ILLabel); if (val.TryGotoNext((MoveType)0, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0), (Instruction x) => ILPatternMatchingExt.MatchBle(x, ref val2) })) { val.Emit(OpCodes.Ldc_I4, 1); val.Emit(OpCodes.Add); } else { Log.Error(((MemberReference)info.Context.Method).Name + "Failed to find patch location"); } if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchSub(x) })) { val.Emit(OpCodes.Ldc_I4, 1); val.Emit(OpCodes.Add); } else { Log.Error(((MemberReference)info.Context.Method).Name + "Failed to find patch location 2"); } } private static void generateQualityDropTiersFromSaleStars(ILManipulationInfo info) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(info.Context); if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1), (Instruction x) => ILPatternMatchingExt.MatchSub(x) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)makeFirstItemQuality); } else { Log.Error(((MemberReference)info.Context.Method).Name + "Failed to find patch location"); } static int makeFirstItemQuality(int minQuality, GameObject purchasedObject) { RouletteChestController val2 = default(RouletteChestController); if (purchasedObject.TryGetComponent(ref val2)) { return minQuality; } return minQuality + 1; } } } [BepInPlugin("Onyx.RetroactiveMacro", "RetroactiveMacro", "1.2.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class RetroactiveMacro : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Manipulator <0>__PingIndicator_Update; public static Func <1>__OverwritePingable; } public const string PluginGUID = "Onyx.RetroactiveMacro"; public const string PluginAuthor = "Onyx"; public const string PluginName = "RetroactiveMacro"; public const string PluginVersion = "1.2.4"; public static RetroactiveMacro Instance; public static AssetBundle Bundle; public static GameObject FakeInteractableLock; public static BepInPlugin bepInPlugin; private static readonly Dictionary _RegisteredAnimators = new Dictionary(); public static ConfigEntry ChangeSaleStar { get; set; } public static ConfigEntry ChangeCard { get; set; } public static ConfigEntry ExcludeEquipShops { get; set; } public static ConfigEntry ExcludeSaleStarChest { get; set; } public static ConfigEntry SaleStarNerf { get; set; } public void Awake() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); bepInPlugin = new BepInPlugin("Onyx.RetroactiveMacro", "RetroactiveMacro", "1.2.4"); Instance = SingletonHelper.Assign(Instance, this); Options.Init(); if (QualityCompat.enabled) { QualityCompat.InjectQualityInitializer(); } Bundle = AssetBundle.LoadFromFile(GetModBundlePath(Assembly.GetExecutingAssembly(), "bundle.bundle")); bool flag = default(bool); ContentAddition.AddEntityState(ref flag); FakeInteractableLock = PrefabAPI.CreateEmptyPrefab("FakeInteractableLock", true); PrefabAPI.RegisterNetworkPrefab(FakeInteractableLock); AsyncOperationHandle val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_MultiShopTerminal.animMultiShopTerminal_controller), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_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) AnimatorModifications val3 = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset("Assets/Animations/MultiShop/Reopen.controllerdiff"), bepInPlugin); AnimationsAPI.AddModifications(GetBaseBundlePath("ror2-base-multishopterminal_assets_all"), controller.Result, val3); AsyncOperationHandle val4 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_MultiShopTerminal.MultiShopTerminal_prefab), (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle prefab) { RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "Display/mdlMultiShopTerminal"); }; val4 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_MultiShopEquipmentTerminal.MultiShopEquipmentTerminal_prefab), (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle prefab) { RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "Display/mdlMultiShopTerminal"); }; val4 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_MultiShopLargeTerminal.MultiShopLargeTerminal_prefab), (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle prefab) { RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "Display/mdlMultiShopTerminal"); }; }; val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_DLC1_FreeChestMultiShop.animShippingDronePod_controller), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle val3 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_DLC1_FreeChestTerminalShippingDrone.FreeChestTerminalShippingDrone_prefab), (AsyncReferenceHandleUnloadType)2); val3.Completed += delegate(AsyncOperationHandle prefab) { AnimatorModifications val4 = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset("Assets/Animations/ShippingDrone/Reopen.controllerdiff"), bepInPlugin); AnimationsAPI.AddModifications(GetBaseBundlePath("ror2-dlc1-freechestmultishop_static_assets_all"), controller.Result, val4); RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "mdlShippingDronePod"); }; }; val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_EquipmentBarrel.animEquipmentBarrel_controller), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle val3 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_EquipmentBarrel.EquipmentBarrel_prefab), (AsyncReferenceHandleUnloadType)2); val3.Completed += delegate(AsyncOperationHandle prefab) { AnimatorModifications val4 = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset("Assets/Animations/EquipBarrel/Closing.controllerdiff"), bepInPlugin); AnimationsAPI.AddModifications(GetBaseBundlePath("ror2-base-equipmentbarrel_static_assets_all"), controller.Result, val4); RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "ModelBase/mdlEquipmentBarrel"); }; }; val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_TreasureCache.animLockbox_controller), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) AsyncOperationHandle val3 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_TreasureCache.Lockbox_prefab), (AsyncReferenceHandleUnloadType)2); val3.Completed += delegate(AsyncOperationHandle prefab) { AnimatorModifications val4 = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset("Assets/Animations/Lockbox/Closing.controllerdiff"), bepInPlugin); AnimationsAPI.AddModifications(GetBaseBundlePath("ror2-base-treasurecache_static_assets_all"), controller.Result, val4); RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "ModelBase/mdlKeyLockbox"); if (QualityCompat.enabled) { QualityCompat.AddLastbuyTracker(prefab.Result); } }; }; val = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_GoldChest.animGoldChest_controller), (AsyncReferenceHandleUnloadType)2); val.Completed += delegate(AsyncOperationHandle controller) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) AnimatorDiff val3 = Bundle.LoadAsset("Assets/Animations/GoldChest/Closing.controllerdiff"); AnimatorModifications newAnimations = AnimatorModifications.CreateFromDiff(val3, bepInPlugin); AsyncOperationHandle val4 = AssetAsyncReferenceManager.LoadAsset(new AssetReferenceT(RoR2_Base_GoldChest.GoldChest_prefab), (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle prefab) { AnimationsAPI.AddModifications(GetBaseBundlePath("ror2-base-goldchest_static_assets_all"), controller.Result, newAnimations); RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "mdlGoldChest"); }; }; object obj = <>O.<0>__PingIndicator_Update; if (obj == null) { Manipulator val2 = PingIndicator_Update; <>O.<0>__PingIndicator_Update = val2; obj = (object)val2; } PingIndicator.Update += (Manipulator)obj; SceneDirector.onPrePopulateSceneServer += PrePopulateSceneServer; } private void PrePopulateSceneServer(SceneDirector director) { Animator val2 = default(Animator); foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { foreach (KeyValuePair registeredAnimator in _RegisteredAnimators) { Transform val = ((Component)instances).transform.Find(registeredAnimator.Key); if (Object.op_Implicit((Object)(object)val) && ((Component)val).TryGetComponent(ref val2)) { AnimationsAPI.AddAnimatorController(val2, registeredAnimator.Value.runtimeAnimatorController); } } } } public static void RegisterPurchaseReplacementAnimation(RuntimeAnimatorController controller, GameObject origPrefab, string animatorTransformPath) { Transform val = origPrefab.transform.Find(animatorTransformPath); AnimationsAPI.AddAnimatorController(((Component)val).GetComponent(), controller); if (!_RegisteredAnimators.ContainsKey(animatorTransformPath)) { _RegisteredAnimators.Add(animatorTransformPath, ((Component)val).GetComponent()); } } public static void ReplaceComponent(T dest, T source) where T : Component { Object.Destroy((Object)(object)dest); ((MonoBehaviour)Instance).StartCoroutine(waitForClone(((Component)dest).transform, source)); static IEnumerator waitForClone(Transform val, T val2) where T : Component { yield return (object)new WaitForFixedUpdate(); Extensions.CloneComponent(((Component)val).gameObject, val2); } } private static void PingIndicator_Update(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel label = null; if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PurchaseInteraction), "available"), (Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref label) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)OverwritePingable); val.Emit(OpCodes.Brtrue, (object)label); } else { Log.Error(((MemberReference)il.Method).Name + "Failed to find patch location"); } static bool OverwritePingable(PingIndicator self) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_0094: Unknown result type (might be due to invalid IL or missing references) ShopTerminalBehavior val2 = default(ShopTerminalBehavior); if (ChangeCard.Value && ((Component)self.pingTargetPurchaseInteraction).TryGetComponent(ref val2)) { if (Object.op_Implicit((Object)(object)val2.serverMultiShopController)) { bool flag = false; GameObject[] terminalGameObjects = val2.serverMultiShopController.terminalGameObjects; ShopTerminalBehavior val3 = default(ShopTerminalBehavior); for (int i = 0; i < terminalGameObjects.Length; i++) { if (terminalGameObjects[i].TryGetComponent(ref val3) && !val3.hasBeenPurchased) { flag = true; break; } } if (!flag) { return false; } } if (Object.op_Implicit((Object)(object)val2.animator)) { int layerIndex = val2.animator.GetLayerIndex("Body"); AnimatorStateInfo currentAnimatorStateInfo = val2.animator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime != 0f) { return true; } } } if (ChangeSaleStar.Value) { return self.pingTargetPurchaseInteraction.costType == SaleStarCost.SaleStar; } return false; } } public static string GetModBundlePath(Assembly assembly, string bundleName) { return Path.Combine(Path.GetDirectoryName(assembly.Location), bundleName); } public static string GetBaseBundlePath(string bundleName) { string text = Path.Combine(Addressables.RuntimePath, "StandaloneWindows64"); string[] files = Directory.GetFiles(text, bundleName + "*", SearchOption.AllDirectories); if (files.Length == 0) { Log.Error(text + " <" + bundleName + ">: path doesn't exist"); } return files[0]; } } public static class SaleStar { public class ChestLootTracker : MonoBehaviour { public ItemIndex ItemIndex; } [CompilerGenerated] private static class <>O { public static hook_OnEnter <0>__Opened_OnEnter; public static Manipulator <1>__InteractionDriver_MyFixedUpdate; public static Manipulator <2>__IL_PurchaseInteraction_OnInteractionBegin; public static Action <3>__BeginExit; public static Manipulator <4>__LockInteractable; public static hook_BaseItemDrop <5>__ChestBehavior_BaseItemDrop; public static hook_OnInteractionBegin <6>__PurchaseInteraction_OnInteractionBegin; public static EventHandler <7>__SaleStarNerfLanguage; public static Func <8>__replaceLock; public static Func <9>__skipStarUse; public static Func <10>__showStarVisual; } public static LanguageOverlay NerfOverlay; [SystemInitializer(new Type[] { })] private static void Init() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected O, but got Unknown //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown if (RetroactiveMacro.ChangeSaleStar.Value) { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lang", "SaleStar.language"); if (File.Exists(text)) { LanguageAPI.AddOverlayPath(text); } else { Log.Error("Failed to find path: " + text); } object obj = <>O.<0>__Opened_OnEnter; if (obj == null) { hook_OnEnter val = Opened_OnEnter; <>O.<0>__Opened_OnEnter = val; obj = (object)val; } Opened.OnEnter += (hook_OnEnter)obj; object obj2 = <>O.<1>__InteractionDriver_MyFixedUpdate; if (obj2 == null) { Manipulator val2 = InteractionDriver_MyFixedUpdate; <>O.<1>__InteractionDriver_MyFixedUpdate = val2; obj2 = (object)val2; } InteractionDriver.MyFixedUpdate += (Manipulator)obj2; object obj3 = <>O.<2>__IL_PurchaseInteraction_OnInteractionBegin; if (obj3 == null) { Manipulator val3 = IL_PurchaseInteraction_OnInteractionBegin; <>O.<2>__IL_PurchaseInteraction_OnInteractionBegin = val3; obj3 = (object)val3; } PurchaseInteraction.OnInteractionBegin += (Manipulator)obj3; SceneExitController.onBeginExit += BeginExit; object obj4 = <>O.<4>__LockInteractable; if (obj4 == null) { Manipulator val4 = LockInteractable; <>O.<4>__LockInteractable = val4; obj4 = (object)val4; } OutsideInteractableLocker.LockInteractable += (Manipulator)obj4; object obj5 = <>O.<5>__ChestBehavior_BaseItemDrop; if (obj5 == null) { hook_BaseItemDrop val5 = ChestBehavior_BaseItemDrop; <>O.<5>__ChestBehavior_BaseItemDrop = val5; obj5 = (object)val5; } ChestBehavior.BaseItemDrop += (hook_BaseItemDrop)obj5; object obj6 = <>O.<6>__PurchaseInteraction_OnInteractionBegin; if (obj6 == null) { hook_OnInteractionBegin val6 = PurchaseInteraction_OnInteractionBegin; <>O.<6>__PurchaseInteraction_OnInteractionBegin = val6; obj6 = (object)val6; } PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)obj6; RetroactiveMacro.SaleStarNerf.SettingChanged += SaleStarNerfLanguage; } } private static void SaleStarNerfLanguage(object sender, EventArgs e) { if (RetroactiveMacro.SaleStarNerf.Value) { string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lang", "SaleStarNerf.language"); if (File.Exists(text)) { NerfOverlay = LanguageAPI.AddOverlayPath(text); } else { Log.Error("Failed to find path: " + text); } } else { LanguageOverlay nerfOverlay = NerfOverlay; if (nerfOverlay != null) { nerfOverlay.Remove(); } } } private static void ChestBehavior_BaseItemDrop(orig_BaseItemDrop orig, ChestBehavior self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0040: 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_0046: Unknown result type (might be due to invalid IL or missing references) if (RetroactiveMacro.ExcludeSaleStarChest.Value) { ChestLootTracker chestLootTracker = UnityObjectExtensions.EnsureComponent((Component)(object)self); UniquePickup currentPickup = self.currentPickup; if (((UniquePickup)(ref currentPickup)).isValid) { ItemIndex itemIndex = PickupCatalog.GetPickupDef(self.currentPickup.pickupIndex).itemIndex; if (QualityCompat.enabled) { itemIndex = QualityCompat.GetBaseItemIndex(itemIndex); } chestLootTracker.ItemIndex = itemIndex; } } orig.Invoke(self); } private static void LockInteractable(ILContext il) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.DefineLabel(); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(OutsideInteractableLocker), "lockPrefab") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>((Func)replaceLock); } else { Log.Error(((MemberReference)il.Method).Name + "Failed to find patch location"); } static GameObject replaceLock(GameObject LockPrefab, IInteractableLockable interactableLockable) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = interactableLockable.GetGameObject(); PurchaseInteraction val2 = default(PurchaseInteraction); if (Object.op_Implicit((Object)(object)gameObject) && gameObject.TryGetComponent(ref val2) && val2.costType == SaleStarCost.SaleStar) { return RetroactiveMacro.FakeInteractableLock; } return LockPrefab; } } private static void BeginExit(SceneExitController controller) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { if (instances.saleStarCompatible && instances.costType == SaleStarCost.SaleStar) { instances.SetAvailable(false); } } } private static void PurchaseInteraction_OnInteractionBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) LowerPricedChestsBodyBehavoir lowerPricedChestsBodyBehavoir = default(LowerPricedChestsBodyBehavoir); if (((Component)activator).TryGetComponent(ref lowerPricedChestsBodyBehavoir) && self.costType == SaleStarCost.SaleStar) { lowerPricedChestsBodyBehavoir.RollSaleStar(); } orig.Invoke(self, activator); ChestBehavior val = default(ChestBehavior); if (Object.op_Implicit((Object)(object)lowerPricedChestsBodyBehavoir) && !lowerPricedChestsBodyBehavoir.lastRoll && self.costType == SaleStarCost.SaleStar && ((Component)self).TryGetComponent(ref val)) { val.dropCount = 0; } } private static void IL_PurchaseInteraction_OnInteractionBegin(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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) //IL_00ec: 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) ILCursor val = new ILCursor(il); ILLabel label = null; if (!val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PurchaseInteraction), "saleStarCompatible"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { Log.Error(((MemberReference)il.Method).Name + "Failed to find patch location"); } val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate>((Func)skipStarUse); val.Emit(OpCodes.Brfalse, (object)label); if (val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(ChestBehavior), "dropCount") })) { val.Emit(OpCodes.Ldc_I4_1); val.Emit(OpCodes.Sub); } else { Log.Error(((MemberReference)il.Method).Name + "Failed to find patch location"); } static bool skipStarUse(PurchaseInteraction self, Interactor activator) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) RouletteChestController val2 = default(RouletteChestController); if (((Component)self).TryGetComponent(ref val2)) { return true; } LowerPricedChestsBodyBehavoir lowerPricedChestsBodyBehavoir = default(LowerPricedChestsBodyBehavoir); if (self.costType == SaleStarCost.SaleStar && ((Component)activator).TryGetComponent(ref lowerPricedChestsBodyBehavoir)) { return lowerPricedChestsBodyBehavoir.lastRoll; } return false; } } private static void InteractionDriver_MyFixedUpdate(ILContext il) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel label = null; if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PurchaseInteraction), "saleStarCompatible"), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label) })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)showStarVisual); val.Emit(OpCodes.Brfalse, (object)label); } else { Log.Error(((MemberReference)il.Method).Name + "Failed to find patch location"); } static bool showStarVisual(InteractionDriver self) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) PurchaseInteraction val2 = default(PurchaseInteraction); if (!self.currentInteractable.TryGetComponent(ref val2)) { return false; } RouletteChestController val3 = default(RouletteChestController); if (self.currentInteractable.TryGetComponent(ref val3)) { return true; } return val2.costType == SaleStarCost.SaleStar; } } private static void Opened_OnEnter(orig_OnEnter orig, Opened self) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) orig.Invoke(self); ChestBehavior val = default(ChestBehavior); PurchaseInteraction val2 = default(PurchaseInteraction); if (!((EntityState)self).TryGetComponent(ref val) || !((EntityState)self).TryGetComponent(ref val2) || !val2.saleStarCompatible) { return; } if (val2.costType != SaleStarCost.SaleStar) { ChestLootTracker chestLootTracker = default(ChestLootTracker); if (!((EntityState)self).TryGetComponent(ref chestLootTracker) || chestLootTracker.ItemIndex != Items.LowerPricedChests.itemIndex) { if (Util.GetItemCountForTeam((TeamIndex)1, Items.LowerPricedChests.itemIndex, true, true) > 0) { val2.SetAvailable(true); } ((EntityState)self).SetPingable(true); val2.costType = SaleStarCost.SaleStar; val.openState = new SerializableEntityStateType(typeof(CloseOpen)); } } else { val2.costType = (CostTypeIndex)1; } } } public class CloseOpen : Closing { public override void OnExit() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown ((EntityState)this).OnExit(); ChestBehavior val = default(ChestBehavior); PurchaseInteraction val2 = default(PurchaseInteraction); if (!((Component)((EntityState)this).outer).TryGetComponent(ref val) || !((Component)((EntityState)this).outer).TryGetComponent(ref val2)) { return; } val.Roll(); foreach (PersistentCall call in ((UnityEventBase)val2.onPurchase).m_PersistentCalls.m_Calls) { if (call.methodName == "ItemDrop") { val.ItemDrop(); break; } } ((EntityState)this).outer.SetNextState((EntityState)new Opening()); } } public class LowerPricedChestsBodyBehavoir : BaseItemBodyBehavior { private float _weightReduction; private Xoroshiro128Plus _rng; public bool lastRoll; [ItemDefAssociation(useOnServer = true, useOnClient = false)] private static ItemDef GetItemDef() { return Items.LowerPricedChests; } private void Start() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown _rng = new Xoroshiro128Plus(Run.instance.treasureRng.nextUlong); ResetSelection(); } private void OnEnable() { //IL_0037: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = default(EntityStateMachine); SaleStar.ChestLootTracker chestLootTracker = default(SaleStar.ChestLootTracker); foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { if (((Component)instances).TryGetComponent(ref val) && val.state is Opened && (!((Component)instances).TryGetComponent(ref chestLootTracker) || chestLootTracker.ItemIndex != Items.LowerPricedChests.itemIndex) && instances.saleStarCompatible && instances.costType == SaleStarCost.SaleStar) { instances.SetAvailable(true); } } } private void OnDisable() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (Util.GetItemCountForTeam((TeamIndex)1, Items.LowerPricedChests.itemIndex, true, true) > 0) { return; } foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { if (instances.saleStarCompatible && instances.costType == SaleStarCost.SaleStar) { instances.SetAvailable(false); } } } private void ResetSelection() { _weightReduction = 0f; } public bool RollSaleStar() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = default(CharacterBody); if (!((Component)this).TryGetComponent(ref val) || !Object.op_Implicit((Object)(object)val.inventory) || !RetroactiveMacro.SaleStarNerf.Value) { lastRoll = true; return true; } int num = val.inventory.GetItemCountEffective(Items.LowerPricedChests.itemIndex) - 1; lastRoll = _rng.RangeFloat(0f, 6f - _weightReduction + (float)num * 1.5f) <= 3f + 1.5f * (float)num; int num2 = 0; foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { if (instances.saleStarCompatible && instances.available) { num2++; } } lastRoll |= num2 <= 1; if (lastRoll) { ResetSelection(); } else { _weightReduction += 1f; } return lastRoll; } } public static class SaleStarCost { private static readonly CostTypeDef _saleStarCost = new CostTypeDef { name = "SaleStarCost", colorIndex = (ColorIndex)2, itemTier = (ItemTier)1, costStringFormatToken = "ITEM_LOWERPRICEDCHESTS_NAME", isAffordable = new IsAffordableDelegate(IsAffordableSaleStar), payCost = (PayCostDelegate)delegate { } }; public static CostTypeIndex SaleStar { get; private set; } = (CostTypeIndex)0; [SystemInitializer(new Type[] { })] private static void Init() { CostTypeCatalog.modHelper.getAdditionalEntries += delegate(List entries) { entries.Add(_saleStarCost); }; } [SystemInitializer(new Type[] { typeof(CostTypeCatalog) })] private static void InitCostType() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) for (CostTypeIndex val = (CostTypeIndex)0; (int)val < CostTypeCatalog.costTypeCount; val = (CostTypeIndex)(val + 1)) { if (CostTypeCatalog.GetCostTypeDef(val) == _saleStarCost) { SaleStar = val; } } } private static bool IsAffordableSaleStar(CostTypeDef costTypeDef, IsAffordableContext context) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) CharacterBody val = (Object.op_Implicit((Object)(object)context.activator) ? ((Component)context.activator).GetComponent() : null); Inventory val2 = (Object.op_Implicit((Object)(object)val) ? val.inventory : null); if (Object.op_Implicit((Object)(object)val2)) { return val2.GetItemCountEffective(Items.LowerPricedChests) > 0; } return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }