Decompiled source of RetroactiveMacro v1.1.1

plugins/RetroactiveMacro.dll

Decompiled 3 days ago
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;
using On.EntityStates.Barrel;
using On.EntityStates.DroneVendor;
using On.RoR2;
using On.RoR2.Items;
using R2API;
using R2API.Models;
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+f43c4401091caff824c41a9f4f62d1e858a3202a")]
[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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(ItemCostQualityPatch).GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), 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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			return typeof(LowerPricedChests).GetMethod("Init", (BindingFlags)(-1), null, Array.Empty<Type>(), 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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			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<PrefixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).Hook<PostfixDetour>(Target(), (Delegate)hook, config, applyByDefault);
		}

		public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null)
		{
			return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault);
		}

		public static MethodBase Target()
		{
			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)
		{
		}

		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_SetEquipmentInternal_EquipmentState_uint_uint <0>__SetEquipment;

			public static hook_OnEnter <1>__GenericCharacterDeath_OnEnter;

			public static hook_UpdatePickupDisplayAndAnimations <2>__UpdatePickupDisplayAndAnimations;

			public static hook_TryReviveOnBodyDeath <3>__TryReviveOnBodyDeath;

			public static hook_OnPurchase <4>__OnPurchase;

			public static Action<SceneDirector> <5>__PrePopulateSceneServer;

			public static hook_OnExit <6>__DroneVendorAssumeIdle_OnExit;
		}

		private static bool _onCooldown;

		[SystemInitializer(new Type[] { })]
		private static void Init()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Expected O, but got Unknown
			//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_0048: Expected O, but got Unknown
			//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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//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_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			if (!RetroactiveMacro.ChangeCard.Value)
			{
				return;
			}
			object obj = <>O.<0>__SetEquipment;
			if (obj == null)
			{
				hook_SetEquipmentInternal_EquipmentState_uint_uint val = SetEquipment;
				<>O.<0>__SetEquipment = val;
				obj = (object)val;
			}
			Inventory.SetEquipmentInternal_EquipmentState_uint_uint += (hook_SetEquipmentInternal_EquipmentState_uint_uint)obj;
			object obj2 = <>O.<1>__GenericCharacterDeath_OnEnter;
			if (obj2 == null)
			{
				hook_OnEnter val2 = GenericCharacterDeath_OnEnter;
				<>O.<1>__GenericCharacterDeath_OnEnter = val2;
				obj2 = (object)val2;
			}
			GenericCharacterDeath.OnEnter += (hook_OnEnter)obj2;
			object obj3 = <>O.<2>__UpdatePickupDisplayAndAnimations;
			if (obj3 == null)
			{
				hook_UpdatePickupDisplayAndAnimations val3 = UpdatePickupDisplayAndAnimations;
				<>O.<2>__UpdatePickupDisplayAndAnimations = val3;
				obj3 = (object)val3;
			}
			ShopTerminalBehavior.UpdatePickupDisplayAndAnimations += (hook_UpdatePickupDisplayAndAnimations)obj3;
			object obj4 = <>O.<3>__TryReviveOnBodyDeath;
			if (obj4 == null)
			{
				hook_TryReviveOnBodyDeath val4 = TryReviveOnBodyDeath;
				<>O.<3>__TryReviveOnBodyDeath = val4;
				obj4 = (object)val4;
			}
			CharacterMaster.TryReviveOnBodyDeath += (hook_TryReviveOnBodyDeath)obj4;
			object obj5 = <>O.<4>__OnPurchase;
			if (obj5 == null)
			{
				hook_OnPurchase val5 = OnPurchase;
				<>O.<4>__OnPurchase = val5;
				obj5 = (object)val5;
			}
			MultiShopCardUtils.OnPurchase += (hook_OnPurchase)obj5;
			SceneDirector.onPrePopulateSceneServer += PrePopulateSceneServer;
			object obj6 = <>O.<6>__DroneVendorAssumeIdle_OnExit;
			if (obj6 == null)
			{
				hook_OnExit val6 = DroneVendorAssumeIdle_OnExit;
				<>O.<6>__DroneVendorAssumeIdle_OnExit = val6;
				obj6 = (object)val6;
			}
			DroneVendorAssumeIdle.OnExit += (hook_OnExit)obj6;
			AsyncOperationHandle<GameObject> val7 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_TripleShop.TripleShop_prefab), (AsyncReferenceHandleUnloadType)2);
			val7.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				x.Result.AddComponent<MacroCardItemHandler>();
			};
			if (!RetroactiveMacro.ExcludeEquipShops.Value)
			{
				val7 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_TripleShopEquipment.TripleShopEquipment_prefab), (AsyncReferenceHandleUnloadType)2);
				val7.Completed += delegate(AsyncOperationHandle<GameObject> x)
				{
					x.Result.AddComponent<MacroCardItemHandler>();
				};
			}
			val7 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_TripleShopLarge.TripleShopLarge_prefab), (AsyncReferenceHandleUnloadType)2);
			val7.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				x.Result.AddComponent<MacroCardItemHandler>();
			};
			val7 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC1_FreeChestMultiShop.FreeChestMultiShop_prefab), (AsyncReferenceHandleUnloadType)2);
			val7.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				x.Result.AddComponent<MacroCardItemHandler>();
			};
			val7 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC3_TripleDroneShop.TripleDroneShop_prefab), (AsyncReferenceHandleUnloadType)2);
			val7.Completed += delegate(AsyncOperationHandle<GameObject> x)
			{
				x.Result.AddComponent<MacroCardDroneHandler>();
			};
		}

		private static void OnPurchase(orig_OnPurchase orig, PayCostContext context, int moneyCost)
		{
			_onCooldown = true;
			((MonoBehaviour)RetroactiveMacro.Instance).StartCoroutine(UsedCard());
			orig.Invoke(context, moneyCost);
		}

		private static IEnumerator UsedCard()
		{
			yield return (object)new WaitForSeconds(0.5f);
			_onCooldown = false;
			if (!PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex))
			{
				HasNoCard();
			}
		}

		private static void PrePopulateSceneServer(SceneDirector director)
		{
			MultiShopController val = default(MultiShopController);
			DroneVendorMultiShopController val2 = default(DroneVendorMultiShopController);
			foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>())
			{
				Transform parent = ((Component)instances).transform.parent;
				if (Object.op_Implicit((Object)(object)parent))
				{
					if (((Component)parent).TryGetComponent<MultiShopController>(ref val))
					{
						((Component)parent).gameObject.AddComponent<MacroCardItemHandler>();
					}
					if (((Component)parent).TryGetComponent<DroneVendorMultiShopController>(ref val2))
					{
						((Component)parent).gameObject.AddComponent<MacroCardItemHandler>();
					}
				}
			}
		}

		private static bool TryReviveOnBodyDeath(orig_TryReviveOnBodyDeath orig, CharacterMaster self, CharacterBody body)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			bool num = orig.Invoke(self, body);
			if (num && PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex))
			{
				HasCard();
			}
			return num;
		}

		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 SetEquipment(orig_SetEquipmentInternal_EquipmentState_uint_uint orig, Inventory self, EquipmentState equipmentState, uint slot, uint set)
		{
			//IL_0002: 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)
			bool result = orig.Invoke(self, equipmentState, slot, set);
			if (PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex))
			{
				HasCard();
				return result;
			}
			HasNoCard();
			return result;
		}

		private static void GenericCharacterDeath_OnEnter(orig_OnEnter orig, GenericCharacterDeath self)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			if (self.isPlayerDeath && !PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex))
			{
				HasNoCard();
			}
		}

		private static bool PlayerTeamHasEquipment(EquipmentIndex equipment)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			if (_onCooldown)
			{
				return true;
			}
			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_0010: 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)
			//IL_0012: 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_0026: 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_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: 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)
			for (uint num = 0u; num < inventory.GetEquipmentSlotCount(); num++)
			{
				for (uint num2 = 0u; num2 < inventory.GetEquipmentSetCount(num); num2++)
				{
					EquipmentState equipment2 = inventory.GetEquipment(num, num2);
					EquipmentIndex val = equipment2.equipmentIndex;
					if (QualityCompat.enabled)
					{
						val = QualityCompat.GetBaseEquipmentIndex(val);
					}
					if (val == equipment && equipment2.charges > 0)
					{
						return true;
					}
				}
			}
			return false;
		}

		private static void DroneVendorAssumeIdle_OnExit(orig_OnExit orig, DroneVendorAssumeIdle self)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			orig.Invoke(self);
			MacroCardDroneHandler cardHandler = default(MacroCardDroneHandler);
			if (PlayerTeamHasEquipment(Equipment.MultiShopCard.equipmentIndex) && ((EntityState)self).TryGetComponent<MacroCardDroneHandler>(ref cardHandler))
			{
				((MonoBehaviour)RetroactiveMacro.Instance).StartCoroutine(WaitToReenable());
			}
			IEnumerator WaitToReenable()
			{
				yield return (object)new WaitForFixedUpdate();
				DroneVendorHasCard(cardHandler);
			}
		}

		private static void HasNoCard()
		{
			foreach (MacroCardItemHandler instances in InstanceTracker.GetInstancesList<MacroCardItemHandler>())
			{
				ItemVendorHasNoCard(instances);
			}
			foreach (MacroCardDroneHandler instances2 in InstanceTracker.GetInstancesList<MacroCardDroneHandler>())
			{
				DroneVendorHasNoCard(instances2);
			}
		}

		private static void HasCard()
		{
			foreach (MacroCardItemHandler instances in InstanceTracker.GetInstancesList<MacroCardItemHandler>())
			{
				ItemVendorHasCard(instances);
			}
			foreach (MacroCardDroneHandler instances2 in InstanceTracker.GetInstancesList<MacroCardDroneHandler>())
			{
				DroneVendorHasCard(instances2);
			}
		}

		private static void ItemVendorHasCard(MacroCardItemHandler cardHandler)
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			GameObject[] terminalGameObjects = cardHandler.multiShopController.terminalGameObjects;
			ShopTerminalBehavior val = default(ShopTerminalBehavior);
			for (int i = 0; i < terminalGameObjects.Length; i++)
			{
				if (terminalGameObjects[i].TryGetComponent<ShopTerminalBehavior>(ref val) && Object.op_Implicit((Object)(object)val.animator) && !val.hasBeenPurchased && !terminalGameObjects[i].GetComponent<PurchaseInteraction>().available)
				{
					cardHandler.recoveredShop = true;
					cardHandler.multiShopController.available = true;
					terminalGameObjects[i].GetComponent<PurchaseInteraction>().available = true;
					Util.PlaySound("Play_UI_tripleChestShutter", ((Component)val).gameObject);
					if (NetworkServer.active)
					{
						val.SetPickup(cardHandler.savedPickups[i], cardHandler.hidden[i]);
						val.UpdatePickupDisplayAndAnimations();
					}
				}
			}
		}

		private static void DroneVendorHasCard(MacroCardDroneHandler cardHandler)
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			EntityStateMachine val = default(EntityStateMachine);
			if (((Component)cardHandler.multiShopController).TryGetComponent<EntityStateMachine>(ref val) && !(val.state is Idle))
			{
				return;
			}
			DroneVendorTerminalBehavior[] terminals = cardHandler.multiShopController._terminals;
			for (int i = 0; i < terminals.Length; i++)
			{
				if (!terminals[i].hasBeenPurchased && !terminals[i].purchaseInteraction.available)
				{
					cardHandler.recoveredShop = true;
					if (((Component)terminals[i]).GetComponent<EntityStateMachine>().state is Idle)
					{
						cardHandler.multiShopController.available = true;
					}
					((Component)terminals[i]).GetComponent<PurchaseInteraction>().available = true;
					terminals[i].SetPickup(cardHandler.savedPickups[i], false);
				}
			}
		}

		private static void ItemVendorHasNoCard(MacroCardItemHandler cardHandler)
		{
			if (!cardHandler.recoveredShop)
			{
				return;
			}
			GameObject[] terminalGameObjects = cardHandler.multiShopController.terminalGameObjects;
			ShopTerminalBehavior val = default(ShopTerminalBehavior);
			for (int i = 0; i < terminalGameObjects.Length; i++)
			{
				if (terminalGameObjects[i].TryGetComponent<ShopTerminalBehavior>(ref val) && Object.op_Implicit((Object)(object)val.animator) && !val.hasBeenPurchased)
				{
					cardHandler.multiShopController.available = false;
					terminalGameObjects[i].GetComponent<PurchaseInteraction>().available = false;
					val.SetNoPickup();
				}
			}
		}

		private static void DroneVendorHasNoCard(MacroCardDroneHandler cardHandler)
		{
			if (!cardHandler.recoveredShop)
			{
				return;
			}
			DroneVendorTerminalBehavior[] terminals = cardHandler.multiShopController._terminals;
			for (int i = 0; i < terminals.Length; i++)
			{
				if (!terminals[i].hasBeenPurchased)
				{
					cardHandler.multiShopController.available = false;
					terminals[i].purchaseInteraction.available = false;
					terminals[i].SetNoPickup();
				}
			}
		}
	}
	public class MacroCardItemHandler : MonoBehaviour
	{
		public MultiShopController multiShopController;

		public UniquePickup[] savedPickups;

		public bool[] hidden;

		public bool recoveredShop;

		private void Awake()
		{
			multiShopController = ((Component)this).GetComponent<MultiShopController>();
		}

		private void OnPurchase(PayCostContext arg0, PayCostResults arg1)
		{
			bool[] doCloseOnTerminalPurchase = multiShopController.doCloseOnTerminalPurchase;
			foreach (bool flag in doCloseOnTerminalPurchase)
			{
				recoveredShop &= !flag;
			}
		}

		private void Start()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			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<ShopTerminalBehavior>(ref val))
				{
					savedPickups[i] = val.pickup;
					hidden[i] = val.hidden;
				}
				if (obj.TryGetComponent<PurchaseInteraction>(ref val2))
				{
					((UnityEvent<PayCostContext, PayCostResults>)(object)val2.onDetailedPurchaseServer).AddListener((UnityAction<PayCostContext, PayCostResults>)OnPurchase);
				}
			}
		}

		private void OnEnable()
		{
			InstanceTracker.Add<MacroCardItemHandler>(this);
		}

		private void OnDisable()
		{
			InstanceTracker.Remove<MacroCardItemHandler>(this);
		}
	}
	public class MacroCardDroneHandler : MonoBehaviour
	{
		public DroneVendorMultiShopController multiShopController;

		public UniquePickup[] savedPickups;

		public bool recoveredShop;

		private void Awake()
		{
			multiShopController = ((Component)this).GetComponent<DroneVendorMultiShopController>();
		}

		private void OnPurchase(PayCostContext arg0, PayCostResults arg1)
		{
			bool[] doCloseOnTerminalPurchase = multiShopController.doCloseOnTerminalPurchase;
			foreach (bool flag in doCloseOnTerminalPurchase)
			{
				recoveredShop &= !flag;
			}
		}

		private void Start()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			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<PayCostContext, PayCostResults>)(object)val.purchaseInteraction.onDetailedPurchaseServer).AddListener((UnityAction<PayCostContext, PayCostResults>)OnPurchase);
			}
		}

		private void OnEnable()
		{
			InstanceTracker.Add<MacroCardDroneHandler>(this);
		}

		private void OnDisable()
		{
			InstanceTracker.Remove<MacroCardDroneHandler>(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<bool>("Sale Star", "Change Sale Star", true, "Reopen chests instead");
			RetroactiveMacro.ExcludeSaleStarChest = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind<bool>("Sale Star", "Exclude Sale Star Chests", true, "Chests that drop a Sale Star cannot be reopened");
			RetroactiveMacro.SaleStarNerf = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind<bool>("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<bool>("Executive Card", "Change Credit Card", true, "While holding the card, reopen all closed multishops");
			RetroactiveMacro.ExcludeEquipShops = ((BaseUnityPlugin)RetroactiveMacro.Instance).Config.Bind<bool>("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<int, GameObject, int> <3>__makeFirstItemQuality;
		}

		private static bool? _enabled;

		public static bool enabled
		{
			get
			{
				if (!_enabled.HasValue)
				{
					_enabled = Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities");
				}
				return _enabled.Value;
			}
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void Init()
		{
			//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);
			}
		}

		[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_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)itemIndex == -1)
			{
				return itemIndex;
			}
			return PickupCatalog.GetPickupDef(QualityCatalog.GetPickupIndexOfQuality(PickupCatalog.itemIndexToPickupIndex[itemIndex], (QualityTier)(-1))).itemIndex;
		}

		[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
		public static void AddLastbuyTracker(GameObject gameObject)
		{
			gameObject.AddComponent<LastBuyTracker>();
		}

		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<LastBuyTracker>(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<Instruction, bool>[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<Instruction, bool>[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<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 1),
				(Instruction x) => ILPatternMatchingExt.MatchSub(x)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<int, GameObject, int>>((Func<int, GameObject, int>)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<RouletteChestController>(ref val2))
				{
					return minQuality;
				}
				return minQuality + 1;
			}
		}
	}
	[BepInPlugin("Onyx.RetroactiveMacro", "RetroactiveMacro", "1.1.1")]
	[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<PingIndicator, bool> <1>__OverwritePingable;
		}

		public const string PluginGUID = "Onyx.RetroactiveMacro";

		public const string PluginAuthor = "Onyx";

		public const string PluginName = "RetroactiveMacro";

		public const string PluginVersion = "1.1.1";

		public static RetroactiveMacro Instance;

		public static AssetBundle Bundle;

		public static GameObject FakeInteractableLock;

		public static BepInPlugin bepInPlugin;

		public static AnimatorModifications EquipBarrelModifications = null;

		private static readonly Dictionary<string, Animator> _RegisteredAnimators = new Dictionary<string, Animator>();

		public static ConfigEntry<bool> ChangeSaleStar { get; set; }

		public static ConfigEntry<bool> ChangeCard { get; set; }

		public static ConfigEntry<bool> ExcludeEquipShops { get; set; }

		public static ConfigEntry<bool> ExcludeSaleStarChest { get; set; }

		public static ConfigEntry<bool> SaleStarNerf { get; set; }

		public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "bundle.bundle");

		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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//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_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			bepInPlugin = new BepInPlugin("Onyx.RetroactiveMacro", "RetroactiveMacro", "1.1.1");
			Instance = SingletonHelper.Assign<RetroactiveMacro>(Instance, this);
			Options.Init();
			if (QualityCompat.enabled)
			{
				QualityCompat.Init();
			}
			Bundle = AssetBundle.LoadFromFile(AssetBundlePath);
			bool flag = default(bool);
			ContentAddition.AddEntityState<CloseOpen>(ref flag);
			FakeInteractableLock = PrefabAPI.CreateEmptyPrefab("FakeInteractableLock", true);
			PrefabAPI.RegisterNetworkPrefab(FakeInteractableLock);
			AsyncOperationHandle<RuntimeAnimatorController> val = AssetAsyncReferenceManager<RuntimeAnimatorController>.LoadAsset(new AssetReferenceT<RuntimeAnimatorController>(RoR2_Base_MultiShopTerminal.animMultiShopTerminal_controller), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<RuntimeAnimatorController> 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<AnimatorDiff>("Assets/Animations/MultiShop/Reopen.controllerdiff"), bepInPlugin);
				AnimationsAPI.AddModifications(GetBundlePath("ror2-base-multishopterminal_assets_all_e550cfc9295bb6ea35be13bc7fc042d2"), controller.Result, val3);
				AsyncOperationHandle<GameObject> val4 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_MultiShopTerminal.MultiShopTerminal_prefab), (AsyncReferenceHandleUnloadType)2);
				val4.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "Display/mdlMultiShopTerminal");
				};
				val4 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_MultiShopEquipmentTerminal.MultiShopEquipmentTerminal_prefab), (AsyncReferenceHandleUnloadType)2);
				val4.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "Display/mdlMultiShopTerminal");
				};
				val4 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_MultiShopLargeTerminal.MultiShopLargeTerminal_prefab), (AsyncReferenceHandleUnloadType)2);
				val4.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "Display/mdlMultiShopTerminal");
				};
			};
			val = AssetAsyncReferenceManager<RuntimeAnimatorController>.LoadAsset(new AssetReferenceT<RuntimeAnimatorController>(RoR2_DLC1_FreeChestMultiShop.animShippingDronePod_controller), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<RuntimeAnimatorController> 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<GameObject> val3 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_DLC1_FreeChestTerminalShippingDrone.FreeChestTerminalShippingDrone_prefab), (AsyncReferenceHandleUnloadType)2);
				val3.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					AnimatorModifications val4 = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset<AnimatorDiff>("Assets/Animations/ShippingDrone/Reopen.controllerdiff"), bepInPlugin);
					AnimationsAPI.AddModifications(GetBundlePath("ror2-dlc1-freechestmultishop_static_assets_all_1d7b71789b08d225b234934cdc572855"), controller.Result, val4);
					RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "mdlShippingDronePod");
				};
			};
			val = AssetAsyncReferenceManager<RuntimeAnimatorController>.LoadAsset(new AssetReferenceT<RuntimeAnimatorController>(RoR2_Base_EquipmentBarrel.animEquipmentBarrel_controller), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<RuntimeAnimatorController> 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<GameObject> val3 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_EquipmentBarrel.EquipmentBarrel_prefab), (AsyncReferenceHandleUnloadType)2);
				val3.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					EquipBarrelModifications = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset<AnimatorDiff>("Assets/Animations/EquipBarrel/Closing.controllerdiff"), bepInPlugin);
					AnimationsAPI.AddModifications(GetBundlePath("ror2-base-equipmentbarrel_static_assets_all_4b2bbdba8df2b852424cc377002cbfb8"), controller.Result, EquipBarrelModifications);
					RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "ModelBase/mdlEquipmentBarrel");
				};
			};
			val = AssetAsyncReferenceManager<RuntimeAnimatorController>.LoadAsset(new AssetReferenceT<RuntimeAnimatorController>(RoR2_Base_TreasureCache.animLockbox_controller), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<RuntimeAnimatorController> 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<GameObject> val3 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_TreasureCache.Lockbox_prefab), (AsyncReferenceHandleUnloadType)2);
				val3.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					AnimatorModifications val4 = AnimatorModifications.CreateFromDiff(Bundle.LoadAsset<AnimatorDiff>("Assets/Animations/Lockbox/Closing.controllerdiff"), bepInPlugin);
					AnimationsAPI.AddModifications(GetBundlePath("ror2-base-treasurecache_static_assets_all_d08d914a36f0eb6c803eb3c820e8852d"), controller.Result, val4);
					RegisterPurchaseReplacementAnimation(controller.Result, prefab.Result, "ModelBase/mdlKeyLockbox");
					if (QualityCompat.enabled)
					{
						QualityCompat.AddLastbuyTracker(prefab.Result);
					}
				};
			};
			val = AssetAsyncReferenceManager<RuntimeAnimatorController>.LoadAsset(new AssetReferenceT<RuntimeAnimatorController>(RoR2_Base_GoldChest.animGoldChest_controller), (AsyncReferenceHandleUnloadType)2);
			val.Completed += delegate(AsyncOperationHandle<RuntimeAnimatorController> 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<AnimatorDiff>("Assets/Animations/GoldChest/Closing.controllerdiff");
				AnimatorModifications newAnimations = AnimatorModifications.CreateFromDiff(val3, bepInPlugin);
				AsyncOperationHandle<GameObject> val4 = AssetAsyncReferenceManager<GameObject>.LoadAsset(new AssetReferenceT<GameObject>(RoR2_Base_GoldChest.GoldChest_prefab), (AsyncReferenceHandleUnloadType)2);
				val4.Completed += delegate(AsyncOperationHandle<GameObject> prefab)
				{
					AnimationsAPI.AddModifications(GetBundlePath("ror2-base-goldchest_static_assets_all_073b623b25fd304ed31873a2430b080e"), 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 dest = default(Animator);
			foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>())
			{
				foreach (KeyValuePair<string, Animator> registeredAnimator in _RegisteredAnimators)
				{
					Transform val = ((Component)instances).transform.Find(registeredAnimator.Key);
					if (Object.op_Implicit((Object)(object)val) && ((Component)val).TryGetComponent<Animator>(ref dest))
					{
						RetroactiveMacro.ReplaceComponent<Animator>(dest, registeredAnimator.Value);
					}
				}
			}
		}

		public static void RegisterPurchaseReplacementAnimation(RuntimeAnimatorController controller, GameObject origPrefab, string animatorTransformPath)
		{
			Transform val = origPrefab.transform.Find(animatorTransformPath);
			AnimationsAPI.AddAnimatorController(((Component)val).GetComponent<Animator>(), controller);
			if (!_RegisteredAnimators.ContainsKey(animatorTransformPath))
			{
				_RegisteredAnimators.Add(animatorTransformPath, ((Component)val).GetComponent<Animator>());
			}
		}

		public static void ReplaceComponent<T>(T dest, T source) where T : Component
		{
			Object.Destroy((Object)(object)dest);
			((MonoBehaviour)Instance).StartCoroutine(waitForClone<T>(((Component)dest).transform, source));
			static IEnumerator waitForClone<T>(Transform val, T val2) where T : Component
			{
				yield return (object)new WaitForFixedUpdate();
				Extensions.CloneComponent<T>(((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<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PurchaseInteraction), "available"),
				(Instruction x) => ILPatternMatchingExt.MatchBrtrue(x, ref label)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<PingIndicator, bool>>((Func<PingIndicator, bool>)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_00c3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_009f: Unknown result type (might be due to invalid IL or missing references)
				ShopTerminalBehavior val2 = default(ShopTerminalBehavior);
				if (ChangeCard.Value && ((Component)self.pingTargetPurchaseInteraction).TryGetComponent<ShopTerminalBehavior>(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<ShopTerminalBehavior>(ref val3) && !val3.hasBeenPurchased)
							{
								flag = true;
								break;
							}
						}
						Log.Info(flag);
						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 GetBundlePath(string bundleName)
		{
			return Path.Combine(Addressables.RuntimePath, "StandaloneWindows64", bundleName + ".bundle");
		}
	}
	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<SceneExitController> <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<GameObject, IInteractableLockable, GameObject> <8>__replaceLock;

			public static Func<PurchaseInteraction, Interactor, bool> <9>__skipStarUse;

			public static Func<InteractionDriver, bool> <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)
			if (RetroactiveMacro.ExcludeSaleStarChest.Value)
			{
				ChestLootTracker chestLootTracker = UnityObjectExtensions.EnsureComponent<ChestLootTracker>((Component)(object)self);
				UniquePickup currentPickup = self.currentPickup;
				if (((UniquePickup)(ref currentPickup)).isValid)
				{
					ItemIndex itemIndex = PickupCatalog.GetPickupDef(self.currentPickup.pickupIndex).itemIndex;
					if (QualityCompat.enabled)
					{
						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<Instruction, bool>[1]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(OutsideInteractableLocker), "lockPrefab")
			}))
			{
				val.Emit(OpCodes.Ldarg_1);
				val.EmitDelegate<Func<GameObject, IInteractableLockable, GameObject>>((Func<GameObject, IInteractableLockable, GameObject>)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<PurchaseInteraction>(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<PurchaseInteraction>())
			{
				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<LowerPricedChestsBodyBehavoir>(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<ChestBehavior>(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<Instruction, bool>[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<PurchaseInteraction, Interactor, bool>>((Func<PurchaseInteraction, Interactor, bool>)skipStarUse);
			val.Emit(OpCodes.Brfalse, (object)label);
			if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[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<RouletteChestController>(ref val2))
				{
					return true;
				}
				LowerPricedChestsBodyBehavoir lowerPricedChestsBodyBehavoir = default(LowerPricedChestsBodyBehavoir);
				if (self.costType == SaleStarCost.SaleStar && ((Component)activator).TryGetComponent<LowerPricedChestsBodyBehavoir>(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<Instruction, bool>[2]
			{
				(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PurchaseInteraction), "saleStarCompatible"),
				(Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref label)
			}))
			{
				val.Emit(OpCodes.Ldarg_0);
				val.EmitDelegate<Func<InteractionDriver, bool>>((Func<InteractionDriver, bool>)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<PurchaseInteraction>(ref val2))
				{
					return false;
				}
				RouletteChestController val3 = default(RouletteChestController);
				if (self.currentInteractable.TryGetComponent<RouletteChestController>(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_00be: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: 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<ChestBehavior>(ref val) || !((EntityState)self).TryGetComponent<PurchaseInteraction>(ref val2) || !val2.saleStarCompatible)
			{
				return;
			}
			if (val2.costType != SaleStarCost.SaleStar)
			{
				ChestLootTracker chestLootTracker = default(ChestLootTracker);
				if (!((EntityState)self).TryGetComponent<ChestLootTracker>(ref chestLootTracker) || chestLootTracker.ItemIndex != Items.LowerPricedChests.itemIndex)
				{
					CharacterBody val3 = default(CharacterBody);
					if (Object.op_Implicit((Object)(object)val2.lastActivator) && ((Component)val2.lastActivator).TryGetComponent<CharacterBody>(ref val3) && Util.GetItemCountForTeam(val3.teamComponent.teamIndex, 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<ChestBehavior>(ref val) || !((Component)((EntityState)this).outer).TryGetComponent<PurchaseInteraction>(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 Awake()
		{
			//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<PurchaseInteraction>())
			{
				if (((Component)instances).TryGetComponent<EntityStateMachine>(ref val) && val.state is Opened && (!((Component)instances).TryGetComponent<SaleStar.ChestLootTracker>(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<PurchaseInteraction>())
			{
				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<CharacterBody>(ref val) || !Object.op_Implicit((Object)(object)val.inventory) || !RetroactiveMacro.SaleStarNerf.Value)
			{
				lastRoll = true;
				return true;
			}
			int itemCountEffective = val.inventory.GetItemCountEffective(Items.LowerPricedChests.itemIndex);
			lastRoll = _rng.RangeFloat(0f, 6f - _weightReduction + (float)itemCountEffective * 1.5f) <= 1.5f + 1.5f * (float)itemCountEffective;
			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<CostTypeDef> 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<CharacterBody>() : 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)
		{
		}
	}
}