Decompiled source of EnhancedQOL v1.4.1

BepInEx/plugins/EnhancedQOL.dll

Decompiled 15 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnhancedQOL.Binder;
using EnhancedQOL.Extensions;
using EnhancedQOL.Helpers;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("EnhancedQOL")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: AssemblyInformationalVersion("1.4.1+dd4412d7b2a9f1908bfd6e9b5c0a9adfb76b24e8")]
[assembly: AssemblyProduct("EnhancedQOL")]
[assembly: AssemblyTitle("EnhancedQOL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal sealed class ConfigurationManagerAttributes
{
	public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);

	public bool? ShowRangeAsPercent;

	public Action<ConfigEntryBase> CustomDrawer;

	public CustomHotkeyDrawerFunc CustomHotkeyDrawer;

	public bool? Browsable;

	public string Category;

	public object DefaultValue;

	public bool? HideDefaultButton;

	public bool? HideSettingName;

	public string Description;

	public string DispName;

	public int? Order;

	public bool? ReadOnly;

	public bool? IsAdvanced;

	public Func<object, string> ObjToStr;

	public Func<string, object> StrToObj;
}
namespace EnhancedQOL
{
	[HarmonyPatch(typeof(InteractableCard3d))]
	internal class InteractableCard3dPatches
	{
		[HarmonyPatch("OnFinishLerp")]
		[HarmonyPostfix]
		public static void OnFinishLerpPostfix(ref InteractableCard3d __instance)
		{
			Plugin.PutItBack.OnCardFinishLerp(ref __instance);
		}
	}
	[BepInPlugin("EnhancedQOL", "EnhancedQOL", "1.4.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony m_Harmony = new Harmony("EnhancedQOL");

		private bool m_HasFinishedLoading;

		private bool m_ApplicationQuiting;

		private GameObject m_ChildGameObject;

		internal static EnhancedBinderSort EnhancedBinderSort { get; private set; }

		internal static PutItBack PutItBack { get; private set; }

		internal static ScrollWheeler ScrollWheeler { get; private set; }

		internal static SceneRaycaster Raycaster { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			m_Harmony.PatchAll();
			Logger.LogInfo((object)"Plugin EnhancedQOL v1.4.1 by GhostNarwhal is loaded!");
		}

		private void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			Settings.Instance.Load(this);
			if (m_ChildGameObject == null)
			{
				m_ChildGameObject = new GameObject("EnhancedQOL+Internal Mods");
			}
			m_ChildGameObject.transform.parent = ((Component)this).gameObject.transform;
			m_HasFinishedLoading = false;
			m_ApplicationQuiting = false;
			EnhancedBinderSort = m_ChildGameObject.AddComponent<EnhancedBinderSort>();
			PutItBack = m_ChildGameObject.AddComponent<PutItBack>();
			ScrollWheeler = m_ChildGameObject.AddComponent<ScrollWheeler>();
			Raycaster = m_ChildGameObject.AddComponent<SceneRaycaster>();
			((Behaviour)this).enabled = Settings.Instance.isEnhancedQOLEnabled.Value;
			Settings.Instance.isEnhancedQOLEnabled.SettingChanged += delegate
			{
				if (!Settings.Instance.isEnhancedQOLEnabled.Value)
				{
					Settings.Instance.isPutItBackEnabled.Value = false;
					Settings.Instance.isEnhancedBinderSortEnabled.Value = false;
					Settings.Instance.isScrollWheelerEnabled.Value = false;
				}
				((Behaviour)this).enabled = Settings.Instance.isEnhancedQOLEnabled.Value;
			};
			SceneManager.sceneLoaded += SceneLoaded;
		}

		private void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			if (((Scene)(ref scene)).name == "Start")
			{
				m_HasFinishedLoading = true;
				if (((Behaviour)this).enabled)
				{
					OnEnable();
				}
			}
			else
			{
				((Behaviour)Raycaster).enabled = false;
			}
		}

		private void OnEnable()
		{
			if (m_HasFinishedLoading)
			{
				((Behaviour)Raycaster).enabled = true;
				((Behaviour)EnhancedBinderSort).enabled = Settings.Instance.isEnhancedBinderSortEnabled.Value;
				((Behaviour)PutItBack).enabled = Settings.Instance.isPutItBackEnabled.Value;
				((Behaviour)ScrollWheeler).enabled = Settings.Instance.isScrollWheelerEnabled.Value;
			}
		}

		private void OnDisable()
		{
			if (Raycaster != null)
			{
				((Behaviour)Raycaster).enabled = false;
			}
			if (!m_ApplicationQuiting)
			{
				Settings.Instance.isEnhancedQOLEnabled.Value = false;
				Settings.Instance.isPutItBackEnabled.Value = false;
				Settings.Instance.isScrollWheelerEnabled.Value = false;
			}
		}

		private void OnDestroy()
		{
			if (m_ChildGameObject != null)
			{
				Object.Destroy((Object)(object)m_ChildGameObject);
			}
			m_Harmony.UnpatchSelf();
			Logger.LogInfo((object)"Plugin EnhancedQOL is unloaded!");
		}

		private void OnApplicationQuit()
		{
			m_ApplicationQuiting = true;
		}
	}
	public class PutItBack : MonoBehaviour
	{
		private bool m_IsReturningCard;

		private int m_CurrentBinderPageIndex;

		private List<BinderPageGrp> m_BinderPageGrpList = new List<BinderPageGrp>();

		private List<HeldCardData> m_HeldCardDataList = new List<HeldCardData>();

		private List<Type> m_ItemCompartmentTypeList = new List<Type>();

		private ECollectionSortingType m_SortingType;

		private bool m_IsInitialized;

		private void Awake()
		{
			Settings.Instance.isPutItBackEnabled.SettingChanged += delegate
			{
				((Behaviour)this).enabled = Settings.Instance.isPutItBackEnabled.Value;
				if (!Settings.Instance.isEnhancedQOLEnabled.Value && ((Behaviour)this).enabled)
				{
					Settings.Instance.isEnhancedQOLEnabled.Value = true;
				}
			};
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_IsInitialized = false;
			}
		}

		public void OnUpdate(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)this).enabled && collectionBinderFlipAnimCtrl.IsBookOpen())
			{
				m_CurrentBinderPageIndex = collectionBinderFlipAnimCtrl.GetCurrentBinderPageIndex();
				m_BinderPageGrpList = collectionBinderFlipAnimCtrl.m_BinderPageGrpList;
				m_SortingType = collectionBinderFlipAnimCtrl.GetSortingType();
				if (UnityInput.Current.mouseScrollDelta.y > 0f && CSingleton<InteractionPlayerController>.Instance.GetHeldCards().Count > 0)
				{
					collectionBinderFlipAnimCtrl.OnMouseButtonUp();
				}
				if (UnityInput.Current.mouseScrollDelta.y < 0f)
				{
					collectionBinderFlipAnimCtrl.OnRightMouseButtonUp();
				}
			}
		}

		public bool OnRightMouseButtonUp(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			if (((Behaviour)this).enabled && !m_IsReturningCard)
			{
				InteractableCard3d currentRaycastedInteractableCard3d = collectionBinderFlipAnimCtrl.m_CurrentRaycastedInteractableCard3d;
				bool? flag = ((currentRaycastedInteractableCard3d != null) ? new bool?(currentRaycastedInteractableCard3d.m_Card3dUI.m_CardUI.GetCardData().IsOwned()) : null);
				if (!flag.HasValue || !flag.Value)
				{
					return false;
				}
				if (InteractionPlayerController.HasEnoughSlotToHoldCard())
				{
					List<HeldCardData> heldCardDataList = m_HeldCardDataList;
					HeldCardData obj = new HeldCardData
					{
						BinderCardSlotIndex = collectionBinderFlipAnimCtrl.GetRaycastedCardIndex(),
						BinderPageIndex = collectionBinderFlipAnimCtrl.GetCurrentBinderPageIndex()
					};
					InteractableCard3d currentRaycastedInteractableCard3d2 = collectionBinderFlipAnimCtrl.m_CurrentRaycastedInteractableCard3d;
					obj.CardData = ((currentRaycastedInteractableCard3d2 != null) ? currentRaycastedInteractableCard3d2.m_Card3dUI.m_CardUI.GetCardData() : null);
					InteractableCard3d currentRaycastedInteractableCard3d3 = collectionBinderFlipAnimCtrl.m_CurrentRaycastedInteractableCard3d;
					obj.Transform = ((currentRaycastedInteractableCard3d3 != null) ? ((Component)currentRaycastedInteractableCard3d3).transform : null);
					heldCardDataList.Add(obj);
				}
			}
			return true;
		}

		public bool OnLeftMouseButtonUp(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			if (((Behaviour)this).enabled && !m_IsReturningCard)
			{
				List<InteractableCard3d> heldCards = CSingleton<InteractionPlayerController>.Instance.GetHeldCards();
				if (heldCards.Count > 0)
				{
					int num = m_HeldCardDataList.Last().BinderCardSlotIndex;
					int num2 = m_HeldCardDataList.Last().BinderPageIndex - collectionBinderFlipAnimCtrl.GetCurrentBinderPageIndex();
					int index = 0;
					if (num2 <= -1)
					{
						if (num >= 6)
						{
							num -= 6;
						}
						index = 2;
					}
					else if (num2 >= 1)
					{
						if (num <= 5)
						{
							num += 6;
						}
						index = 1;
					}
					Transform transform = ((Component)collectionBinderFlipAnimCtrl.m_BinderPageGrpList[index].m_CardList[num]).transform;
					((InteractableObject)heldCards.Last()).StopLerpToTransform();
					((InteractableObject)heldCards.Last()).LerpToTransform(transform, transform.parent);
					m_IsReturningCard = true;
					return false;
				}
			}
			return true;
		}

		public void OnCardFinishLerp(ref InteractableCard3d interactableCard3D)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).enabled || !m_IsReturningCard)
			{
				return;
			}
			List<InteractableCard3d> heldCards = CSingleton<InteractionPlayerController>.Instance.GetHeldCards();
			if (heldCards.Count > 0)
			{
				CPlayerData.AddCard(m_HeldCardDataList.Last().CardData, 1);
				int num = m_HeldCardDataList.Last().BinderPageIndex - m_CurrentBinderPageIndex;
				if (num >= -1 && num <= 1)
				{
					int index = ((num == -1) ? 2 : num);
					int cardAmount = CPlayerData.GetCardAmount(m_HeldCardDataList.Last().CardData);
					m_BinderPageGrpList[index].SetSingleCard(m_HeldCardDataList.Last().BinderCardSlotIndex, m_HeldCardDataList.Last().CardData, cardAmount, m_SortingType);
					((Component)m_BinderPageGrpList[index].m_CardList[m_HeldCardDataList.Last().BinderCardSlotIndex]).gameObject.SetActive(true);
					((Component)m_HeldCardDataList.Last().Transform).gameObject.SetActive(true);
				}
				((InteractableObject)heldCards.Last()).OnDestroyed();
				heldCards.RemoveAt(heldCards.Count - 1);
				m_HeldCardDataList.RemoveAt(m_HeldCardDataList.Count - 1);
				CPlayerData.m_HoldCardDataList.RemoveAt(CPlayerData.m_HoldCardDataList.Count - 1);
				SetHoldCardEularRotation(heldCards.Count);
				m_IsReturningCard = false;
			}
		}

		private void SetHoldCardEularRotation(int heldCardCount)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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)
			Quaternion value = Quaternion.Euler(0f, 0f, 0f);
			if (heldCardCount == 0)
			{
				CSingleton<InteractionPlayerController>.Instance.SetHoldCardGroupTargetRotation(value);
				CSingleton<InteractionPlayerController>.Instance.EnterViewCardAlbumMode();
			}
			else
			{
				value = Quaternion.Euler(0f, 0f, Mathf.Lerp(0f, 15f, (float)heldCardCount / 7f));
				CSingleton<InteractionPlayerController>.Instance.SetHoldCardGroupTargetRotation(value);
			}
		}
	}
	public class ScrollWheeler : MonoBehaviour
	{
		private bool m_IsInitialized;

		private void Awake()
		{
			Settings.Instance.isScrollWheelerEnabled.SettingChanged += delegate
			{
				((Behaviour)this).enabled = Settings.Instance.isScrollWheelerEnabled.Value;
				if (!Settings.Instance.isEnhancedQOLEnabled.Value && ((Behaviour)this).enabled)
				{
					Settings.Instance.isEnhancedQOLEnabled.Value = true;
				}
			};
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_IsInitialized = false;
			}
		}

		private void Update()
		{
			//IL_0005: 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)
			if (UnityInput.Current.mouseScrollDelta.y > 0f)
			{
				OnScrollWheel(placingItem: true);
			}
			if (UnityInput.Current.mouseScrollDelta.y < 0f)
			{
				OnScrollWheel(placingItem: false);
			}
		}

		private void OnScrollWheel(bool placingItem)
		{
			InteractablePackagingBox_Item packagingBox = CSingleton<InteractionPlayerController>.Instance.GetCurrentHeldBox();
			int heldCardCount = CSingleton<InteractionPlayerController>.Instance.GetHeldCards().Count;
			int heldItemCount = CSingleton<InteractionPlayerController>.Instance.GetHeldItemList().Count;
			Component raycastedComponent = Plugin.Raycaster.RaycastedComponent;
			if (raycastedComponent == null)
			{
				goto IL_0214;
			}
			ShelfCompartment val = default(ShelfCompartment);
			ref ShelfCompartment reference = ref val;
			Component obj = raycastedComponent;
			reference = (ShelfCompartment)(object)((obj is ShelfCompartment) ? obj : null);
			Action action;
			if (val != null && packagingBox != null)
			{
				action = delegate
				{
					if (placingItem)
					{
						packagingBox.DispenseItem(true, val);
					}
					else
					{
						packagingBox.RemoveItemFromShelf(true, val);
					}
				};
			}
			else
			{
				ShelfCompartment val2 = default(ShelfCompartment);
				ref ShelfCompartment reference2 = ref val2;
				Component obj2 = raycastedComponent;
				reference2 = (ShelfCompartment)(object)((obj2 is ShelfCompartment) ? obj2 : null);
				if (val2 != null && val2.m_CanPutBox && !placingItem)
				{
					action = delegate
					{
						((InteractableObject)((Component)val2).gameObject.GetComponent<InteractableStorageCompartment>()).OnMouseButtonUp();
					};
				}
				else
				{
					InteractablePackagingBox_Item val3 = default(InteractablePackagingBox_Item);
					ref InteractablePackagingBox_Item reference3 = ref val3;
					Component obj3 = raycastedComponent;
					reference3 = (InteractablePackagingBox_Item)(object)((obj3 is InteractablePackagingBox_Item) ? obj3 : null);
					if (val3 != null && packagingBox != null)
					{
						action = delegate
						{
							//IL_0096: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
							//IL_010d: Unknown result type (might be due to invalid IL or missing references)
							if (!((InteractablePackagingBox)val3).IsBoxOpened())
							{
								((InteractablePackagingBox)val3).OnPressOpenBox();
							}
							else if (!((InteractablePackagingBox)packagingBox).IsBoxOpened())
							{
								((InteractablePackagingBox)packagingBox).OnPressOpenBox();
							}
							else
							{
								InteractablePackagingBox_Item val7 = (placingItem ? val3 : packagingBox);
								InteractablePackagingBox_Item val8 = (placingItem ? packagingBox : val3);
								Item lastItem = val8.m_ItemCompartment.GetLastItem();
								if (lastItem != null && (val7.m_ItemCompartment.GetItemType() == val8.m_ItemCompartment.GetItemType() || val7.m_ItemCompartment.GetItemCount() == 0))
								{
									lastItem.LerpToTransform(val7.m_ItemCompartment.GetLastEmptySlotTransform(), val7.m_ItemCompartment.GetLastEmptySlotTransform().parent, false);
									val7.m_ItemCompartment.SetCompartmentItemType(val8.m_ItemCompartment.GetItemType());
									val7.m_ItemCompartment.AddItem(lastItem, false);
									val8.m_ItemCompartment.RemoveItem(lastItem);
									val7.m_ItemCompartment.SetPriceTagItemImage(val8.GetItemType());
									val7.m_ItemCompartment.SetPriceTagVisibility(false);
									val7.m_ItemCompartment.RefreshPriceTagItemPriceText();
								}
							}
						};
					}
					else if (raycastedComponent is InteractableTrashBin && packagingBox != null && placingItem)
					{
						action = delegate
						{
							//IL_002d: Unknown result type (might be due to invalid IL or missing references)
							if (packagingBox.m_ItemCompartment.GetItemCount() > 0)
							{
								((UIScreenBase)CSingleton<InteractionPlayerController>.Instance.m_ConfirmTrashScreen).OpenScreen();
							}
							else
							{
								((InteractableTrashBin)Plugin.Raycaster.RaycastedComponent).DiscardBox((InteractablePackagingBox)(object)packagingBox, true);
							}
						};
					}
					else
					{
						InteractableWorkbench val4 = default(InteractableWorkbench);
						ref InteractableWorkbench reference4 = ref val4;
						Component obj4 = raycastedComponent;
						reference4 = (InteractableWorkbench)(object)((obj4 is InteractableWorkbench) ? obj4 : null);
						if (val4 != null && packagingBox != null)
						{
							action = delegate
							{
								if (placingItem)
								{
									val4.DispenseItemFromBox(packagingBox, true);
								}
								else
								{
									val4.RemoveItemFromShelf(true, packagingBox);
								}
							};
						}
						else
						{
							InteractableCardCompartment val5 = default(InteractableCardCompartment);
							ref InteractableCardCompartment reference5 = ref val5;
							Component obj5 = raycastedComponent;
							reference5 = (InteractableCardCompartment)(object)((obj5 is InteractableCardCompartment) ? obj5 : null);
							if (val5 != null)
							{
								action = delegate
								{
									if (placingItem && heldCardCount > 0)
									{
										val5.OnMouseButtonUp();
									}
									else if (!placingItem)
									{
										val5.OnRightMouseButtonUp();
									}
								};
							}
							else
							{
								CardShelf val6 = default(CardShelf);
								ref CardShelf reference6 = ref val6;
								Component obj6 = raycastedComponent;
								reference6 = (CardShelf)(object)((obj6 is CardShelf) ? obj6 : null);
								if (val6 == null)
								{
									goto IL_0214;
								}
								action = delegate
								{
									foreach (InteractableCardCompartment cardCompartment in val6.GetCardCompartmentList())
									{
										if (placingItem && heldCardCount > 0 && cardCompartment.m_StoredCardList.Count == 0)
										{
											cardCompartment.OnMouseButtonUp();
											break;
										}
										if (!placingItem && cardCompartment.m_StoredCardList.Count > 0)
										{
											cardCompartment.OnRightMouseButtonUp();
											break;
										}
									}
								};
							}
						}
					}
				}
			}
			goto IL_0226;
			IL_0226:
			action();
			return;
			IL_0214:
			action = delegate
			{
				if (raycastedComponent != null && placingItem && heldItemCount > 0)
				{
					CSingleton<InteractionPlayerController>.Instance.PutItemOnShelf();
				}
				else if (raycastedComponent != null && !placingItem && packagingBox == null)
				{
					CSingleton<InteractionPlayerController>.Instance.TakeItemFromShelf();
				}
			};
			goto IL_0226;
		}
	}
	public class Settings
	{
		public ConfigEntry<bool> isEnhancedQOLEnabled;

		public ConfigEntry<bool> isScrollWheelerEnabled;

		public ConfigEntry<bool> isPutItBackEnabled;

		public ConfigEntry<bool> isEnhancedBinderSortEnabled;

		public ConfigEntry<int> minDupeCount;

		public ConfigEntry<ECardCountDisplayType> cardCountDisplayType;

		public ConfigEntry<Vector3> commonCardCountPosition;

		public ConfigEntry<int> commonCardCountFontSize;

		public ConfigEntry<Vector3> rareCardCountPosition;

		public ConfigEntry<int> rareCardCountFontSize;

		public ConfigEntry<Vector3> epicCardCountPosition;

		public ConfigEntry<int> epicCardCountFontSize;

		public ConfigEntry<Vector3> legendaryCardCountPosition;

		public ConfigEntry<int> legendaryCardCountFontSize;

		public ConfigEntry<KeyboardShortcut> raritySortFilterToggle;

		public ConfigEntry<KeyboardShortcut> borderSortFilterToggle;

		public ConfigEntry<KeyboardShortcut> elementSortFilterToggle;

		public ConfigEntry<KeyboardShortcut> elementSortFilterClear;

		public ConfigEntry<KeyboardShortcut> borderSortFilterClear;

		public ConfigEntry<KeyboardShortcut> allFilterClear;

		public ConfigEntry<KeyboardShortcut> raritySortFilterClear;

		private static Settings m_instance;

		public static Settings Instance
		{
			get
			{
				if (m_instance == null)
				{
					m_instance = new Settings();
				}
				return m_instance;
			}
		}

		public void Load(Plugin plugin)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Expected O, but got Unknown
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Expected O, but got Unknown
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Expected O, but got Unknown
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Expected O, but got Unknown
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Expected O, but got Unknown
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Expected O, but got Unknown
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Expected O, but got Unknown
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Expected O, but got Unknown
			isEnhancedQOLEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL", "Enabled", true, new ConfigDescription("Enables or disables the entire plugin", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 25
				}
			}));
			isScrollWheelerEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL - Scroll Wheeler", "Enabled", true, new ConfigDescription("Enables or disables Scroll Wheeler", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20
				}
			}));
			isPutItBackEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL - Put It Back", "Enable", true, new ConfigDescription("Enables or disables put it back", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20
				}
			}));
			isEnhancedBinderSortEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL - Enhanced Album Sort", "Enable", true, new ConfigDescription("Enables or disables Enhanced Sorting", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20
				}
			}));
			minDupeCount = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Minimum Duplication Count", 1, new ConfigDescription("The minimum number of dupes for cards to show in Duplication sort", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, int.MaxValue), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 19
				}
			}));
			raritySortFilterToggle = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Rarity Sort Filter Toggle", new KeyboardShortcut((KeyCode)122, Array.Empty<KeyCode>()), new ConfigDescription("Key to cycle through rarity filters.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 18
				}
			}));
			raritySortFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear Rarity Sort Filter", new KeyboardShortcut((KeyCode)122, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key to clear current rarity filter", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 17
				}
			}));
			borderSortFilterToggle = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Border Sort Filter Toggle", new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()), new ConfigDescription("Key to cycle through border filters.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 16
				}
			}));
			borderSortFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear Border Sort Filter", new KeyboardShortcut((KeyCode)120, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key to clear current border filters.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 15
				}
			}));
			elementSortFilterToggle = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Element Sort Filter Toggle", new KeyboardShortcut((KeyCode)99, Array.Empty<KeyCode>()), new ConfigDescription("Key to cycle through element filters", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 14
				}
			}));
			elementSortFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear Element Sort Filter", new KeyboardShortcut((KeyCode)99, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key to clear current element filter", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 13
				}
			}));
			allFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear all sort filters", new KeyboardShortcut((KeyCode)118, Array.Empty<KeyCode>()), new ConfigDescription("Key to clear all current filters", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 12
				}
			}));
			cardCountDisplayType = ((BaseUnityPlugin)plugin).Config.Bind<ECardCountDisplayType>("EnhancedQOL - Enhanced Album Sort", "Card Count Display Type", ECardCountDisplayType.None, new ConfigDescription("How you want to view the card counts", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 11
				}
			}));
			commonCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Common Card Count Display Position", new Vector3(0f, 445f, 0f), new ConfigDescription("Position for common card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 10
				}
			}));
			commonCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Common Card Count Display Font Size", 34, new ConfigDescription("Common card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 9
				}
			}));
			rareCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Rare Card Count Display Position", new Vector3(0f, 400f, 0f), new ConfigDescription("Position for rare card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 8
				}
			}));
			rareCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Rare Card Count Display Font Size", 34, new ConfigDescription("Rare card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 7
				}
			}));
			epicCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Epic Card Count Display Position", new Vector3(0f, 350f, 0f), new ConfigDescription("Position for epic card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 6
				}
			}));
			epicCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Epic Card Count Display Font Size", 34, new ConfigDescription("Epic card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 5
				}
			}));
			legendaryCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Legendary Card Count Display Position", new Vector3(0f, 300f, 0f), new ConfigDescription("Position for legendary card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 4
				}
			}));
			legendaryCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Legendary Card Count Display Font Size", 34, new ConfigDescription("Legendary card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 3
				}
			}));
		}

		private Settings()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EnhancedQOL";

		public const string PLUGIN_NAME = "EnhancedQOL";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace EnhancedQOL.Patches
{
	[HarmonyPatch(typeof(CollectionBinderFlipAnimCtrl))]
	public class CollectionBinderFlipAnimCtrlPatches
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void OnUpdatePrefix(CollectionBinderFlipAnimCtrl __instance, bool ___m_IsBookOpen)
		{
			Plugin.EnhancedBinderSort.OnCollectionBinderFlipAnimCtrlUpdate(__instance, ___m_IsBookOpen);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void OnUpdatePostfix(CollectionBinderFlipAnimCtrl __instance)
		{
			Plugin.PutItBack.OnUpdate(__instance);
		}

		[HarmonyPatch("OnMouseButtonUp")]
		[HarmonyPrefix]
		public static bool OnMouseButtonUpPrefix(CollectionBinderFlipAnimCtrl __instance)
		{
			return Plugin.PutItBack.OnLeftMouseButtonUp(__instance);
		}

		[HarmonyPatch("OnRightMouseButtonUp")]
		[HarmonyPrefix]
		public static bool OnRightMouseButtonUpPrefix(CollectionBinderFlipAnimCtrl __instance)
		{
			return Plugin.PutItBack.OnRightMouseButtonUp(__instance);
		}

		[HarmonyPatch("StartShowCardAlbum")]
		[HarmonyPostfix]
		public static void StartShowCardAlbumPostfix(CollectionBinderFlipAnimCtrl __instance)
		{
			//IL_0006: 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)
			Plugin.EnhancedBinderSort.OnBinderOpen(__instance.GetSortingType(), __instance.GetExpansionType());
			Plugin.Raycaster.OnBinderOpen();
		}

		[HarmonyPatch("HideCardAlbum")]
		[HarmonyPostfix]
		public static void HideCardAlbumPostfix()
		{
			Plugin.Raycaster.OnBinderClose();
		}
	}
	[HarmonyPatch(typeof(CollectionBinderUI))]
	public class CollectionBinderUIPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void OnUpdate(CollectionBinderUI __instance)
		{
			Plugin.EnhancedBinderSort.OnCollectionBinderUIAwake(__instance);
		}
	}
	[HarmonyPatch]
	public class MissingCardsCompatibilityPatch
	{
		private static PluginInfo m_PluginInfo;

		private static bool Prepare()
		{
			return Chainloader.PluginInfos.TryGetValue("MissingCards", out m_PluginInfo);
		}

		private static MethodBase TargetMethod()
		{
			return (from m in AccessTools.GetDeclaredMethods((from m in ((object)m_PluginInfo.Instance).GetType().GetNestedTypes(BindingFlags.NonPublic)
					where m.Name == "PatchSortBinder"
					select m).FirstOrDefault())
				where m.Name == "Prefix"
				select m).Cast<MethodBase>().FirstOrDefault();
		}

		[HarmonyPrefix]
		private static bool Prefix(out CollectionBinderUI __state)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			__state = Object.FindFirstObjectByType<CollectionBinderUI>();
			if ((int)__state.m_CollectionAlbum.GetSortingType() == 7)
			{
				return (int)__state.m_CollectionAlbum.GetExpansionType() == 2;
			}
			return true;
		}

		[HarmonyPostfix]
		private static void Postfix(CollectionBinderUI __state, bool __runOriginal)
		{
			if (!__runOriginal && __state.m_CollectionAlbum.GetCanUpdateSort())
			{
				__state.m_CollectionAlbum.SetCanUpdateSort(false);
				Plugin.EnhancedBinderSort.OnSort(__state.m_CollectionAlbum);
			}
		}
	}
	[HarmonyPatch]
	public class SortingPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			return (from method in AccessTools.GetDeclaredMethods(typeof(CollectionBinderFlipAnimCtrl))
				where method.ReturnType == typeof(void) && method.Name.StartsWith("SortBy")
				select method).Cast<MethodBase>();
		}

		private static bool Prefix(CollectionBinderFlipAnimCtrl __instance)
		{
			return Plugin.EnhancedBinderSort.OnSort(__instance);
		}
	}
}
namespace EnhancedQOL.Helpers
{
	public class CollectedCardsUtility
	{
		public class Builder
		{
			private CollectedCardsUtility m_CardSorter = new CollectedCardsUtility();

			public Builder WithSortType(ECollectionSortingType sortType)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				m_CardSorter.m_SortingType = sortType;
				return this;
			}

			public Builder WithExpansionType(ECardExpansionType expansionType)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				m_CardSorter.m_ExpansionType = expansionType;
				return this;
			}

			public Builder WithRarityType(ECardRaritySortType rarityType)
			{
				m_CardSorter.m_RarityType = rarityType;
				return this;
			}

			public Builder WithBorderType(ECardBorderSortType borderType)
			{
				m_CardSorter.m_BorderType = borderType;
				return this;
			}

			public Builder WithElementType(ECardElementSortType elementType)
			{
				m_CardSorter.m_ElementType = elementType;
				return this;
			}

			public Builder WithMinDupeCount(int minDupeCount)
			{
				m_CardSorter.m_MinDupeCount = minDupeCount;
				return this;
			}

			public CollectedCardsUtility Build()
			{
				return m_CardSorter;
			}
		}

		private int m_MinDupeCount;

		private ECollectionSortingType m_SortingType;

		private ECardExpansionType m_ExpansionType;

		private ECardRaritySortType m_RarityType;

		private ECardBorderSortType m_BorderType;

		private ECardElementSortType m_ElementType;

		public bool Sort(List<int> finalSortedCards)
		{
			//IL_0036: 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_020b: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Invalid comparison between Unknown and I4
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_016f: Invalid comparison between Unknown and I4
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Invalid comparison between Unknown and I4
			finalSortedCards.Clear();
			List<int> tempSortedCards = new List<int>(finalSortedCards.Capacity);
			int currentCardIndex = 0;
			foreach (EMonsterType shownMonster in InventoryBase.GetShownMonsterList(m_ExpansionType))
			{
				MonsterData monsterData = InventoryBase.GetMonsterData(shownMonster);
				for (int i = 0; i < CPlayerData.GetCardAmountPerMonsterType(m_ExpansionType, true); i++)
				{
					CardData cardData = CPlayerData.GetCardData(currentCardIndex, m_ExpansionType, (int)m_ExpansionType == 1);
					int cardCount = CPlayerData.GetCardAmount(cardData);
					int cardPrice = 0;
					if ((int)m_SortingType == 5)
					{
						if (cardCount == m_MinDupeCount)
						{
							cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 1f);
						}
						else if (cardCount > m_MinDupeCount)
						{
							cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100000f);
						}
					}
					else if ((int)m_SortingType == 6)
					{
						cardPrice = cardCount * Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100f);
					}
					else if (cardCount > 0)
					{
						cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100f);
					}
					if (CardMatchesFilters(monsterData, cardData))
					{
						ECollectionSortingType sortingType = m_SortingType;
						Action action = (((int)sortingType == 0) ? ((Action)delegate
						{
							finalSortedCards.Add(currentCardIndex);
						}) : (((int)sortingType == 1) ? ((Action)delegate
						{
							finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardCount), currentCardIndex);
						}) : (((int)sortingType != 7) ? ((Action)delegate
						{
							finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardPrice), currentCardIndex);
						}) : ((Action)delegate
						{
							finalSortedCards.Insert(tempSortedCards.AddAcending(cardCount), currentCardIndex);
						}))));
						action();
					}
					int num = currentCardIndex;
					currentCardIndex = num + 1;
				}
			}
			return false;
		}

		public Tuple<int, int> GetCardCount()
		{
			//IL_0007: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			foreach (EMonsterType shownMonster in InventoryBase.GetShownMonsterList(m_ExpansionType))
			{
				MonsterData monsterData = InventoryBase.GetMonsterData(shownMonster);
				for (int i = 0; i < CPlayerData.GetCardAmountPerMonsterType(m_ExpansionType, true); i++)
				{
					CardData cardData = CPlayerData.GetCardData(num3, m_ExpansionType, (int)m_ExpansionType == 1);
					bool flag = CPlayerData.GetCardAmount(cardData) > 0;
					if (CardMatchesFilters(monsterData, cardData))
					{
						num++;
						if (flag)
						{
							num2++;
						}
					}
					num3++;
				}
			}
			return Tuple.Create(num2, num);
		}

		private bool CardMatchesFilters(MonsterData monsterData, CardData cardData)
		{
			//IL_0012: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			int num = ((m_ElementType != ECardElementSortType.None) ? ((int)m_ElementType) : ((int)monsterData.ElementIndex));
			int num2 = ((m_RarityType != ECardRaritySortType.None) ? ((int)m_RarityType) : ((int)monsterData.Rarity));
			int num3 = ((m_BorderType != ECardBorderSortType.None) ? ((int)m_BorderType) : ((int)cardData.GetCardBorderType()));
			if ((int)monsterData.ElementIndex == num && (int)monsterData.Rarity == num2)
			{
				return (int)cardData.GetCardBorderType() == num3;
			}
			return false;
		}

		private CollectedCardsUtility()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			m_SortingType = (ECollectionSortingType)0;
			m_ExpansionType = (ECardExpansionType)0;
			m_BorderType = ECardBorderSortType.None;
			m_ElementType = ECardElementSortType.None;
			m_RarityType = ECardRaritySortType.None;
			m_MinDupeCount = 1;
		}
	}
	public class HeldCardData
	{
		public int BinderPageIndex { get; set; }

		public int BinderCardSlotIndex { get; set; }

		public CardData CardData { get; set; }

		public Transform Transform { get; set; }
	}
	public class ReverseComparer<T> : Comparer<T>
	{
		public override int Compare(T x, T y)
		{
			return Comparer<T>.Default.Compare(y, x);
		}
	}
	public class SceneRaycaster : MonoBehaviour
	{
		private List<Type> m_ItemCompartmentTypeList = new List<Type>();

		private bool m_IsInitialized;

		public Component RaycastedComponent { get; private set; }

		private void Awake()
		{
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			m_ItemCompartmentTypeList.Add(typeof(InteractableCard3d));
			m_ItemCompartmentTypeList.Add(typeof(CardShelf));
			m_ItemCompartmentTypeList.Add(typeof(InteractableCardCompartment));
			m_ItemCompartmentTypeList.Add(typeof(InteractablePackagingBox_Item));
			m_ItemCompartmentTypeList.Add(typeof(ShelfCompartment));
			m_ItemCompartmentTypeList.Add(typeof(InteractableTrashBin));
			m_ItemCompartmentTypeList.Add(typeof(InteractableWorkbench));
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_ItemCompartmentTypeList.Clear();
				RaycastedComponent = null;
			}
		}

		private void FixedUpdate()
		{
			//IL_001a: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			Camera val = CSingleton<InteractionPlayerController>.Instance?.m_Cam;
			Ray val2 = default(Ray);
			((Ray)(ref val2))..ctor(((Component)val).transform.position, ((Component)val).transform.forward);
			int mask = LayerMask.GetMask(new string[4] { "UI", "Physics", "ItemCompartment", "ShopModel" });
			RaycastHit val3 = default(RaycastHit);
			RaycastedComponent = (Physics.Raycast(val2, ref val3, CSingleton<InteractionPlayerController>.Instance.m_RayDistance, mask) ? (from component in ((Component)((RaycastHit)(ref val3)).transform).gameObject.GetComponents<Component>()
				where m_ItemCompartmentTypeList.Contains(((object)component).GetType())
				select component).FirstOrDefault() : null);
		}

		public void OnBinderOpen()
		{
			RaycastedComponent = null;
			((Behaviour)this).enabled = false;
		}

		public void OnBinderClose()
		{
			((Behaviour)this).enabled = true;
		}
	}
}
namespace EnhancedQOL.Extensions
{
	public static class CardDataExt
	{
		public static bool IsOwned(this CardData cardData)
		{
			return CPlayerData.GetCardAmount(cardData) > 0;
		}

		public static CardData CopyFrom(this CardData target, CardData source)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//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)
			target.monsterType = source.monsterType;
			target.isFoil = source.isFoil;
			target.borderType = source.borderType;
			target.isDestiny = source.isDestiny;
			target.expansionType = source.expansionType;
			return target;
		}
	}
	public static class CollectionBinderFlipAnimCtrlExt
	{
		public static ECollectionSortingType GetSortingType(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return (ECollectionSortingType)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortingType").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static int GetCurrentBinderPageIndex(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (int)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_Index").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static ECardExpansionType GetExpansionType(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return (ECardExpansionType)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_ExpansionType").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static bool GetCanUpdateSort(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (bool)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_CanUpdateSort").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static List<int> GetSortedCardList(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (List<int>)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortedIndexList").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static List<int> GetTempSortedList(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (List<int>)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortTempList").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static bool IsBookOpen(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (bool)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_IsBookOpen").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static int GetRaycastedCardIndex(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (int)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_CurrentRaycastedCardIndex").GetValue(collectionBinderFlipAnimCtrl);
		}
	}
	public static class EnumExt
	{
		public static T Next<T>(this T src) where T : struct
		{
			if (!typeof(T).IsEnum)
			{
				throw new ArgumentException("Argument " + typeof(T).FullName + " is not an Enum");
			}
			T[] array = (T[])Enum.GetValues(src.GetType());
			int num = Array.IndexOf(array, src) + 1;
			if (array.Length != num)
			{
				return array[num];
			}
			return array[0];
		}
	}
	public static class InteractionPlayerControllerExt
	{
		public static List<InteractableCard3d> GetHeldCards(this InteractionPlayerController playerController)
		{
			return (List<InteractableCard3d>)AccessTools.Field(typeof(InteractionPlayerController), "m_CurrentHoldingCard3dList").GetValue(playerController);
		}

		public static void SetHoldCardGroupTargetRotation(this InteractionPlayerController playerController, Quaternion value)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			AccessTools.Field(typeof(InteractionPlayerController), "m_HoldCardGrpTargetRotation").SetValue(playerController, value);
		}

		public static ShelfCompartment GetRaycastedItemCompartment(this InteractionPlayerController playerController)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return (ShelfCompartment)AccessTools.Field(typeof(InteractionPlayerController), "m_CurrentItemCompartment").GetValue(playerController);
		}

		public static InteractablePackagingBox_Item GetCurrentHeldBox(this InteractionPlayerController playerController)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return (InteractablePackagingBox_Item)AccessTools.Field(typeof(InteractionPlayerController), "m_CurrentHoldingItemBox").GetValue(playerController);
		}

		public static List<Item> GetHeldItemList(this InteractionPlayerController playerController)
		{
			return (List<Item>)AccessTools.Field(typeof(InteractionPlayerController), "m_HoldItemList").GetValue(playerController);
		}

		public static void PutItemOnShelf(this InteractionPlayerController playerController)
		{
			AccessTools.Method(typeof(InteractionPlayerController), "EvaluatePutItemOnShelf", (Type[])null, (Type[])null).Invoke(playerController, null);
		}

		public static void TakeItemFromShelf(this InteractionPlayerController playerController)
		{
			AccessTools.Method(typeof(InteractionPlayerController), "EvaluateTakeItemFromShelf", (Type[])null, (Type[])null).Invoke(playerController, null);
		}
	}
	public static class ListExt
	{
		public static int AddSortedDecending<T>(this List<T> list, T item) where T : IComparable<T>
		{
			ReverseComparer<T> reverseComparer = new ReverseComparer<T>();
			if (list.Count == 0 || reverseComparer.Compare(list[list.Count - 1], item) <= 0)
			{
				list.Add(item);
				return list.Count - 1;
			}
			if (reverseComparer.Compare(list[0], item) >= 0)
			{
				list.Insert(0, item);
				return 0;
			}
			int num = list.BinarySearch(item, reverseComparer);
			if (num < 0)
			{
				num = ~num;
			}
			list.Insert(num, item);
			return num;
		}

		public static int AddAcending<T>(this List<T> list, T item) where T : IComparable<T>
		{
			if (list.Count == 0 || list[list.Count - 1].CompareTo(item) <= 0)
			{
				list.Add(item);
				return list.Count - 1;
			}
			if (list[0].CompareTo(item) >= 0)
			{
				list.Insert(0, item);
				return 0;
			}
			int num = list.BinarySearch(item);
			if (num < 0)
			{
				num = ~num;
			}
			list.Insert(num, item);
			return num;
		}
	}
	public static class StringExt
	{
		public static string AppendIf(this string value, bool expression, string append)
		{
			if (!expression)
			{
				return value;
			}
			return value + append;
		}
	}
	public static class TextMeshProUGUIExt
	{
		public static TextMeshProUGUI CopyFrom(this TextMeshProUGUI source, TextMeshProUGUI target)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)source).font = ((target != null) ? ((TMP_Text)target).font : null);
			((TMP_Text)source).fontSharedMaterial = ((target != null) ? ((TMP_Text)target).fontSharedMaterial : null);
			((TMP_Text)source).fontMaterial = ((target != null) ? ((TMP_Text)target).fontMaterial : null);
			((TMP_Text)source).outlineWidth = ((TMP_Text)target).outlineWidth;
			((TMP_Text)source).fontSize = ((TMP_Text)target).fontSize;
			((TMP_Text)source).horizontalAlignment = ((TMP_Text)target).horizontalAlignment;
			((TMP_Text)source).verticalAlignment = ((TMP_Text)target).verticalAlignment;
			((TMP_Text)source).alignment = ((TMP_Text)target).alignment;
			((TMP_Text)source).richText = ((TMP_Text)target).richText;
			((TMP_Text)source).vertexBufferAutoSizeReduction = ((TMP_Text)target).vertexBufferAutoSizeReduction;
			((TMP_Text)source).extraPadding = ((TMP_Text)target).extraPadding;
			return source;
		}
	}
}
namespace EnhancedQOL.Binder
{
	public enum ECardBorderSortType
	{
		None = -1,
		Base,
		FirstEdition,
		Silver,
		Gold,
		Ex,
		FullArt
	}
	public enum ECardCountDisplayType
	{
		None = -1,
		CurrentRarityFiler,
		CurrentFilters,
		AllRarity
	}
	public enum ECardElementSortType
	{
		None = -1,
		Fire,
		Earth,
		Water,
		Wind
	}
	public enum ECardRaritySortType
	{
		None = -1,
		Common,
		Rare,
		Epic,
		Legendary
	}
	public class EnhancedBinderSort : MonoBehaviour
	{
		private int m_MinDupeCount;

		private ECardRaritySortType m_RaritySortingType = ECardRaritySortType.None;

		private ECardElementSortType m_ElementSortingType = ECardElementSortType.None;

		private ECardBorderSortType m_BorderSortingType = ECardBorderSortType.None;

		private KeyboardShortcut m_RaritySortFilterToggleShortcut;

		private KeyboardShortcut m_BorderSortFilterToggleShortcut;

		private KeyboardShortcut m_ElementSortFilterToggleShortcut;

		private KeyboardShortcut m_RaritySortFilterClearShortcut;

		private KeyboardShortcut m_BorderSortFilterClearShortcut;

		private KeyboardShortcut m_ElementSortFilterClearShortcut;

		private KeyboardShortcut m_AllSortFilterClearShortcut;

		public EnhancedBinderUIManager EnhancedBinderUIManager { get; private set; }

		private void Awake()
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			m_MinDupeCount = Settings.Instance.minDupeCount.Value;
			m_RaritySortFilterToggleShortcut = Settings.Instance.raritySortFilterToggle.Value;
			m_BorderSortFilterToggleShortcut = Settings.Instance.borderSortFilterToggle.Value;
			m_ElementSortFilterToggleShortcut = Settings.Instance.elementSortFilterToggle.Value;
			m_RaritySortFilterClearShortcut = Settings.Instance.raritySortFilterClear.Value;
			m_BorderSortFilterClearShortcut = Settings.Instance.borderSortFilterClear.Value;
			m_ElementSortFilterClearShortcut = Settings.Instance.elementSortFilterClear.Value;
			m_AllSortFilterClearShortcut = Settings.Instance.allFilterClear.Value;
			Settings.Instance.isEnhancedBinderSortEnabled.SettingChanged += delegate
			{
				((Behaviour)this).enabled = Settings.Instance.isEnhancedBinderSortEnabled.Value;
				if (EnhancedBinderUIManager != null)
				{
					((Behaviour)EnhancedBinderUIManager).enabled = Settings.Instance.isEnhancedBinderSortEnabled.Value;
				}
				if (!Settings.Instance.isEnhancedQOLEnabled.Value && ((Behaviour)this).enabled)
				{
					Settings.Instance.isEnhancedQOLEnabled.Value = true;
				}
			};
			Settings.Instance.minDupeCount.SettingChanged += delegate
			{
				m_MinDupeCount = Settings.Instance.minDupeCount.Value;
			};
			Settings.Instance.raritySortFilterToggle.SettingChanged += delegate
			{
				//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)
				m_RaritySortFilterToggleShortcut = Settings.Instance.raritySortFilterToggle.Value;
			};
			Settings.Instance.borderSortFilterToggle.SettingChanged += delegate
			{
				//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)
				m_BorderSortFilterToggleShortcut = Settings.Instance.borderSortFilterToggle.Value;
			};
			Settings.Instance.elementSortFilterToggle.SettingChanged += delegate
			{
				//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)
				m_ElementSortFilterToggleShortcut = Settings.Instance.elementSortFilterToggle.Value;
			};
			Settings.Instance.raritySortFilterClear.SettingChanged += delegate
			{
				//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)
				m_RaritySortFilterClearShortcut = Settings.Instance.raritySortFilterClear.Value;
			};
			Settings.Instance.borderSortFilterClear.SettingChanged += delegate
			{
				//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)
				m_BorderSortFilterClearShortcut = Settings.Instance.borderSortFilterClear.Value;
			};
			Settings.Instance.elementSortFilterClear.SettingChanged += delegate
			{
				//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)
				m_ElementSortFilterClearShortcut = Settings.Instance.elementSortFilterClear.Value;
			};
			Settings.Instance.allFilterClear.SettingChanged += delegate
			{
				//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)
				m_AllSortFilterClearShortcut = Settings.Instance.allFilterClear.Value;
			};
		}

		public void OnEnable()
		{
			if (EnhancedBinderUIManager != null)
			{
				((Behaviour)EnhancedBinderUIManager).enabled = true;
			}
			if (EnhancedBinderUIManager == null)
			{
				EnhancedBinderUIManager enhancedBinderUIManager2 = (EnhancedBinderUIManager = ((Component)this).gameObject.AddComponent<EnhancedBinderUIManager>());
			}
		}

		public void OnDisable()
		{
			if (EnhancedBinderUIManager != null)
			{
				Plugin.Logger.LogError((object)(EnhancedBinderUIManager == null));
				((Behaviour)EnhancedBinderUIManager).enabled = false;
			}
		}

		public void OnCollectionBinderUIAwake(CollectionBinderUI instance)
		{
			((Behaviour)EnhancedBinderUIManager).enabled = true;
		}

		public void OnCollectionBinderFlipAnimCtrlUpdate(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl, bool isAlbumOpen)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected I4, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected I4, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected I4, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected I4, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected I4, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected I4, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected I4, but got Unknown
			if (!((Behaviour)this).enabled || !isAlbumOpen || (int)collectionBinderFlipAnimCtrl.GetExpansionType() == 2 || (int)collectionBinderFlipAnimCtrl.GetSortingType() == 3)
			{
				return;
			}
			if (CSingleton<InteractionPlayerController>.Instance.GetHeldCards().Count <= 0)
			{
				if (((KeyboardShortcut)(ref m_RaritySortFilterToggleShortcut)).IsDown())
				{
					m_RaritySortingType = m_RaritySortingType.Next();
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_BorderSortFilterToggleShortcut)).IsDown())
				{
					m_BorderSortingType = m_BorderSortingType.Next();
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_ElementSortFilterToggleShortcut)).IsDown())
				{
					m_ElementSortingType = m_ElementSortingType.Next();
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_AllSortFilterClearShortcut)).IsDown())
				{
					m_RaritySortingType = ECardRaritySortType.None;
					m_BorderSortingType = ECardBorderSortType.None;
					m_ElementSortingType = ECardElementSortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_BorderSortFilterClearShortcut)).IsDown())
				{
					m_BorderSortingType = ECardBorderSortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_ElementSortFilterClearShortcut)).IsDown())
				{
					m_ElementSortingType = ECardElementSortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_RaritySortFilterClearShortcut)).IsDown())
				{
					m_RaritySortingType = ECardRaritySortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
			}
			EnhancedBinderUIManager?.OnUpdate(m_RaritySortingType, m_BorderSortingType, m_ElementSortingType);
		}

		public bool OnSort(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//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)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			bool flag = !((Behaviour)this).enabled || (int)collectionBinderFlipAnimCtrl.GetExpansionType() == 2;
			if (!flag)
			{
				ECollectionSortingType sortingType = collectionBinderFlipAnimCtrl.GetSortingType();
				Func<bool> func = (((int)sortingType == 3) ? ((Func<bool>)(() => true)) : (((int)sortingType != 4) ? ((Func<bool>)delegate
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					List<int> sortedCardList = collectionBinderFlipAnimCtrl.GetSortedCardList();
					new List<int>();
					return new CollectedCardsUtility.Builder().WithSortType(collectionBinderFlipAnimCtrl.GetSortingType()).WithExpansionType(collectionBinderFlipAnimCtrl.GetExpansionType()).WithRarityType(m_RaritySortingType)
						.WithElementType(m_ElementSortingType)
						.WithBorderType(m_BorderSortingType)
						.WithMinDupeCount(m_MinDupeCount)
						.Build()
						.Sort(sortedCardList);
				}) : ((Func<bool>)(() => true))));
				flag = func();
			}
			return flag;
		}

		public void OnBinderOpen(ECollectionSortingType sortingType, ECardExpansionType expansionType)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)this).enabled)
			{
				EnhancedBinderUIManager?.OnCollectionBinderOpen(sortingType, expansionType, m_RaritySortingType, m_BorderSortingType, m_ElementSortingType);
			}
		}
	}
	public class EnhancedBinderUIManager : MonoBehaviour
	{
		private bool m_IsInitialized;

		private GameObject m_ScreenGrp;

		private TextMeshProUGUI m_CardsCollectedText;

		private TextMeshProUGUI m_TotalCollectionCountText;

		private TextMeshProUGUI m_RareCollectionCountText;

		private TextMeshProUGUI m_EpicCollectionCountText;

		private TextMeshProUGUI m_LegendaryCollectionCountText;

		private List<Tuple<int, int>> m_CardCounts = new List<Tuple<int, int>>();

		private ECardCountDisplayType m_CardCountDisplayType;

		private void Awake()
		{
			Settings.Instance.cardCountDisplayType.SettingChanged += delegate
			{
				m_CardCountDisplayType = Settings.Instance.cardCountDisplayType.Value;
				if (m_IsInitialized)
				{
					if (Settings.Instance.cardCountDisplayType.Value == ECardCountDisplayType.AllRarity)
					{
						((Behaviour)m_RareCollectionCountText).enabled = true;
						((Behaviour)m_EpicCollectionCountText).enabled = true;
						((Behaviour)m_LegendaryCollectionCountText).enabled = true;
					}
					else
					{
						((Behaviour)m_RareCollectionCountText).enabled = false;
						((Behaviour)m_EpicCollectionCountText).enabled = false;
						((Behaviour)m_LegendaryCollectionCountText).enabled = false;
					}
				}
			};
			Settings.Instance.commonCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_TotalCollectionCountText).transform.localPosition = Settings.Instance.commonCardCountPosition.Value;
			};
			Settings.Instance.commonCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_TotalCollectionCountText).fontSize = Settings.Instance.commonCardCountFontSize.Value;
			};
			Settings.Instance.rareCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_RareCollectionCountText).transform.localPosition = Settings.Instance.rareCardCountPosition.Value;
			};
			Settings.Instance.rareCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_RareCollectionCountText).fontSize = Settings.Instance.rareCardCountFontSize.Value;
			};
			Settings.Instance.epicCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_EpicCollectionCountText).transform.localPosition = Settings.Instance.epicCardCountPosition.Value;
			};
			Settings.Instance.epicCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_EpicCollectionCountText).fontSize = Settings.Instance.epicCardCountFontSize.Value;
			};
			Settings.Instance.legendaryCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_LegendaryCollectionCountText).transform.localPosition = Settings.Instance.legendaryCardCountPosition.Value;
			};
			Settings.Instance.legendaryCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_LegendaryCollectionCountText).fontSize = Settings.Instance.legendaryCardCountFontSize.Value;
			};
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			if (!m_IsInitialized)
			{
				CollectionBinderUI val = Object.FindFirstObjectByType<CollectionBinderUI>();
				if (val != null)
				{
					m_ScreenGrp = val.m_ScreenGrp;
					if (m_CardsCollectedText == null)
					{
						m_CardsCollectedText = ((Component)m_ScreenGrp.transform.Find("AnimGrp/CardCollectedText")).GetComponent<TextMeshProUGUI>();
					}
					((TMP_Text)m_CardsCollectedText).enableAutoSizing = false;
					((TMP_Text)m_CardsCollectedText).fontSize = 30f;
					((TMP_Text)m_CardsCollectedText).rectTransform.sizeDelta = new Vector2(800f, 100f);
					if (m_TotalCollectionCountText == null)
					{
						m_TotalCollectionCountText = ((Component)m_ScreenGrp.transform.Find("AnimGrp/CardCollected")).GetComponent<TextMeshProUGUI>();
					}
					((TMP_Text)m_TotalCollectionCountText).transform.localPosition = Settings.Instance.commonCardCountPosition.Value;
					((TMP_Text)m_TotalCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_TotalCollectionCountText).fontSize = Settings.Instance.commonCardCountFontSize.Value;
					((TMP_Text)m_TotalCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 100f);
					if (m_RareCollectionCountText == null)
					{
						m_RareCollectionCountText = new GameObject().AddComponent<TextMeshProUGUI>().CopyFrom(m_TotalCollectionCountText);
					}
					((Object)((Component)m_RareCollectionCountText).gameObject).name = "RareCount";
					((TMP_Text)m_RareCollectionCountText).transform.SetParent(((Component)m_ScreenGrp.transform.Find("AnimGrp")).transform);
					((TMP_Text)m_RareCollectionCountText).transform.localPosition = Settings.Instance.rareCardCountPosition.Value;
					((TMP_Text)m_RareCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 20f);
					((TMP_Text)m_RareCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_RareCollectionCountText).fontSize = Settings.Instance.rareCardCountFontSize.Value;
					if (m_EpicCollectionCountText == null)
					{
						m_EpicCollectionCountText = new GameObject().AddComponent<TextMeshProUGUI>().CopyFrom(m_TotalCollectionCountText);
					}
					((Object)((Component)m_EpicCollectionCountText).gameObject).name = "EpicCount";
					((TMP_Text)m_EpicCollectionCountText).transform.SetParent(((Component)m_ScreenGrp.transform.Find("AnimGrp")).transform);
					((TMP_Text)m_EpicCollectionCountText).transform.localPosition = Settings.Instance.epicCardCountPosition.Value;
					((TMP_Text)m_EpicCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 20f);
					((TMP_Text)m_EpicCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_EpicCollectionCountText).fontSize = Settings.Instance.epicCardCountFontSize.Value;
					if (m_LegendaryCollectionCountText == null)
					{
						m_LegendaryCollectionCountText = new GameObject().AddComponent<TextMeshProUGUI>().CopyFrom(m_TotalCollectionCountText);
					}
					((Object)((Component)m_LegendaryCollectionCountText).gameObject).name = "LegendCount";
					((TMP_Text)m_LegendaryCollectionCountText).transform.SetParent(((Component)m_ScreenGrp.transform.Find("AnimGrp")).transform);
					((TMP_Text)m_LegendaryCollectionCountText).transform.localPosition = Settings.Instance.legendaryCardCountPosition.Value;
					((TMP_Text)m_LegendaryCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 20f);
					((TMP_Text)m_LegendaryCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_LegendaryCollectionCountText).fontSize = Settings.Instance.legendaryCardCountFontSize.Value;
					m_CardCountDisplayType = Settings.Instance.cardCountDisplayType.Value;
				}
			}
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_ScreenGrp = null;
				if (m_CardsCollectedText != null)
				{
					((TMP_Text)m_CardsCollectedText).enableAutoSizing = true;
					m_CardsCollectedText = null;
				}
				if (m_TotalCollectionCountText != null)
				{
					((TMP_Text)m_TotalCollectionCountText).enableAutoSizing = true;
					m_TotalCollectionCountText = null;
				}
				if (m_RareCollectionCountText != null)
				{
					Object.Destroy((Object)(object)m_RareCollectionCountText);
					m_RareCollectionCountText = null;
				}
				if (m_EpicCollectionCountText != null)
				{
					Object.Destroy((Object)(object)m_EpicCollectionCountText);
					m_EpicCollectionCountText = null;
				}
				if (m_LegendaryCollectionCountText != null)
				{
					Object.Destroy((Object)(object)m_LegendaryCollectionCountText);
					m_LegendaryCollectionCountText = null;
				}
				m_IsInitialized = false;
			}
		}

		public void OnUpdate(ECardRaritySortType raritySortingType, ECardBorderSortType borderSortingType, ECardElementSortType elementSortingType)
		{
			if (((Behaviour)this).enabled)
			{
				string text = "Cards Collected".AppendIf(raritySortingType != ECardRaritySortType.None, $" [{raritySortingType}]").AppendIf(borderSortingType != ECardBorderSortType.None, $" [{borderSortingType}]").AppendIf(elementSortingType != ECardElementSortType.None, $" [{elementSortingType}]");
				((TMP_Text)m_CardsCollectedText).SetText(text, true);
				if (m_CardCountDisplayType == ECardCountDisplayType.AllRarity)
				{
					((TMP_Text)m_TotalCollectionCountText).SetText($"Common: {m_CardCounts[0].Item1}/{m_CardCounts[0].Item2} ({Math.Round((float)m_CardCounts[0].Item1 / (float)m_CardCounts[0].Item2 * 100f, 1)}%)", true);
					((TMP_Text)m_RareCollectionCountText).SetText($"Rare: {m_CardCounts[1].Item1}/{m_CardCounts[1].Item2} ({Math.Round((float)m_CardCounts[1].Item1 / (float)m_CardCounts[1].Item2 * 100f, 1)}%)", true);
					((TMP_Text)m_EpicCollectionCountText).SetText($"Epic: {m_CardCounts[2].Item1}/{m_CardCounts[2].Item2} ({Math.Round((float)m_CardCounts[2].Item1 / (float)m_CardCounts[2].Item2 * 100f, 1)}%)", true);
					((TMP_Text)m_LegendaryCollectionCountText).SetText($"Legendary: {m_CardCounts[3].Item1}/{m_CardCounts[3].Item2} ({Math.Round((float)m_CardCounts[3].Item1 / (float)m_CardCounts[3].Item2 * 100f, 1)}%)", true);
				}
				else
				{
					((TMP_Text)m_TotalCollectionCountText).SetText($"Common: {m_CardCounts[0].Item1}/{m_CardCounts[0].Item2} ({Math.Round((float)m_CardCounts[0].Item1 / (float)m_CardCounts[0].Item2 * 100f, 1)}%)", true);
				}
			}
		}

		public void OnCollectionBinderOpen(ECollectionSortingType sortingType, ECardExpansionType expansionType, ECardRaritySortType raritySortingType, ECardBorderSortType borderSortingType, ECardElementSortType elementSortingType)
		{
			//IL_003a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			m_CardCounts.Clear();
			switch (m_CardCountDisplayType)
			{
			case ECardCountDisplayType.None:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).Build()
					.GetCardCount());
				break;
			case ECardCountDisplayType.CurrentFilters:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(raritySortingType)
					.WithBorderType(borderSortingType)
					.WithElementType(elementSortingType)
					.Build()
					.GetCardCount());
				break;
			case ECardCountDisplayType.CurrentRarityFiler:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(raritySortingType)
					.Build()
					.GetCardCount());
				break;
			case ECardCountDisplayType.AllRarity:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Common)
					.Build()
					.GetCardCount());
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Rare)
					.Build()
					.GetCardCount());
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Epic)
					.Build()
					.GetCardCount());
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Legendary)
					.Build()
					.GetCardCount());
				break;
			}
			while (m_CardCounts.Count != 4)
			{
				m_CardCounts.Add(new Tuple<int, int>(1, 1));
			}
		}
	}
}

plugins/EnhancedQOL.dll

Decompiled 15 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnhancedQOL.Binder;
using EnhancedQOL.Extensions;
using EnhancedQOL.Helpers;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyCompany("EnhancedQOL")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: AssemblyInformationalVersion("1.4.1+dd4412d7b2a9f1908bfd6e9b5c0a9adfb76b24e8")]
[assembly: AssemblyProduct("EnhancedQOL")]
[assembly: AssemblyTitle("EnhancedQOL")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal sealed class ConfigurationManagerAttributes
{
	public delegate void CustomHotkeyDrawerFunc(ConfigEntryBase setting, ref bool isCurrentlyAcceptingInput);

	public bool? ShowRangeAsPercent;

	public Action<ConfigEntryBase> CustomDrawer;

	public CustomHotkeyDrawerFunc CustomHotkeyDrawer;

	public bool? Browsable;

	public string Category;

	public object DefaultValue;

	public bool? HideDefaultButton;

	public bool? HideSettingName;

	public string Description;

	public string DispName;

	public int? Order;

	public bool? ReadOnly;

	public bool? IsAdvanced;

	public Func<object, string> ObjToStr;

	public Func<string, object> StrToObj;
}
namespace EnhancedQOL
{
	[HarmonyPatch(typeof(InteractableCard3d))]
	internal class InteractableCard3dPatches
	{
		[HarmonyPatch("OnFinishLerp")]
		[HarmonyPostfix]
		public static void OnFinishLerpPostfix(ref InteractableCard3d __instance)
		{
			Plugin.PutItBack.OnCardFinishLerp(ref __instance);
		}
	}
	[BepInPlugin("EnhancedQOL", "EnhancedQOL", "1.4.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony m_Harmony = new Harmony("EnhancedQOL");

		private bool m_HasFinishedLoading;

		private bool m_ApplicationQuiting;

		private GameObject m_ChildGameObject;

		internal static EnhancedBinderSort EnhancedBinderSort { get; private set; }

		internal static PutItBack PutItBack { get; private set; }

		internal static ScrollWheeler ScrollWheeler { get; private set; }

		internal static SceneRaycaster Raycaster { get; private set; }

		internal static ManualLogSource Logger { get; private set; }

		private Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Logger = ((BaseUnityPlugin)this).Logger;
			m_Harmony.PatchAll();
			Logger.LogInfo((object)"Plugin EnhancedQOL v1.4.1 by GhostNarwhal is loaded!");
		}

		private void Awake()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			Settings.Instance.Load(this);
			if (m_ChildGameObject == null)
			{
				m_ChildGameObject = new GameObject("EnhancedQOL+Internal Mods");
			}
			m_ChildGameObject.transform.parent = ((Component)this).gameObject.transform;
			m_HasFinishedLoading = false;
			m_ApplicationQuiting = false;
			EnhancedBinderSort = m_ChildGameObject.AddComponent<EnhancedBinderSort>();
			PutItBack = m_ChildGameObject.AddComponent<PutItBack>();
			ScrollWheeler = m_ChildGameObject.AddComponent<ScrollWheeler>();
			Raycaster = m_ChildGameObject.AddComponent<SceneRaycaster>();
			((Behaviour)this).enabled = Settings.Instance.isEnhancedQOLEnabled.Value;
			Settings.Instance.isEnhancedQOLEnabled.SettingChanged += delegate
			{
				if (!Settings.Instance.isEnhancedQOLEnabled.Value)
				{
					Settings.Instance.isPutItBackEnabled.Value = false;
					Settings.Instance.isEnhancedBinderSortEnabled.Value = false;
					Settings.Instance.isScrollWheelerEnabled.Value = false;
				}
				((Behaviour)this).enabled = Settings.Instance.isEnhancedQOLEnabled.Value;
			};
			SceneManager.sceneLoaded += SceneLoaded;
		}

		private void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
		{
			if (((Scene)(ref scene)).name == "Start")
			{
				m_HasFinishedLoading = true;
				if (((Behaviour)this).enabled)
				{
					OnEnable();
				}
			}
			else
			{
				((Behaviour)Raycaster).enabled = false;
			}
		}

		private void OnEnable()
		{
			if (m_HasFinishedLoading)
			{
				((Behaviour)Raycaster).enabled = true;
				((Behaviour)EnhancedBinderSort).enabled = Settings.Instance.isEnhancedBinderSortEnabled.Value;
				((Behaviour)PutItBack).enabled = Settings.Instance.isPutItBackEnabled.Value;
				((Behaviour)ScrollWheeler).enabled = Settings.Instance.isScrollWheelerEnabled.Value;
			}
		}

		private void OnDisable()
		{
			if (Raycaster != null)
			{
				((Behaviour)Raycaster).enabled = false;
			}
			if (!m_ApplicationQuiting)
			{
				Settings.Instance.isEnhancedQOLEnabled.Value = false;
				Settings.Instance.isPutItBackEnabled.Value = false;
				Settings.Instance.isScrollWheelerEnabled.Value = false;
			}
		}

		private void OnDestroy()
		{
			if (m_ChildGameObject != null)
			{
				Object.Destroy((Object)(object)m_ChildGameObject);
			}
			m_Harmony.UnpatchSelf();
			Logger.LogInfo((object)"Plugin EnhancedQOL is unloaded!");
		}

		private void OnApplicationQuit()
		{
			m_ApplicationQuiting = true;
		}
	}
	public class PutItBack : MonoBehaviour
	{
		private bool m_IsReturningCard;

		private int m_CurrentBinderPageIndex;

		private List<BinderPageGrp> m_BinderPageGrpList = new List<BinderPageGrp>();

		private List<HeldCardData> m_HeldCardDataList = new List<HeldCardData>();

		private List<Type> m_ItemCompartmentTypeList = new List<Type>();

		private ECollectionSortingType m_SortingType;

		private bool m_IsInitialized;

		private void Awake()
		{
			Settings.Instance.isPutItBackEnabled.SettingChanged += delegate
			{
				((Behaviour)this).enabled = Settings.Instance.isPutItBackEnabled.Value;
				if (!Settings.Instance.isEnhancedQOLEnabled.Value && ((Behaviour)this).enabled)
				{
					Settings.Instance.isEnhancedQOLEnabled.Value = true;
				}
			};
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_IsInitialized = false;
			}
		}

		public void OnUpdate(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)this).enabled && collectionBinderFlipAnimCtrl.IsBookOpen())
			{
				m_CurrentBinderPageIndex = collectionBinderFlipAnimCtrl.GetCurrentBinderPageIndex();
				m_BinderPageGrpList = collectionBinderFlipAnimCtrl.m_BinderPageGrpList;
				m_SortingType = collectionBinderFlipAnimCtrl.GetSortingType();
				if (UnityInput.Current.mouseScrollDelta.y > 0f && CSingleton<InteractionPlayerController>.Instance.GetHeldCards().Count > 0)
				{
					collectionBinderFlipAnimCtrl.OnMouseButtonUp();
				}
				if (UnityInput.Current.mouseScrollDelta.y < 0f)
				{
					collectionBinderFlipAnimCtrl.OnRightMouseButtonUp();
				}
			}
		}

		public bool OnRightMouseButtonUp(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			if (((Behaviour)this).enabled && !m_IsReturningCard)
			{
				InteractableCard3d currentRaycastedInteractableCard3d = collectionBinderFlipAnimCtrl.m_CurrentRaycastedInteractableCard3d;
				bool? flag = ((currentRaycastedInteractableCard3d != null) ? new bool?(currentRaycastedInteractableCard3d.m_Card3dUI.m_CardUI.GetCardData().IsOwned()) : null);
				if (!flag.HasValue || !flag.Value)
				{
					return false;
				}
				if (InteractionPlayerController.HasEnoughSlotToHoldCard())
				{
					List<HeldCardData> heldCardDataList = m_HeldCardDataList;
					HeldCardData obj = new HeldCardData
					{
						BinderCardSlotIndex = collectionBinderFlipAnimCtrl.GetRaycastedCardIndex(),
						BinderPageIndex = collectionBinderFlipAnimCtrl.GetCurrentBinderPageIndex()
					};
					InteractableCard3d currentRaycastedInteractableCard3d2 = collectionBinderFlipAnimCtrl.m_CurrentRaycastedInteractableCard3d;
					obj.CardData = ((currentRaycastedInteractableCard3d2 != null) ? currentRaycastedInteractableCard3d2.m_Card3dUI.m_CardUI.GetCardData() : null);
					InteractableCard3d currentRaycastedInteractableCard3d3 = collectionBinderFlipAnimCtrl.m_CurrentRaycastedInteractableCard3d;
					obj.Transform = ((currentRaycastedInteractableCard3d3 != null) ? ((Component)currentRaycastedInteractableCard3d3).transform : null);
					heldCardDataList.Add(obj);
				}
			}
			return true;
		}

		public bool OnLeftMouseButtonUp(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			if (((Behaviour)this).enabled && !m_IsReturningCard)
			{
				List<InteractableCard3d> heldCards = CSingleton<InteractionPlayerController>.Instance.GetHeldCards();
				if (heldCards.Count > 0)
				{
					int num = m_HeldCardDataList.Last().BinderCardSlotIndex;
					int num2 = m_HeldCardDataList.Last().BinderPageIndex - collectionBinderFlipAnimCtrl.GetCurrentBinderPageIndex();
					int index = 0;
					if (num2 <= -1)
					{
						if (num >= 6)
						{
							num -= 6;
						}
						index = 2;
					}
					else if (num2 >= 1)
					{
						if (num <= 5)
						{
							num += 6;
						}
						index = 1;
					}
					Transform transform = ((Component)collectionBinderFlipAnimCtrl.m_BinderPageGrpList[index].m_CardList[num]).transform;
					((InteractableObject)heldCards.Last()).StopLerpToTransform();
					((InteractableObject)heldCards.Last()).LerpToTransform(transform, transform.parent);
					m_IsReturningCard = true;
					return false;
				}
			}
			return true;
		}

		public void OnCardFinishLerp(ref InteractableCard3d interactableCard3D)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).enabled || !m_IsReturningCard)
			{
				return;
			}
			List<InteractableCard3d> heldCards = CSingleton<InteractionPlayerController>.Instance.GetHeldCards();
			if (heldCards.Count > 0)
			{
				CPlayerData.AddCard(m_HeldCardDataList.Last().CardData, 1);
				int num = m_HeldCardDataList.Last().BinderPageIndex - m_CurrentBinderPageIndex;
				if (num >= -1 && num <= 1)
				{
					int index = ((num == -1) ? 2 : num);
					int cardAmount = CPlayerData.GetCardAmount(m_HeldCardDataList.Last().CardData);
					m_BinderPageGrpList[index].SetSingleCard(m_HeldCardDataList.Last().BinderCardSlotIndex, m_HeldCardDataList.Last().CardData, cardAmount, m_SortingType);
					((Component)m_BinderPageGrpList[index].m_CardList[m_HeldCardDataList.Last().BinderCardSlotIndex]).gameObject.SetActive(true);
					((Component)m_HeldCardDataList.Last().Transform).gameObject.SetActive(true);
				}
				((InteractableObject)heldCards.Last()).OnDestroyed();
				heldCards.RemoveAt(heldCards.Count - 1);
				m_HeldCardDataList.RemoveAt(m_HeldCardDataList.Count - 1);
				CPlayerData.m_HoldCardDataList.RemoveAt(CPlayerData.m_HoldCardDataList.Count - 1);
				SetHoldCardEularRotation(heldCards.Count);
				m_IsReturningCard = false;
			}
		}

		private void SetHoldCardEularRotation(int heldCardCount)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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)
			Quaternion value = Quaternion.Euler(0f, 0f, 0f);
			if (heldCardCount == 0)
			{
				CSingleton<InteractionPlayerController>.Instance.SetHoldCardGroupTargetRotation(value);
				CSingleton<InteractionPlayerController>.Instance.EnterViewCardAlbumMode();
			}
			else
			{
				value = Quaternion.Euler(0f, 0f, Mathf.Lerp(0f, 15f, (float)heldCardCount / 7f));
				CSingleton<InteractionPlayerController>.Instance.SetHoldCardGroupTargetRotation(value);
			}
		}
	}
	public class ScrollWheeler : MonoBehaviour
	{
		private bool m_IsInitialized;

		private void Awake()
		{
			Settings.Instance.isScrollWheelerEnabled.SettingChanged += delegate
			{
				((Behaviour)this).enabled = Settings.Instance.isScrollWheelerEnabled.Value;
				if (!Settings.Instance.isEnhancedQOLEnabled.Value && ((Behaviour)this).enabled)
				{
					Settings.Instance.isEnhancedQOLEnabled.Value = true;
				}
			};
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_IsInitialized = false;
			}
		}

		private void Update()
		{
			//IL_0005: 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)
			if (UnityInput.Current.mouseScrollDelta.y > 0f)
			{
				OnScrollWheel(placingItem: true);
			}
			if (UnityInput.Current.mouseScrollDelta.y < 0f)
			{
				OnScrollWheel(placingItem: false);
			}
		}

		private void OnScrollWheel(bool placingItem)
		{
			InteractablePackagingBox_Item packagingBox = CSingleton<InteractionPlayerController>.Instance.GetCurrentHeldBox();
			int heldCardCount = CSingleton<InteractionPlayerController>.Instance.GetHeldCards().Count;
			int heldItemCount = CSingleton<InteractionPlayerController>.Instance.GetHeldItemList().Count;
			Component raycastedComponent = Plugin.Raycaster.RaycastedComponent;
			if (raycastedComponent == null)
			{
				goto IL_0214;
			}
			ShelfCompartment val = default(ShelfCompartment);
			ref ShelfCompartment reference = ref val;
			Component obj = raycastedComponent;
			reference = (ShelfCompartment)(object)((obj is ShelfCompartment) ? obj : null);
			Action action;
			if (val != null && packagingBox != null)
			{
				action = delegate
				{
					if (placingItem)
					{
						packagingBox.DispenseItem(true, val);
					}
					else
					{
						packagingBox.RemoveItemFromShelf(true, val);
					}
				};
			}
			else
			{
				ShelfCompartment val2 = default(ShelfCompartment);
				ref ShelfCompartment reference2 = ref val2;
				Component obj2 = raycastedComponent;
				reference2 = (ShelfCompartment)(object)((obj2 is ShelfCompartment) ? obj2 : null);
				if (val2 != null && val2.m_CanPutBox && !placingItem)
				{
					action = delegate
					{
						((InteractableObject)((Component)val2).gameObject.GetComponent<InteractableStorageCompartment>()).OnMouseButtonUp();
					};
				}
				else
				{
					InteractablePackagingBox_Item val3 = default(InteractablePackagingBox_Item);
					ref InteractablePackagingBox_Item reference3 = ref val3;
					Component obj3 = raycastedComponent;
					reference3 = (InteractablePackagingBox_Item)(object)((obj3 is InteractablePackagingBox_Item) ? obj3 : null);
					if (val3 != null && packagingBox != null)
					{
						action = delegate
						{
							//IL_0096: 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_00e3: Unknown result type (might be due to invalid IL or missing references)
							//IL_010d: Unknown result type (might be due to invalid IL or missing references)
							if (!((InteractablePackagingBox)val3).IsBoxOpened())
							{
								((InteractablePackagingBox)val3).OnPressOpenBox();
							}
							else if (!((InteractablePackagingBox)packagingBox).IsBoxOpened())
							{
								((InteractablePackagingBox)packagingBox).OnPressOpenBox();
							}
							else
							{
								InteractablePackagingBox_Item val7 = (placingItem ? val3 : packagingBox);
								InteractablePackagingBox_Item val8 = (placingItem ? packagingBox : val3);
								Item lastItem = val8.m_ItemCompartment.GetLastItem();
								if (lastItem != null && (val7.m_ItemCompartment.GetItemType() == val8.m_ItemCompartment.GetItemType() || val7.m_ItemCompartment.GetItemCount() == 0))
								{
									lastItem.LerpToTransform(val7.m_ItemCompartment.GetLastEmptySlotTransform(), val7.m_ItemCompartment.GetLastEmptySlotTransform().parent, false);
									val7.m_ItemCompartment.SetCompartmentItemType(val8.m_ItemCompartment.GetItemType());
									val7.m_ItemCompartment.AddItem(lastItem, false);
									val8.m_ItemCompartment.RemoveItem(lastItem);
									val7.m_ItemCompartment.SetPriceTagItemImage(val8.GetItemType());
									val7.m_ItemCompartment.SetPriceTagVisibility(false);
									val7.m_ItemCompartment.RefreshPriceTagItemPriceText();
								}
							}
						};
					}
					else if (raycastedComponent is InteractableTrashBin && packagingBox != null && placingItem)
					{
						action = delegate
						{
							//IL_002d: Unknown result type (might be due to invalid IL or missing references)
							if (packagingBox.m_ItemCompartment.GetItemCount() > 0)
							{
								((UIScreenBase)CSingleton<InteractionPlayerController>.Instance.m_ConfirmTrashScreen).OpenScreen();
							}
							else
							{
								((InteractableTrashBin)Plugin.Raycaster.RaycastedComponent).DiscardBox((InteractablePackagingBox)(object)packagingBox, true);
							}
						};
					}
					else
					{
						InteractableWorkbench val4 = default(InteractableWorkbench);
						ref InteractableWorkbench reference4 = ref val4;
						Component obj4 = raycastedComponent;
						reference4 = (InteractableWorkbench)(object)((obj4 is InteractableWorkbench) ? obj4 : null);
						if (val4 != null && packagingBox != null)
						{
							action = delegate
							{
								if (placingItem)
								{
									val4.DispenseItemFromBox(packagingBox, true);
								}
								else
								{
									val4.RemoveItemFromShelf(true, packagingBox);
								}
							};
						}
						else
						{
							InteractableCardCompartment val5 = default(InteractableCardCompartment);
							ref InteractableCardCompartment reference5 = ref val5;
							Component obj5 = raycastedComponent;
							reference5 = (InteractableCardCompartment)(object)((obj5 is InteractableCardCompartment) ? obj5 : null);
							if (val5 != null)
							{
								action = delegate
								{
									if (placingItem && heldCardCount > 0)
									{
										val5.OnMouseButtonUp();
									}
									else if (!placingItem)
									{
										val5.OnRightMouseButtonUp();
									}
								};
							}
							else
							{
								CardShelf val6 = default(CardShelf);
								ref CardShelf reference6 = ref val6;
								Component obj6 = raycastedComponent;
								reference6 = (CardShelf)(object)((obj6 is CardShelf) ? obj6 : null);
								if (val6 == null)
								{
									goto IL_0214;
								}
								action = delegate
								{
									foreach (InteractableCardCompartment cardCompartment in val6.GetCardCompartmentList())
									{
										if (placingItem && heldCardCount > 0 && cardCompartment.m_StoredCardList.Count == 0)
										{
											cardCompartment.OnMouseButtonUp();
											break;
										}
										if (!placingItem && cardCompartment.m_StoredCardList.Count > 0)
										{
											cardCompartment.OnRightMouseButtonUp();
											break;
										}
									}
								};
							}
						}
					}
				}
			}
			goto IL_0226;
			IL_0226:
			action();
			return;
			IL_0214:
			action = delegate
			{
				if (raycastedComponent != null && placingItem && heldItemCount > 0)
				{
					CSingleton<InteractionPlayerController>.Instance.PutItemOnShelf();
				}
				else if (raycastedComponent != null && !placingItem && packagingBox == null)
				{
					CSingleton<InteractionPlayerController>.Instance.TakeItemFromShelf();
				}
			};
			goto IL_0226;
		}
	}
	public class Settings
	{
		public ConfigEntry<bool> isEnhancedQOLEnabled;

		public ConfigEntry<bool> isScrollWheelerEnabled;

		public ConfigEntry<bool> isPutItBackEnabled;

		public ConfigEntry<bool> isEnhancedBinderSortEnabled;

		public ConfigEntry<int> minDupeCount;

		public ConfigEntry<ECardCountDisplayType> cardCountDisplayType;

		public ConfigEntry<Vector3> commonCardCountPosition;

		public ConfigEntry<int> commonCardCountFontSize;

		public ConfigEntry<Vector3> rareCardCountPosition;

		public ConfigEntry<int> rareCardCountFontSize;

		public ConfigEntry<Vector3> epicCardCountPosition;

		public ConfigEntry<int> epicCardCountFontSize;

		public ConfigEntry<Vector3> legendaryCardCountPosition;

		public ConfigEntry<int> legendaryCardCountFontSize;

		public ConfigEntry<KeyboardShortcut> raritySortFilterToggle;

		public ConfigEntry<KeyboardShortcut> borderSortFilterToggle;

		public ConfigEntry<KeyboardShortcut> elementSortFilterToggle;

		public ConfigEntry<KeyboardShortcut> elementSortFilterClear;

		public ConfigEntry<KeyboardShortcut> borderSortFilterClear;

		public ConfigEntry<KeyboardShortcut> allFilterClear;

		public ConfigEntry<KeyboardShortcut> raritySortFilterClear;

		private static Settings m_instance;

		public static Settings Instance
		{
			get
			{
				if (m_instance == null)
				{
					m_instance = new Settings();
				}
				return m_instance;
			}
		}

		public void Load(Plugin plugin)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Expected O, but got Unknown
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Expected O, but got Unknown
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Expected O, but got Unknown
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f2: Expected O, but got Unknown
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0235: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Expected O, but got Unknown
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0295: Expected O, but got Unknown
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Expected O, but got Unknown
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Expected O, but got Unknown
			//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Expected O, but got Unknown
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_041c: Expected O, but got Unknown
			//IL_0455: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Expected O, but got Unknown
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Expected O, but got Unknown
			//IL_04eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Expected O, but got Unknown
			//IL_051a: Unknown result type (might be due to invalid IL or missing references)
			//IL_053f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0549: Expected O, but got Unknown
			//IL_0581: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Expected O, but got Unknown
			//IL_05b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Expected O, but got Unknown
			//IL_0617: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Expected O, but got Unknown
			isEnhancedQOLEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL", "Enabled", true, new ConfigDescription("Enables or disables the entire plugin", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 25
				}
			}));
			isScrollWheelerEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL - Scroll Wheeler", "Enabled", true, new ConfigDescription("Enables or disables Scroll Wheeler", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20
				}
			}));
			isPutItBackEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL - Put It Back", "Enable", true, new ConfigDescription("Enables or disables put it back", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20
				}
			}));
			isEnhancedBinderSortEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("EnhancedQOL - Enhanced Album Sort", "Enable", true, new ConfigDescription("Enables or disables Enhanced Sorting", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 20
				}
			}));
			minDupeCount = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Minimum Duplication Count", 1, new ConfigDescription("The minimum number of dupes for cards to show in Duplication sort", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, int.MaxValue), new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 19
				}
			}));
			raritySortFilterToggle = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Rarity Sort Filter Toggle", new KeyboardShortcut((KeyCode)122, Array.Empty<KeyCode>()), new ConfigDescription("Key to cycle through rarity filters.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 18
				}
			}));
			raritySortFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear Rarity Sort Filter", new KeyboardShortcut((KeyCode)122, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key to clear current rarity filter", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 17
				}
			}));
			borderSortFilterToggle = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Border Sort Filter Toggle", new KeyboardShortcut((KeyCode)120, Array.Empty<KeyCode>()), new ConfigDescription("Key to cycle through border filters.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 16
				}
			}));
			borderSortFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear Border Sort Filter", new KeyboardShortcut((KeyCode)120, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key to clear current border filters.", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 15
				}
			}));
			elementSortFilterToggle = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Element Sort Filter Toggle", new KeyboardShortcut((KeyCode)99, Array.Empty<KeyCode>()), new ConfigDescription("Key to cycle through element filters", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 14
				}
			}));
			elementSortFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear Element Sort Filter", new KeyboardShortcut((KeyCode)99, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), new ConfigDescription("Key to clear current element filter", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 13
				}
			}));
			allFilterClear = ((BaseUnityPlugin)plugin).Config.Bind<KeyboardShortcut>("EnhancedQOL - Enhanced Album Sort", "Clear all sort filters", new KeyboardShortcut((KeyCode)118, Array.Empty<KeyCode>()), new ConfigDescription("Key to clear all current filters", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 12
				}
			}));
			cardCountDisplayType = ((BaseUnityPlugin)plugin).Config.Bind<ECardCountDisplayType>("EnhancedQOL - Enhanced Album Sort", "Card Count Display Type", ECardCountDisplayType.None, new ConfigDescription("How you want to view the card counts", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 11
				}
			}));
			commonCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Common Card Count Display Position", new Vector3(0f, 445f, 0f), new ConfigDescription("Position for common card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 10
				}
			}));
			commonCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Common Card Count Display Font Size", 34, new ConfigDescription("Common card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 9
				}
			}));
			rareCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Rare Card Count Display Position", new Vector3(0f, 400f, 0f), new ConfigDescription("Position for rare card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 8
				}
			}));
			rareCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Rare Card Count Display Font Size", 34, new ConfigDescription("Rare card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 7
				}
			}));
			epicCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Epic Card Count Display Position", new Vector3(0f, 350f, 0f), new ConfigDescription("Position for epic card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 6
				}
			}));
			epicCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Epic Card Count Display Font Size", 34, new ConfigDescription("Epic card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 5
				}
			}));
			legendaryCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("EnhancedQOL - Enhanced Album Sort", "Legendary Card Count Display Position", new Vector3(0f, 300f, 0f), new ConfigDescription("Position for legendary card count text", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 4
				}
			}));
			legendaryCardCountFontSize = ((BaseUnityPlugin)plugin).Config.Bind<int>("EnhancedQOL - Enhanced Album Sort", "Legendary Card Count Display Font Size", 34, new ConfigDescription("Legendary card count text font size", (AcceptableValueBase)null, new object[1]
			{
				new ConfigurationManagerAttributes
				{
					Order = 3
				}
			}));
		}

		private Settings()
		{
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "EnhancedQOL";

		public const string PLUGIN_NAME = "EnhancedQOL";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace EnhancedQOL.Patches
{
	[HarmonyPatch(typeof(CollectionBinderFlipAnimCtrl))]
	public class CollectionBinderFlipAnimCtrlPatches
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void OnUpdatePrefix(CollectionBinderFlipAnimCtrl __instance, bool ___m_IsBookOpen)
		{
			Plugin.EnhancedBinderSort.OnCollectionBinderFlipAnimCtrlUpdate(__instance, ___m_IsBookOpen);
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void OnUpdatePostfix(CollectionBinderFlipAnimCtrl __instance)
		{
			Plugin.PutItBack.OnUpdate(__instance);
		}

		[HarmonyPatch("OnMouseButtonUp")]
		[HarmonyPrefix]
		public static bool OnMouseButtonUpPrefix(CollectionBinderFlipAnimCtrl __instance)
		{
			return Plugin.PutItBack.OnLeftMouseButtonUp(__instance);
		}

		[HarmonyPatch("OnRightMouseButtonUp")]
		[HarmonyPrefix]
		public static bool OnRightMouseButtonUpPrefix(CollectionBinderFlipAnimCtrl __instance)
		{
			return Plugin.PutItBack.OnRightMouseButtonUp(__instance);
		}

		[HarmonyPatch("StartShowCardAlbum")]
		[HarmonyPostfix]
		public static void StartShowCardAlbumPostfix(CollectionBinderFlipAnimCtrl __instance)
		{
			//IL_0006: 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)
			Plugin.EnhancedBinderSort.OnBinderOpen(__instance.GetSortingType(), __instance.GetExpansionType());
			Plugin.Raycaster.OnBinderOpen();
		}

		[HarmonyPatch("HideCardAlbum")]
		[HarmonyPostfix]
		public static void HideCardAlbumPostfix()
		{
			Plugin.Raycaster.OnBinderClose();
		}
	}
	[HarmonyPatch(typeof(CollectionBinderUI))]
	public class CollectionBinderUIPatches
	{
		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void OnUpdate(CollectionBinderUI __instance)
		{
			Plugin.EnhancedBinderSort.OnCollectionBinderUIAwake(__instance);
		}
	}
	[HarmonyPatch]
	public class MissingCardsCompatibilityPatch
	{
		private static PluginInfo m_PluginInfo;

		private static bool Prepare()
		{
			return Chainloader.PluginInfos.TryGetValue("MissingCards", out m_PluginInfo);
		}

		private static MethodBase TargetMethod()
		{
			return (from m in AccessTools.GetDeclaredMethods((from m in ((object)m_PluginInfo.Instance).GetType().GetNestedTypes(BindingFlags.NonPublic)
					where m.Name == "PatchSortBinder"
					select m).FirstOrDefault())
				where m.Name == "Prefix"
				select m).Cast<MethodBase>().FirstOrDefault();
		}

		[HarmonyPrefix]
		private static bool Prefix(out CollectionBinderUI __state)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Invalid comparison between Unknown and I4
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Invalid comparison between Unknown and I4
			__state = Object.FindFirstObjectByType<CollectionBinderUI>();
			if ((int)__state.m_CollectionAlbum.GetSortingType() == 7)
			{
				return (int)__state.m_CollectionAlbum.GetExpansionType() == 2;
			}
			return true;
		}

		[HarmonyPostfix]
		private static void Postfix(CollectionBinderUI __state, bool __runOriginal)
		{
			if (!__runOriginal && __state.m_CollectionAlbum.GetCanUpdateSort())
			{
				__state.m_CollectionAlbum.SetCanUpdateSort(false);
				Plugin.EnhancedBinderSort.OnSort(__state.m_CollectionAlbum);
			}
		}
	}
	[HarmonyPatch]
	public class SortingPatch
	{
		private static IEnumerable<MethodBase> TargetMethods()
		{
			return (from method in AccessTools.GetDeclaredMethods(typeof(CollectionBinderFlipAnimCtrl))
				where method.ReturnType == typeof(void) && method.Name.StartsWith("SortBy")
				select method).Cast<MethodBase>();
		}

		private static bool Prefix(CollectionBinderFlipAnimCtrl __instance)
		{
			return Plugin.EnhancedBinderSort.OnSort(__instance);
		}
	}
}
namespace EnhancedQOL.Helpers
{
	public class CollectedCardsUtility
	{
		public class Builder
		{
			private CollectedCardsUtility m_CardSorter = new CollectedCardsUtility();

			public Builder WithSortType(ECollectionSortingType sortType)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				m_CardSorter.m_SortingType = sortType;
				return this;
			}

			public Builder WithExpansionType(ECardExpansionType expansionType)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				m_CardSorter.m_ExpansionType = expansionType;
				return this;
			}

			public Builder WithRarityType(ECardRaritySortType rarityType)
			{
				m_CardSorter.m_RarityType = rarityType;
				return this;
			}

			public Builder WithBorderType(ECardBorderSortType borderType)
			{
				m_CardSorter.m_BorderType = borderType;
				return this;
			}

			public Builder WithElementType(ECardElementSortType elementType)
			{
				m_CardSorter.m_ElementType = elementType;
				return this;
			}

			public Builder WithMinDupeCount(int minDupeCount)
			{
				m_CardSorter.m_MinDupeCount = minDupeCount;
				return this;
			}

			public CollectedCardsUtility Build()
			{
				return m_CardSorter;
			}
		}

		private int m_MinDupeCount;

		private ECollectionSortingType m_SortingType;

		private ECardExpansionType m_ExpansionType;

		private ECardRaritySortType m_RarityType;

		private ECardBorderSortType m_BorderType;

		private ECardElementSortType m_ElementType;

		public bool Sort(List<int> finalSortedCards)
		{
			//IL_0036: 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_020b: 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_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Invalid comparison between Unknown and I4
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Invalid comparison between Unknown and I4
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_016f: Invalid comparison between Unknown and I4
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Invalid comparison between Unknown and I4
			finalSortedCards.Clear();
			List<int> tempSortedCards = new List<int>(finalSortedCards.Capacity);
			int currentCardIndex = 0;
			foreach (EMonsterType shownMonster in InventoryBase.GetShownMonsterList(m_ExpansionType))
			{
				MonsterData monsterData = InventoryBase.GetMonsterData(shownMonster);
				for (int i = 0; i < CPlayerData.GetCardAmountPerMonsterType(m_ExpansionType, true); i++)
				{
					CardData cardData = CPlayerData.GetCardData(currentCardIndex, m_ExpansionType, (int)m_ExpansionType == 1);
					int cardCount = CPlayerData.GetCardAmount(cardData);
					int cardPrice = 0;
					if ((int)m_SortingType == 5)
					{
						if (cardCount == m_MinDupeCount)
						{
							cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 1f);
						}
						else if (cardCount > m_MinDupeCount)
						{
							cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100000f);
						}
					}
					else if ((int)m_SortingType == 6)
					{
						cardPrice = cardCount * Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100f);
					}
					else if (cardCount > 0)
					{
						cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100f);
					}
					if (CardMatchesFilters(monsterData, cardData))
					{
						ECollectionSortingType sortingType = m_SortingType;
						Action action = (((int)sortingType == 0) ? ((Action)delegate
						{
							finalSortedCards.Add(currentCardIndex);
						}) : (((int)sortingType == 1) ? ((Action)delegate
						{
							finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardCount), currentCardIndex);
						}) : (((int)sortingType != 7) ? ((Action)delegate
						{
							finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardPrice), currentCardIndex);
						}) : ((Action)delegate
						{
							finalSortedCards.Insert(tempSortedCards.AddAcending(cardCount), currentCardIndex);
						}))));
						action();
					}
					int num = currentCardIndex;
					currentCardIndex = num + 1;
				}
			}
			return false;
		}

		public Tuple<int, int> GetCardCount()
		{
			//IL_0007: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Invalid comparison between Unknown and I4
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			foreach (EMonsterType shownMonster in InventoryBase.GetShownMonsterList(m_ExpansionType))
			{
				MonsterData monsterData = InventoryBase.GetMonsterData(shownMonster);
				for (int i = 0; i < CPlayerData.GetCardAmountPerMonsterType(m_ExpansionType, true); i++)
				{
					CardData cardData = CPlayerData.GetCardData(num3, m_ExpansionType, (int)m_ExpansionType == 1);
					bool flag = CPlayerData.GetCardAmount(cardData) > 0;
					if (CardMatchesFilters(monsterData, cardData))
					{
						num++;
						if (flag)
						{
							num2++;
						}
					}
					num3++;
				}
			}
			return Tuple.Create(num2, num);
		}

		private bool CardMatchesFilters(MonsterData monsterData, CardData cardData)
		{
			//IL_0012: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Invalid comparison between Unknown and I4
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Invalid comparison between Unknown and I4
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Invalid comparison between Unknown and I4
			int num = ((m_ElementType != ECardElementSortType.None) ? ((int)m_ElementType) : ((int)monsterData.ElementIndex));
			int num2 = ((m_RarityType != ECardRaritySortType.None) ? ((int)m_RarityType) : ((int)monsterData.Rarity));
			int num3 = ((m_BorderType != ECardBorderSortType.None) ? ((int)m_BorderType) : ((int)cardData.GetCardBorderType()));
			if ((int)monsterData.ElementIndex == num && (int)monsterData.Rarity == num2)
			{
				return (int)cardData.GetCardBorderType() == num3;
			}
			return false;
		}

		private CollectedCardsUtility()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			m_SortingType = (ECollectionSortingType)0;
			m_ExpansionType = (ECardExpansionType)0;
			m_BorderType = ECardBorderSortType.None;
			m_ElementType = ECardElementSortType.None;
			m_RarityType = ECardRaritySortType.None;
			m_MinDupeCount = 1;
		}
	}
	public class HeldCardData
	{
		public int BinderPageIndex { get; set; }

		public int BinderCardSlotIndex { get; set; }

		public CardData CardData { get; set; }

		public Transform Transform { get; set; }
	}
	public class ReverseComparer<T> : Comparer<T>
	{
		public override int Compare(T x, T y)
		{
			return Comparer<T>.Default.Compare(y, x);
		}
	}
	public class SceneRaycaster : MonoBehaviour
	{
		private List<Type> m_ItemCompartmentTypeList = new List<Type>();

		private bool m_IsInitialized;

		public Component RaycastedComponent { get; private set; }

		private void Awake()
		{
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			m_ItemCompartmentTypeList.Add(typeof(InteractableCard3d));
			m_ItemCompartmentTypeList.Add(typeof(CardShelf));
			m_ItemCompartmentTypeList.Add(typeof(InteractableCardCompartment));
			m_ItemCompartmentTypeList.Add(typeof(InteractablePackagingBox_Item));
			m_ItemCompartmentTypeList.Add(typeof(ShelfCompartment));
			m_ItemCompartmentTypeList.Add(typeof(InteractableTrashBin));
			m_ItemCompartmentTypeList.Add(typeof(InteractableWorkbench));
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_ItemCompartmentTypeList.Clear();
				RaycastedComponent = null;
			}
		}

		private void FixedUpdate()
		{
			//IL_001a: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			Camera val = CSingleton<InteractionPlayerController>.Instance?.m_Cam;
			Ray val2 = default(Ray);
			((Ray)(ref val2))..ctor(((Component)val).transform.position, ((Component)val).transform.forward);
			int mask = LayerMask.GetMask(new string[4] { "UI", "Physics", "ItemCompartment", "ShopModel" });
			RaycastHit val3 = default(RaycastHit);
			RaycastedComponent = (Physics.Raycast(val2, ref val3, CSingleton<InteractionPlayerController>.Instance.m_RayDistance, mask) ? (from component in ((Component)((RaycastHit)(ref val3)).transform).gameObject.GetComponents<Component>()
				where m_ItemCompartmentTypeList.Contains(((object)component).GetType())
				select component).FirstOrDefault() : null);
		}

		public void OnBinderOpen()
		{
			RaycastedComponent = null;
			((Behaviour)this).enabled = false;
		}

		public void OnBinderClose()
		{
			((Behaviour)this).enabled = true;
		}
	}
}
namespace EnhancedQOL.Extensions
{
	public static class CardDataExt
	{
		public static bool IsOwned(this CardData cardData)
		{
			return CPlayerData.GetCardAmount(cardData) > 0;
		}

		public static CardData CopyFrom(this CardData target, CardData source)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//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)
			//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)
			target.monsterType = source.monsterType;
			target.isFoil = source.isFoil;
			target.borderType = source.borderType;
			target.isDestiny = source.isDestiny;
			target.expansionType = source.expansionType;
			return target;
		}
	}
	public static class CollectionBinderFlipAnimCtrlExt
	{
		public static ECollectionSortingType GetSortingType(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return (ECollectionSortingType)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortingType").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static int GetCurrentBinderPageIndex(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (int)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_Index").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static ECardExpansionType GetExpansionType(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			return (ECardExpansionType)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_ExpansionType").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static bool GetCanUpdateSort(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (bool)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_CanUpdateSort").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static List<int> GetSortedCardList(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (List<int>)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortedIndexList").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static List<int> GetTempSortedList(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (List<int>)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortTempList").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static bool IsBookOpen(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (bool)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_IsBookOpen").GetValue(collectionBinderFlipAnimCtrl);
		}

		public static int GetRaycastedCardIndex(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			return (int)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_CurrentRaycastedCardIndex").GetValue(collectionBinderFlipAnimCtrl);
		}
	}
	public static class EnumExt
	{
		public static T Next<T>(this T src) where T : struct
		{
			if (!typeof(T).IsEnum)
			{
				throw new ArgumentException("Argument " + typeof(T).FullName + " is not an Enum");
			}
			T[] array = (T[])Enum.GetValues(src.GetType());
			int num = Array.IndexOf(array, src) + 1;
			if (array.Length != num)
			{
				return array[num];
			}
			return array[0];
		}
	}
	public static class InteractionPlayerControllerExt
	{
		public static List<InteractableCard3d> GetHeldCards(this InteractionPlayerController playerController)
		{
			return (List<InteractableCard3d>)AccessTools.Field(typeof(InteractionPlayerController), "m_CurrentHoldingCard3dList").GetValue(playerController);
		}

		public static void SetHoldCardGroupTargetRotation(this InteractionPlayerController playerController, Quaternion value)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			AccessTools.Field(typeof(InteractionPlayerController), "m_HoldCardGrpTargetRotation").SetValue(playerController, value);
		}

		public static ShelfCompartment GetRaycastedItemCompartment(this InteractionPlayerController playerController)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return (ShelfCompartment)AccessTools.Field(typeof(InteractionPlayerController), "m_CurrentItemCompartment").GetValue(playerController);
		}

		public static InteractablePackagingBox_Item GetCurrentHeldBox(this InteractionPlayerController playerController)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Expected O, but got Unknown
			return (InteractablePackagingBox_Item)AccessTools.Field(typeof(InteractionPlayerController), "m_CurrentHoldingItemBox").GetValue(playerController);
		}

		public static List<Item> GetHeldItemList(this InteractionPlayerController playerController)
		{
			return (List<Item>)AccessTools.Field(typeof(InteractionPlayerController), "m_HoldItemList").GetValue(playerController);
		}

		public static void PutItemOnShelf(this InteractionPlayerController playerController)
		{
			AccessTools.Method(typeof(InteractionPlayerController), "EvaluatePutItemOnShelf", (Type[])null, (Type[])null).Invoke(playerController, null);
		}

		public static void TakeItemFromShelf(this InteractionPlayerController playerController)
		{
			AccessTools.Method(typeof(InteractionPlayerController), "EvaluateTakeItemFromShelf", (Type[])null, (Type[])null).Invoke(playerController, null);
		}
	}
	public static class ListExt
	{
		public static int AddSortedDecending<T>(this List<T> list, T item) where T : IComparable<T>
		{
			ReverseComparer<T> reverseComparer = new ReverseComparer<T>();
			if (list.Count == 0 || reverseComparer.Compare(list[list.Count - 1], item) <= 0)
			{
				list.Add(item);
				return list.Count - 1;
			}
			if (reverseComparer.Compare(list[0], item) >= 0)
			{
				list.Insert(0, item);
				return 0;
			}
			int num = list.BinarySearch(item, reverseComparer);
			if (num < 0)
			{
				num = ~num;
			}
			list.Insert(num, item);
			return num;
		}

		public static int AddAcending<T>(this List<T> list, T item) where T : IComparable<T>
		{
			if (list.Count == 0 || list[list.Count - 1].CompareTo(item) <= 0)
			{
				list.Add(item);
				return list.Count - 1;
			}
			if (list[0].CompareTo(item) >= 0)
			{
				list.Insert(0, item);
				return 0;
			}
			int num = list.BinarySearch(item);
			if (num < 0)
			{
				num = ~num;
			}
			list.Insert(num, item);
			return num;
		}
	}
	public static class StringExt
	{
		public static string AppendIf(this string value, bool expression, string append)
		{
			if (!expression)
			{
				return value;
			}
			return value + append;
		}
	}
	public static class TextMeshProUGUIExt
	{
		public static TextMeshProUGUI CopyFrom(this TextMeshProUGUI source, TextMeshProUGUI target)
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			((TMP_Text)source).font = ((target != null) ? ((TMP_Text)target).font : null);
			((TMP_Text)source).fontSharedMaterial = ((target != null) ? ((TMP_Text)target).fontSharedMaterial : null);
			((TMP_Text)source).fontMaterial = ((target != null) ? ((TMP_Text)target).fontMaterial : null);
			((TMP_Text)source).outlineWidth = ((TMP_Text)target).outlineWidth;
			((TMP_Text)source).fontSize = ((TMP_Text)target).fontSize;
			((TMP_Text)source).horizontalAlignment = ((TMP_Text)target).horizontalAlignment;
			((TMP_Text)source).verticalAlignment = ((TMP_Text)target).verticalAlignment;
			((TMP_Text)source).alignment = ((TMP_Text)target).alignment;
			((TMP_Text)source).richText = ((TMP_Text)target).richText;
			((TMP_Text)source).vertexBufferAutoSizeReduction = ((TMP_Text)target).vertexBufferAutoSizeReduction;
			((TMP_Text)source).extraPadding = ((TMP_Text)target).extraPadding;
			return source;
		}
	}
}
namespace EnhancedQOL.Binder
{
	public enum ECardBorderSortType
	{
		None = -1,
		Base,
		FirstEdition,
		Silver,
		Gold,
		Ex,
		FullArt
	}
	public enum ECardCountDisplayType
	{
		None = -1,
		CurrentRarityFiler,
		CurrentFilters,
		AllRarity
	}
	public enum ECardElementSortType
	{
		None = -1,
		Fire,
		Earth,
		Water,
		Wind
	}
	public enum ECardRaritySortType
	{
		None = -1,
		Common,
		Rare,
		Epic,
		Legendary
	}
	public class EnhancedBinderSort : MonoBehaviour
	{
		private int m_MinDupeCount;

		private ECardRaritySortType m_RaritySortingType = ECardRaritySortType.None;

		private ECardElementSortType m_ElementSortingType = ECardElementSortType.None;

		private ECardBorderSortType m_BorderSortingType = ECardBorderSortType.None;

		private KeyboardShortcut m_RaritySortFilterToggleShortcut;

		private KeyboardShortcut m_BorderSortFilterToggleShortcut;

		private KeyboardShortcut m_ElementSortFilterToggleShortcut;

		private KeyboardShortcut m_RaritySortFilterClearShortcut;

		private KeyboardShortcut m_BorderSortFilterClearShortcut;

		private KeyboardShortcut m_ElementSortFilterClearShortcut;

		private KeyboardShortcut m_AllSortFilterClearShortcut;

		public EnhancedBinderUIManager EnhancedBinderUIManager { get; private set; }

		private void Awake()
		{
			//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_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			m_MinDupeCount = Settings.Instance.minDupeCount.Value;
			m_RaritySortFilterToggleShortcut = Settings.Instance.raritySortFilterToggle.Value;
			m_BorderSortFilterToggleShortcut = Settings.Instance.borderSortFilterToggle.Value;
			m_ElementSortFilterToggleShortcut = Settings.Instance.elementSortFilterToggle.Value;
			m_RaritySortFilterClearShortcut = Settings.Instance.raritySortFilterClear.Value;
			m_BorderSortFilterClearShortcut = Settings.Instance.borderSortFilterClear.Value;
			m_ElementSortFilterClearShortcut = Settings.Instance.elementSortFilterClear.Value;
			m_AllSortFilterClearShortcut = Settings.Instance.allFilterClear.Value;
			Settings.Instance.isEnhancedBinderSortEnabled.SettingChanged += delegate
			{
				((Behaviour)this).enabled = Settings.Instance.isEnhancedBinderSortEnabled.Value;
				if (EnhancedBinderUIManager != null)
				{
					((Behaviour)EnhancedBinderUIManager).enabled = Settings.Instance.isEnhancedBinderSortEnabled.Value;
				}
				if (!Settings.Instance.isEnhancedQOLEnabled.Value && ((Behaviour)this).enabled)
				{
					Settings.Instance.isEnhancedQOLEnabled.Value = true;
				}
			};
			Settings.Instance.minDupeCount.SettingChanged += delegate
			{
				m_MinDupeCount = Settings.Instance.minDupeCount.Value;
			};
			Settings.Instance.raritySortFilterToggle.SettingChanged += delegate
			{
				//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)
				m_RaritySortFilterToggleShortcut = Settings.Instance.raritySortFilterToggle.Value;
			};
			Settings.Instance.borderSortFilterToggle.SettingChanged += delegate
			{
				//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)
				m_BorderSortFilterToggleShortcut = Settings.Instance.borderSortFilterToggle.Value;
			};
			Settings.Instance.elementSortFilterToggle.SettingChanged += delegate
			{
				//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)
				m_ElementSortFilterToggleShortcut = Settings.Instance.elementSortFilterToggle.Value;
			};
			Settings.Instance.raritySortFilterClear.SettingChanged += delegate
			{
				//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)
				m_RaritySortFilterClearShortcut = Settings.Instance.raritySortFilterClear.Value;
			};
			Settings.Instance.borderSortFilterClear.SettingChanged += delegate
			{
				//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)
				m_BorderSortFilterClearShortcut = Settings.Instance.borderSortFilterClear.Value;
			};
			Settings.Instance.elementSortFilterClear.SettingChanged += delegate
			{
				//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)
				m_ElementSortFilterClearShortcut = Settings.Instance.elementSortFilterClear.Value;
			};
			Settings.Instance.allFilterClear.SettingChanged += delegate
			{
				//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)
				m_AllSortFilterClearShortcut = Settings.Instance.allFilterClear.Value;
			};
		}

		public void OnEnable()
		{
			if (EnhancedBinderUIManager != null)
			{
				((Behaviour)EnhancedBinderUIManager).enabled = true;
			}
			if (EnhancedBinderUIManager == null)
			{
				EnhancedBinderUIManager enhancedBinderUIManager2 = (EnhancedBinderUIManager = ((Component)this).gameObject.AddComponent<EnhancedBinderUIManager>());
			}
		}

		public void OnDisable()
		{
			if (EnhancedBinderUIManager != null)
			{
				Plugin.Logger.LogError((object)(EnhancedBinderUIManager == null));
				((Behaviour)EnhancedBinderUIManager).enabled = false;
			}
		}

		public void OnCollectionBinderUIAwake(CollectionBinderUI instance)
		{
			((Behaviour)EnhancedBinderUIManager).enabled = true;
		}

		public void OnCollectionBinderFlipAnimCtrlUpdate(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl, bool isAlbumOpen)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Invalid comparison between Unknown and I4
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Invalid comparison between Unknown and I4
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected I4, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Expected I4, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Expected I4, but got Unknown
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected I4, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected I4, but got Unknown
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Expected I4, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected I4, but got Unknown
			if (!((Behaviour)this).enabled || !isAlbumOpen || (int)collectionBinderFlipAnimCtrl.GetExpansionType() == 2 || (int)collectionBinderFlipAnimCtrl.GetSortingType() == 3)
			{
				return;
			}
			if (CSingleton<InteractionPlayerController>.Instance.GetHeldCards().Count <= 0)
			{
				if (((KeyboardShortcut)(ref m_RaritySortFilterToggleShortcut)).IsDown())
				{
					m_RaritySortingType = m_RaritySortingType.Next();
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_BorderSortFilterToggleShortcut)).IsDown())
				{
					m_BorderSortingType = m_BorderSortingType.Next();
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_ElementSortFilterToggleShortcut)).IsDown())
				{
					m_ElementSortingType = m_ElementSortingType.Next();
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_AllSortFilterClearShortcut)).IsDown())
				{
					m_RaritySortingType = ECardRaritySortType.None;
					m_BorderSortingType = ECardBorderSortType.None;
					m_ElementSortingType = ECardElementSortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_BorderSortFilterClearShortcut)).IsDown())
				{
					m_BorderSortingType = ECardBorderSortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_ElementSortFilterClearShortcut)).IsDown())
				{
					m_ElementSortingType = ECardElementSortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
				else if (((KeyboardShortcut)(ref m_RaritySortFilterClearShortcut)).IsDown())
				{
					m_RaritySortingType = ECardRaritySortType.None;
					collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
				}
			}
			EnhancedBinderUIManager?.OnUpdate(m_RaritySortingType, m_BorderSortingType, m_ElementSortingType);
		}

		public bool OnSort(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Invalid comparison between Unknown and I4
			//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)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Invalid comparison between Unknown and I4
			bool flag = !((Behaviour)this).enabled || (int)collectionBinderFlipAnimCtrl.GetExpansionType() == 2;
			if (!flag)
			{
				ECollectionSortingType sortingType = collectionBinderFlipAnimCtrl.GetSortingType();
				Func<bool> func = (((int)sortingType == 3) ? ((Func<bool>)(() => true)) : (((int)sortingType != 4) ? ((Func<bool>)delegate
				{
					//IL_001d: Unknown result type (might be due to invalid IL or missing references)
					//IL_002d: Unknown result type (might be due to invalid IL or missing references)
					List<int> sortedCardList = collectionBinderFlipAnimCtrl.GetSortedCardList();
					new List<int>();
					return new CollectedCardsUtility.Builder().WithSortType(collectionBinderFlipAnimCtrl.GetSortingType()).WithExpansionType(collectionBinderFlipAnimCtrl.GetExpansionType()).WithRarityType(m_RaritySortingType)
						.WithElementType(m_ElementSortingType)
						.WithBorderType(m_BorderSortingType)
						.WithMinDupeCount(m_MinDupeCount)
						.Build()
						.Sort(sortedCardList);
				}) : ((Func<bool>)(() => true))));
				flag = func();
			}
			return flag;
		}

		public void OnBinderOpen(ECollectionSortingType sortingType, ECardExpansionType expansionType)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (((Behaviour)this).enabled)
			{
				EnhancedBinderUIManager?.OnCollectionBinderOpen(sortingType, expansionType, m_RaritySortingType, m_BorderSortingType, m_ElementSortingType);
			}
		}
	}
	public class EnhancedBinderUIManager : MonoBehaviour
	{
		private bool m_IsInitialized;

		private GameObject m_ScreenGrp;

		private TextMeshProUGUI m_CardsCollectedText;

		private TextMeshProUGUI m_TotalCollectionCountText;

		private TextMeshProUGUI m_RareCollectionCountText;

		private TextMeshProUGUI m_EpicCollectionCountText;

		private TextMeshProUGUI m_LegendaryCollectionCountText;

		private List<Tuple<int, int>> m_CardCounts = new List<Tuple<int, int>>();

		private ECardCountDisplayType m_CardCountDisplayType;

		private void Awake()
		{
			Settings.Instance.cardCountDisplayType.SettingChanged += delegate
			{
				m_CardCountDisplayType = Settings.Instance.cardCountDisplayType.Value;
				if (m_IsInitialized)
				{
					if (Settings.Instance.cardCountDisplayType.Value == ECardCountDisplayType.AllRarity)
					{
						((Behaviour)m_RareCollectionCountText).enabled = true;
						((Behaviour)m_EpicCollectionCountText).enabled = true;
						((Behaviour)m_LegendaryCollectionCountText).enabled = true;
					}
					else
					{
						((Behaviour)m_RareCollectionCountText).enabled = false;
						((Behaviour)m_EpicCollectionCountText).enabled = false;
						((Behaviour)m_LegendaryCollectionCountText).enabled = false;
					}
				}
			};
			Settings.Instance.commonCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_TotalCollectionCountText).transform.localPosition = Settings.Instance.commonCardCountPosition.Value;
			};
			Settings.Instance.commonCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_TotalCollectionCountText).fontSize = Settings.Instance.commonCardCountFontSize.Value;
			};
			Settings.Instance.rareCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_RareCollectionCountText).transform.localPosition = Settings.Instance.rareCardCountPosition.Value;
			};
			Settings.Instance.rareCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_RareCollectionCountText).fontSize = Settings.Instance.rareCardCountFontSize.Value;
			};
			Settings.Instance.epicCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_EpicCollectionCountText).transform.localPosition = Settings.Instance.epicCardCountPosition.Value;
			};
			Settings.Instance.epicCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_EpicCollectionCountText).fontSize = Settings.Instance.epicCardCountFontSize.Value;
			};
			Settings.Instance.legendaryCardCountPosition.SettingChanged += delegate
			{
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				((TMP_Text)m_LegendaryCollectionCountText).transform.localPosition = Settings.Instance.legendaryCardCountPosition.Value;
			};
			Settings.Instance.legendaryCardCountFontSize.SettingChanged += delegate
			{
				((TMP_Text)m_LegendaryCollectionCountText).fontSize = Settings.Instance.legendaryCardCountFontSize.Value;
			};
			m_IsInitialized = false;
			((Behaviour)this).enabled = false;
		}

		private void OnEnable()
		{
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: 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_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: Unknown result type (might be due to invalid IL or missing references)
			//IL_0270: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0318: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			if (!m_IsInitialized)
			{
				CollectionBinderUI val = Object.FindFirstObjectByType<CollectionBinderUI>();
				if (val != null)
				{
					m_ScreenGrp = val.m_ScreenGrp;
					if (m_CardsCollectedText == null)
					{
						m_CardsCollectedText = ((Component)m_ScreenGrp.transform.Find("AnimGrp/CardCollectedText")).GetComponent<TextMeshProUGUI>();
					}
					((TMP_Text)m_CardsCollectedText).enableAutoSizing = false;
					((TMP_Text)m_CardsCollectedText).fontSize = 30f;
					((TMP_Text)m_CardsCollectedText).rectTransform.sizeDelta = new Vector2(800f, 100f);
					if (m_TotalCollectionCountText == null)
					{
						m_TotalCollectionCountText = ((Component)m_ScreenGrp.transform.Find("AnimGrp/CardCollected")).GetComponent<TextMeshProUGUI>();
					}
					((TMP_Text)m_TotalCollectionCountText).transform.localPosition = Settings.Instance.commonCardCountPosition.Value;
					((TMP_Text)m_TotalCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_TotalCollectionCountText).fontSize = Settings.Instance.commonCardCountFontSize.Value;
					((TMP_Text)m_TotalCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 100f);
					if (m_RareCollectionCountText == null)
					{
						m_RareCollectionCountText = new GameObject().AddComponent<TextMeshProUGUI>().CopyFrom(m_TotalCollectionCountText);
					}
					((Object)((Component)m_RareCollectionCountText).gameObject).name = "RareCount";
					((TMP_Text)m_RareCollectionCountText).transform.SetParent(((Component)m_ScreenGrp.transform.Find("AnimGrp")).transform);
					((TMP_Text)m_RareCollectionCountText).transform.localPosition = Settings.Instance.rareCardCountPosition.Value;
					((TMP_Text)m_RareCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 20f);
					((TMP_Text)m_RareCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_RareCollectionCountText).fontSize = Settings.Instance.rareCardCountFontSize.Value;
					if (m_EpicCollectionCountText == null)
					{
						m_EpicCollectionCountText = new GameObject().AddComponent<TextMeshProUGUI>().CopyFrom(m_TotalCollectionCountText);
					}
					((Object)((Component)m_EpicCollectionCountText).gameObject).name = "EpicCount";
					((TMP_Text)m_EpicCollectionCountText).transform.SetParent(((Component)m_ScreenGrp.transform.Find("AnimGrp")).transform);
					((TMP_Text)m_EpicCollectionCountText).transform.localPosition = Settings.Instance.epicCardCountPosition.Value;
					((TMP_Text)m_EpicCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 20f);
					((TMP_Text)m_EpicCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_EpicCollectionCountText).fontSize = Settings.Instance.epicCardCountFontSize.Value;
					if (m_LegendaryCollectionCountText == null)
					{
						m_LegendaryCollectionCountText = new GameObject().AddComponent<TextMeshProUGUI>().CopyFrom(m_TotalCollectionCountText);
					}
					((Object)((Component)m_LegendaryCollectionCountText).gameObject).name = "LegendCount";
					((TMP_Text)m_LegendaryCollectionCountText).transform.SetParent(((Component)m_ScreenGrp.transform.Find("AnimGrp")).transform);
					((TMP_Text)m_LegendaryCollectionCountText).transform.localPosition = Settings.Instance.legendaryCardCountPosition.Value;
					((TMP_Text)m_LegendaryCollectionCountText).rectTransform.sizeDelta = new Vector2(800f, 20f);
					((TMP_Text)m_LegendaryCollectionCountText).enableAutoSizing = false;
					((TMP_Text)m_LegendaryCollectionCountText).fontSize = Settings.Instance.legendaryCardCountFontSize.Value;
					m_CardCountDisplayType = Settings.Instance.cardCountDisplayType.Value;
				}
			}
			m_IsInitialized = true;
		}

		private void OnDisable()
		{
			if (m_IsInitialized)
			{
				m_ScreenGrp = null;
				if (m_CardsCollectedText != null)
				{
					((TMP_Text)m_CardsCollectedText).enableAutoSizing = true;
					m_CardsCollectedText = null;
				}
				if (m_TotalCollectionCountText != null)
				{
					((TMP_Text)m_TotalCollectionCountText).enableAutoSizing = true;
					m_TotalCollectionCountText = null;
				}
				if (m_RareCollectionCountText != null)
				{
					Object.Destroy((Object)(object)m_RareCollectionCountText);
					m_RareCollectionCountText = null;
				}
				if (m_EpicCollectionCountText != null)
				{
					Object.Destroy((Object)(object)m_EpicCollectionCountText);
					m_EpicCollectionCountText = null;
				}
				if (m_LegendaryCollectionCountText != null)
				{
					Object.Destroy((Object)(object)m_LegendaryCollectionCountText);
					m_LegendaryCollectionCountText = null;
				}
				m_IsInitialized = false;
			}
		}

		public void OnUpdate(ECardRaritySortType raritySortingType, ECardBorderSortType borderSortingType, ECardElementSortType elementSortingType)
		{
			if (((Behaviour)this).enabled)
			{
				string text = "Cards Collected".AppendIf(raritySortingType != ECardRaritySortType.None, $" [{raritySortingType}]").AppendIf(borderSortingType != ECardBorderSortType.None, $" [{borderSortingType}]").AppendIf(elementSortingType != ECardElementSortType.None, $" [{elementSortingType}]");
				((TMP_Text)m_CardsCollectedText).SetText(text, true);
				if (m_CardCountDisplayType == ECardCountDisplayType.AllRarity)
				{
					((TMP_Text)m_TotalCollectionCountText).SetText($"Common: {m_CardCounts[0].Item1}/{m_CardCounts[0].Item2} ({Math.Round((float)m_CardCounts[0].Item1 / (float)m_CardCounts[0].Item2 * 100f, 1)}%)", true);
					((TMP_Text)m_RareCollectionCountText).SetText($"Rare: {m_CardCounts[1].Item1}/{m_CardCounts[1].Item2} ({Math.Round((float)m_CardCounts[1].Item1 / (float)m_CardCounts[1].Item2 * 100f, 1)}%)", true);
					((TMP_Text)m_EpicCollectionCountText).SetText($"Epic: {m_CardCounts[2].Item1}/{m_CardCounts[2].Item2} ({Math.Round((float)m_CardCounts[2].Item1 / (float)m_CardCounts[2].Item2 * 100f, 1)}%)", true);
					((TMP_Text)m_LegendaryCollectionCountText).SetText($"Legendary: {m_CardCounts[3].Item1}/{m_CardCounts[3].Item2} ({Math.Round((float)m_CardCounts[3].Item1 / (float)m_CardCounts[3].Item2 * 100f, 1)}%)", true);
				}
				else
				{
					((TMP_Text)m_TotalCollectionCountText).SetText($"Common: {m_CardCounts[0].Item1}/{m_CardCounts[0].Item2} ({Math.Round((float)m_CardCounts[0].Item1 / (float)m_CardCounts[0].Item2 * 100f, 1)}%)", true);
				}
			}
		}

		public void OnCollectionBinderOpen(ECollectionSortingType sortingType, ECardExpansionType expansionType, ECardRaritySortType raritySortingType, ECardBorderSortType borderSortingType, ECardElementSortType elementSortingType)
		{
			//IL_003a: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			m_CardCounts.Clear();
			switch (m_CardCountDisplayType)
			{
			case ECardCountDisplayType.None:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).Build()
					.GetCardCount());
				break;
			case ECardCountDisplayType.CurrentFilters:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(raritySortingType)
					.WithBorderType(borderSortingType)
					.WithElementType(elementSortingType)
					.Build()
					.GetCardCount());
				break;
			case ECardCountDisplayType.CurrentRarityFiler:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(raritySortingType)
					.Build()
					.GetCardCount());
				break;
			case ECardCountDisplayType.AllRarity:
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Common)
					.Build()
					.GetCardCount());
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Rare)
					.Build()
					.GetCardCount());
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Epic)
					.Build()
					.GetCardCount());
				m_CardCounts.Add(new CollectedCardsUtility.Builder().WithSortType(sortingType).WithExpansionType(expansionType).WithRarityType(ECardRaritySortType.Legendary)
					.Build()
					.GetCardCount());
				break;
			}
			while (m_CardCounts.Count != 4)
			{
				m_CardCounts.Add(new Tuple<int, int>(1, 1));
			}
		}
	}
}