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 EnhancedSortFilters.Extensions;
using EnhancedSortFilters.Util;
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("EnhancedSortFilters")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Enhanced Sort Filters")]
[assembly: AssemblyTitle("EnhancedSortFilters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
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 EnhancedSortFilters
{
public class EnhancedBinderSort : CSingleton<EnhancedBinderSort>
{
private int m_MinimumDuplicateCount;
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 ECardRaritySortType RaritySortingType { get; private set; } = ECardRaritySortType.None;
public ECardElementSortType ElementSortingType { get; private set; } = ECardElementSortType.None;
public ECardBorderSortType BorderSortingType { get; private set; } = ECardBorderSortType.None;
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_MinimumDuplicateCount = Settings.Instance.minimumDuplicateCount.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.isEnhancedSortFiltersEnabled.SettingChanged += delegate
{
((Behaviour)this).enabled = Settings.Instance.isEnhancedSortFiltersEnabled.Value;
};
Settings.Instance.minimumDuplicateCount.SettingChanged += delegate
{
m_MinimumDuplicateCount = Settings.Instance.minimumDuplicateCount.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 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())
{
RaritySortingType = RaritySortingType.Next();
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
else if (((KeyboardShortcut)(ref m_BorderSortFilterToggleShortcut)).IsDown())
{
BorderSortingType = BorderSortingType.Next();
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
else if (((KeyboardShortcut)(ref m_ElementSortFilterToggleShortcut)).IsDown())
{
ElementSortingType = ElementSortingType.Next();
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
else if (((KeyboardShortcut)(ref m_AllSortFilterClearShortcut)).IsDown())
{
RaritySortingType = ECardRaritySortType.None;
BorderSortingType = ECardBorderSortType.None;
ElementSortingType = ECardElementSortType.None;
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
else if (((KeyboardShortcut)(ref m_BorderSortFilterClearShortcut)).IsDown())
{
BorderSortingType = ECardBorderSortType.None;
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
else if (((KeyboardShortcut)(ref m_ElementSortFilterClearShortcut)).IsDown())
{
ElementSortingType = ECardElementSortType.None;
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
else if (((KeyboardShortcut)(ref m_RaritySortFilterClearShortcut)).IsDown())
{
RaritySortingType = ECardRaritySortType.None;
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
}
}
CSingleton<EnhancedBinderUI>.Instance.OnUpdate(collectionBinderFlipAnimCtrl, RaritySortingType, BorderSortingType, 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>)(() => SortBinder(collectionBinderFlipAnimCtrl))) : ((Func<bool>)(() => true))));
flag = func();
}
return flag;
}
public 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 = ((ElementSortingType != ECardElementSortType.None) ? ((int)ElementSortingType) : ((int)monsterData.ElementIndex));
int num2 = ((RaritySortingType != ECardRaritySortType.None) ? ((int)RaritySortingType) : ((int)monsterData.Rarity));
int num3 = ((BorderSortingType != ECardBorderSortType.None) ? ((int)BorderSortingType) : ((int)cardData.GetCardBorderType()));
if ((int)monsterData.ElementIndex == num && (int)monsterData.Rarity == num2)
{
return (int)cardData.GetCardBorderType() == num3;
}
return false;
}
private bool SortBinder(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
{
//IL_0030: 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_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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0221: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Invalid comparison between Unknown and I4
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Invalid comparison between Unknown and I4
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Invalid comparison between Unknown and I4
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Invalid comparison between Unknown and I4
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Invalid comparison between Unknown and I4
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Invalid comparison between Unknown and I4
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Invalid comparison between Unknown and I4
List<int> finalSortedCards = collectionBinderFlipAnimCtrl.GetSortedCardList();
List<int> tempSortedCards = new List<int>(finalSortedCards.Capacity);
ECardExpansionType expansionType = collectionBinderFlipAnimCtrl.GetExpansionType();
ECollectionSortingType sortingType = collectionBinderFlipAnimCtrl.GetSortingType();
finalSortedCards.Clear();
int currentCardIndex = 0;
foreach (EMonsterType shownMonster in InventoryBase.GetShownMonsterList(expansionType))
{
MonsterData monsterData = InventoryBase.GetMonsterData(shownMonster);
int num;
for (int i = 0; i < CPlayerData.GetCardAmountPerMonsterType(expansionType, true); num = currentCardIndex, currentCardIndex = num + 1, i++)
{
CardData cardData = CPlayerData.GetCardData(currentCardIndex, expansionType, (int)expansionType == 1);
int cardCount = CPlayerData.GetCardAmount(cardData);
int cardPrice = 0;
if ((int)sortingType == 5)
{
if (cardCount == m_MinimumDuplicateCount)
{
cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 1f);
}
else if (cardCount > m_MinimumDuplicateCount)
{
cardPrice = Mathf.RoundToInt(CPlayerData.GetCardMarketPrice(cardData) * 100000f);
}
}
else if ((int)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))
{
continue;
}
Action action;
if ((int)sortingType <= 1)
{
if ((int)sortingType != 0)
{
if ((int)sortingType != 1)
{
goto IL_01e5;
}
action = delegate
{
finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardCount), currentCardIndex);
};
}
else
{
action = delegate
{
finalSortedCards.Add(currentCardIndex);
};
}
}
else if ((int)sortingType != 5)
{
if ((int)sortingType != 7)
{
goto IL_01e5;
}
action = delegate
{
finalSortedCards.Insert(tempSortedCards.AddAcending(cardCount), currentCardIndex);
};
}
else
{
action = delegate
{
if (cardCount > m_MinimumDuplicateCount)
{
finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardPrice), currentCardIndex);
}
};
}
goto IL_01f4;
IL_01e5:
action = delegate
{
finalSortedCards.Insert(tempSortedCards.AddSortedDecending(cardPrice), currentCardIndex);
};
goto IL_01f4;
IL_01f4:
action();
}
}
return false;
}
}
public class EnhancedBinderUI : CSingleton<EnhancedBinderUI>
{
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 CardCount m_RarityFilterCount = new CardCount
{
Owned = 0,
Total = 0
};
private CardCount m_AllFilterCount = new CardCount
{
Owned = 0,
Total = 0
};
private CardCount m_CommonCount = new CardCount
{
Owned = 0,
Total = 0
};
private CardCount m_RareCount = new CardCount
{
Owned = 0,
Total = 0
};
private CardCount m_EpicCount = new CardCount
{
Owned = 0,
Total = 0
};
private CardCount m_LegendaryCount = new CardCount
{
Owned = 0,
Total = 0
};
private ECardCountDisplayType m_CardCountDisplayType;
private bool m_NeedsRecount;
public bool HasCollectionBinderUIAwaken { get; set; }
private void Awake()
{
Settings.Instance.isEnhancedSortFiltersEnabled.SettingChanged += delegate
{
((Behaviour)this).enabled = Settings.Instance.isEnhancedSortFiltersEnabled.Value;
};
Settings.Instance.cardCountDisplayType.SettingChanged += delegate
{
m_CardCountDisplayType = Settings.Instance.cardCountDisplayType.Value;
m_NeedsRecount = true;
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;
};
}
private void OnEnable()
{
if (HasCollectionBinderUIAwaken)
{
Initialize();
}
}
private void OnDisable()
{
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;
}
}
public void OnCollectionBinderUIAwake(CollectionBinderUI collectionBinderUI)
{
if (((Behaviour)this).enabled)
{
Initialize(collectionBinderUI);
}
HasCollectionBinderUIAwaken = true;
}
public void OnUpdate(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl, ECardRaritySortType raritySortingType, ECardBorderSortType borderSortingType, ECardElementSortType elementSortingType)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected I4, but got Unknown
if (((Behaviour)this).enabled)
{
if (m_NeedsRecount)
{
collectionBinderFlipAnimCtrl.OnPressSwitchSortingMethod((int)collectionBinderFlipAnimCtrl.GetSortingType());
m_NeedsRecount = false;
}
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);
(m_CardCountDisplayType switch
{
ECardCountDisplayType.AllRarity => delegate
{
((TMP_Text)m_TotalCollectionCountText).SetText($"Common: {m_CommonCount.Owned}/{m_CommonCount.Total} ({Math.Round((float)m_CommonCount.Owned / (float)m_CommonCount.Total * 100f, 1)}%)", true);
((TMP_Text)m_RareCollectionCountText).SetText($"Rare: {m_RareCount.Owned}/{m_RareCount.Total} ({Math.Round((float)m_RareCount.Owned / (float)m_RareCount.Total * 100f, 1)}%)", true);
((TMP_Text)m_EpicCollectionCountText).SetText($"Epic: {m_EpicCount.Owned}/{m_EpicCount.Total} ({Math.Round((float)m_EpicCount.Owned / (float)m_EpicCount.Total * 100f, 1)}%)", true);
((TMP_Text)m_LegendaryCollectionCountText).SetText($"Legendary: {m_LegendaryCount.Owned}/{m_LegendaryCount.Total} ({Math.Round((float)m_LegendaryCount.Owned / (float)m_LegendaryCount.Total * 100f, 1)}%)", true);
},
ECardCountDisplayType.CurrentFilters => delegate
{
if (raritySortingType != ECardRaritySortType.None || borderSortingType != ECardBorderSortType.None || elementSortingType != ECardElementSortType.None)
{
((TMP_Text)m_TotalCollectionCountText).SetText($"All Filters: {m_AllFilterCount.Owned}/{m_AllFilterCount.Total} ({Math.Round((float)m_AllFilterCount.Owned / (float)m_AllFilterCount.Total * 100f, 1)}%)", true);
}
},
ECardCountDisplayType.CurrentRarityFiler => delegate
{
if (raritySortingType != ECardRaritySortType.None)
{
((TMP_Text)m_TotalCollectionCountText).SetText($"{raritySortingType}: {m_RarityFilterCount.Owned}/{m_RarityFilterCount.Total} ({Math.Round((float)m_RarityFilterCount.Owned / (float)m_RarityFilterCount.Total * 100f, 1)}%)", true);
}
},
_ => delegate
{
},
})();
}
}
public void OnCollectionBinderOpen(CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
{
//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)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Invalid comparison between Unknown and I4
//IL_00d0: 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_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Expected I4, but got Unknown
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Invalid comparison between I4 and Unknown
collectionBinderFlipAnimCtrl.SetCanUpdateSort(true);
collectionBinderFlipAnimCtrl.GetSortingType();
ECardExpansionType expansionType = collectionBinderFlipAnimCtrl.GetExpansionType();
ECardRaritySortType raritySortingType = CSingleton<EnhancedBinderSort>.Instance.RaritySortingType;
_ = CSingleton<EnhancedBinderSort>.Instance.BorderSortingType;
_ = CSingleton<EnhancedBinderSort>.Instance.ElementSortingType;
m_CommonCount.Reset();
m_RareCount.Reset();
m_EpicCount.Reset();
m_LegendaryCount.Reset();
m_RarityFilterCount.Reset();
m_AllFilterCount.Reset();
int num = 0;
foreach (EMonsterType shownMonster in InventoryBase.GetShownMonsterList(expansionType))
{
MonsterData monsterData = InventoryBase.GetMonsterData(shownMonster);
for (int i = 0; i < CPlayerData.GetCardAmountPerMonsterType(expansionType, true); i++)
{
CardData cardData = CPlayerData.GetCardData(num, expansionType, (int)expansionType == 1);
bool cardOwned = CPlayerData.GetCardAmount(cardData) > 0;
ERarity rarity = monsterData.Rarity;
((int)rarity switch
{
0 => delegate
{
m_CommonCount.Total++;
if (cardOwned)
{
m_CommonCount.Owned++;
}
},
1 => delegate
{
m_RareCount.Total++;
if (cardOwned)
{
m_RareCount.Owned++;
}
},
2 => delegate
{
m_EpicCount.Total++;
if (cardOwned)
{
m_EpicCount.Owned++;
}
},
3 => delegate
{
m_LegendaryCount.Total++;
if (cardOwned)
{
m_LegendaryCount.Owned++;
}
},
_ => throw new NotImplementedException(),
})();
if (raritySortingType == (ECardRaritySortType)(int)monsterData.Rarity)
{
m_RarityFilterCount.Total++;
if (cardOwned)
{
m_RarityFilterCount.Owned++;
}
}
if (CSingleton<EnhancedBinderSort>.Instance.CardMatchesFilters(monsterData, cardData))
{
m_AllFilterCount.Total++;
if (cardOwned)
{
m_AllFilterCount.Owned++;
}
}
num++;
}
}
}
private void Initialize(CollectionBinderUI collectionBinderUI = null)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_017d: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Unknown result type (might be due to invalid IL or missing references)
//IL_029d: Unknown result type (might be due to invalid IL or missing references)
if (collectionBinderUI == null)
{
collectionBinderUI = Object.FindFirstObjectByType<CollectionBinderUI>();
}
m_ScreenGrp = collectionBinderUI.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;
}
}
[BepInPlugin("EnhancedSortFilters", "Enhanced Sort Filters", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
private readonly Harmony m_Harmony = new Harmony("EnhancedSortFilters");
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Settings.Instance.Load(this);
m_Harmony.PatchAll();
SceneManager.sceneLoaded += delegate(Scene scene, LoadSceneMode _)
{
if (((Scene)(ref scene)).name == "Start")
{
((Behaviour)CSingleton<EnhancedBinderSort>.Instance).enabled = Settings.Instance.isEnhancedSortFiltersEnabled.Value;
((Behaviour)CSingleton<EnhancedBinderUI>.Instance).enabled = Settings.Instance.isEnhancedSortFiltersEnabled.Value;
}
else
{
((Behaviour)CSingleton<EnhancedBinderSort>.Instance).enabled = false;
((Behaviour)CSingleton<EnhancedBinderUI>.Instance).enabled = false;
CSingleton<EnhancedBinderUI>.Instance.HasCollectionBinderUIAwaken = false;
}
};
Logger.LogInfo((object)"Plugin EnhancedSortFilters v:1.0.0 by GhostNarwhal is loaded!");
}
private void OnDestroy()
{
m_Harmony.UnpatchSelf();
Logger.LogInfo((object)"Plugin Enhanced Sort Filters is unloaded!");
}
}
public class Settings
{
public ConfigEntry<bool> isEnhancedSortFiltersEnabled;
public ConfigEntry<int> minimumDuplicateCount;
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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Expected O, but got Unknown
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Expected O, but got Unknown
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected O, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Expected O, but got Unknown
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Expected O, but got Unknown
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Expected O, but got Unknown
//IL_028f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Expected O, but got Unknown
//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Expected O, but got Unknown
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0356: Expected O, but got Unknown
//IL_0396: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Expected O, but got Unknown
//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Expected O, but got Unknown
//IL_0433: Unknown result type (might be due to invalid IL or missing references)
//IL_043d: Expected O, but got Unknown
//IL_0462: Unknown result type (might be due to invalid IL or missing references)
//IL_0487: Unknown result type (might be due to invalid IL or missing references)
//IL_0491: Expected O, but got Unknown
//IL_04d0: Unknown result type (might be due to invalid IL or missing references)
//IL_04da: Expected O, but got Unknown
//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Unknown result type (might be due to invalid IL or missing references)
//IL_052e: Expected O, but got Unknown
//IL_056d: Unknown result type (might be due to invalid IL or missing references)
//IL_0577: Expected O, but got Unknown
isEnhancedSortFiltersEnabled = ((BaseUnityPlugin)plugin).Config.Bind<bool>("1. Enhanced Sort Filters", "Enable", true, new ConfigDescription("Enables or disables Enhanced Sorting", (AcceptableValueBase)null, new object[1]
{
new ConfigurationManagerAttributes
{
Order = 20
}
}));
minimumDuplicateCount = ((BaseUnityPlugin)plugin).Config.Bind<int>("1. Enhanced Sort Filters", "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>("2. Shortcut Keys", "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>("2. Shortcut Keys", "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>("2. Shortcut Keys", "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>("2. Shortcut Keys", "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>("2. Shortcut Keys", "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>("2. Shortcut Keys", "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>("2. Shortcut Keys", "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>("1. Enhanced Sort Filters", "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>("3. UI", "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>("3. UI", "Common Card Count Display Font Size", 34, new ConfigDescription("Common card count text font size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 80), new object[1]
{
new ConfigurationManagerAttributes
{
Order = 9
}
}));
rareCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("3. UI", "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>("3. UI", "Rare Card Count Display Font Size", 34, new ConfigDescription("Rare card count text font size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 80), new object[1]
{
new ConfigurationManagerAttributes
{
Order = 7
}
}));
epicCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("3. UI", "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>("3. UI", "Epic Card Count Display Font Size", 34, new ConfigDescription("Epic card count text font size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 80), new object[1]
{
new ConfigurationManagerAttributes
{
Order = 5
}
}));
legendaryCardCountPosition = ((BaseUnityPlugin)plugin).Config.Bind<Vector3>("3. UI", "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>("3. UI", "Legendary Card Count Display Font Size", 34, new ConfigDescription("Legendary card count text font size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(8, 80), new object[1]
{
new ConfigurationManagerAttributes
{
Order = 3
}
}));
}
private Settings()
{
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "EnhancedSortFilters";
public const string PLUGIN_NAME = "Enhanced Sort Filters";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace EnhancedSortFilters.Util
{
public class CardCount
{
public int Owned { get; set; }
public int Total { get; set; }
public void Reset()
{
Owned = 0;
Total = 0;
}
}
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 ReverseComparer<T> : Comparer<T>
{
public override int Compare(T x, T y)
{
return Comparer<T>.Default.Compare(y, x);
}
}
}
namespace EnhancedSortFilters.Patches
{
[HarmonyPatch(typeof(CollectionBinderFlipAnimCtrl))]
public class CollectionBinderFlipAnimCtrlPatches
{
[HarmonyPatch("Update")]
[HarmonyPrefix]
private static void OnUpdatePrefix(CollectionBinderFlipAnimCtrl __instance, bool ___m_IsBookOpen)
{
CSingleton<EnhancedBinderSort>.Instance.OnCollectionBinderFlipAnimCtrlUpdate(__instance, ___m_IsBookOpen);
}
[HarmonyPatch("StartShowCardAlbum")]
[HarmonyPostfix]
private static void StartShowCardAlbumPostfix(CollectionBinderFlipAnimCtrl __instance)
{
CSingleton<EnhancedBinderUI>.Instance.OnCollectionBinderOpen(__instance);
}
}
[HarmonyPatch(typeof(CollectionBinderUI))]
public class CollectionBinderUIPatches
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void OnUpdate(CollectionBinderUI __instance)
{
CSingleton<EnhancedBinderUI>.Instance.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);
CSingleton<EnhancedBinderSort>.Instance.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 CSingleton<EnhancedBinderSort>.Instance.OnSort(__instance);
}
}
}
namespace EnhancedSortFilters.Extensions
{
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 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 List<int> GetSortedCardList(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
{
return (List<int>)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_SortedIndexList").GetValue(collectionBinderFlipAnimCtrl);
}
public static bool GetCanUpdateSort(this CollectionBinderFlipAnimCtrl collectionBinderFlipAnimCtrl)
{
return (bool)AccessTools.Field(typeof(CollectionBinderFlipAnimCtrl), "m_CanUpdateSort").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 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;
}
}
}