Decompiled source of BetterCards v1.3.7
plugins/BetterCards.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Nosebleed.Pancake.GameConfig; using Nosebleed.Pancake.GameLogic; using Nosebleed.Pancake.Modal; using Nosebleed.Pancake.Models; using Nosebleed.Pancake.View; using Nosebleed.SaveLoadSystem; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("BetterCards")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7ef80f2a5d15a91f9f1d14ff34a10f3361146e28")] [assembly: AssemblyProduct("BetterCards")] [assembly: AssemblyTitle("BetterCards")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace BetterCards; [BepInPlugin("com.tovak.vc.bettercards", "BetterCards", "1.3.7")] public class Plugin : BasePlugin { internal static ManualLogSource Log; internal static string CurrentLangCode = ""; internal static bool LocaleRebuildPending = false; internal static ConfigEntry<bool> CardLockEnabled; public override void Load() { //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_0040: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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) //IL_00b3: 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_00d3: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown Log = ((BasePlugin)this).Log; CardLockEnabled = ((BasePlugin)this).Config.Bind<bool>("CardLock", "Enabled", true, "Right-click any card, press numpad '.', or press gamepad Select/Back to lock it (golden padlock). Locked cards can't be played accidentally — useful for keeping Destruction cards alive until fusion."); ClassInjector.RegisterTypeInIl2Cpp<ComboObserver>(); GameObject val = new GameObject("BetterCards"); Object.DontDestroyOnLoad((Object)val); val.AddComponent<ComboObserver>(); try { Locale selectedLocale = LocalizationSettings.SelectedLocale; if ((Object)(object)selectedLocale != (Object)null) { CurrentLangCode = (selectedLocale.Identifier.Code ?? "").ToLowerInvariant(); } } catch { } bool flag = default(bool); try { Harmony val2 = new Harmony("com.tovak.vc.bettercards"); val2.PatchAll(typeof(LocalePatch)); val2.PatchAll(typeof(PlayerModel_AreAnyCardsInHandPlayable_Patch)); val2.PatchAll(typeof(PlayerModel_TryPlayCard_Patch)); val2.PatchAll(typeof(PlayerModel_SimplePlayCard_Patch)); val2.PatchAll(typeof(CardModel_TryEvolveCard_Patch)); val2.PatchAll(typeof(PlayerModel_OnCardEvolved_Patch)); val2.PatchAll(typeof(PlayableCard_TryPlayCard_Patch)); val2.PatchAll(typeof(PlayableCard_OnCardPlayRequested_Patch)); int num = val2.GetPatchedMethods().Count(); ManualLogSource log = Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] Harmony patches actifs : "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num); } log.LogInfo(val3); } catch (Exception ex) { ManualLogSource log2 = Log; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[BetterCards] harmony error: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } log2.LogWarning(val4); } Log.LogInfo((object)"BetterCards chargé !"); } } [HarmonyPatch(typeof(LocalizationSettings), "SetSelectedLocale")] public static class LocalePatch { public static void Postfix(Locale locale) { try { string text = ""; if ((Object)(object)locale != (Object)null) { text = (locale.Identifier.Code ?? "").ToLowerInvariant(); } if (text != Plugin.CurrentLangCode) { Plugin.CurrentLangCode = text; Plugin.LocaleRebuildPending = true; } } catch { } } } [HarmonyPatch(typeof(PlayerModel), "CanAffordCard")] public static class PlayerModel_CanAffordCard_Patch { public static void Postfix(CardModel cardModel, ref bool __result) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown try { if (__result && Plugin.CardLockEnabled != null && Plugin.CardLockEnabled.Value && (Object)(object)cardModel != (Object)null && ComboObserver.IsLocked(cardModel)) { __result = false; } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] CanAffordCard patch err: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } } [HarmonyPatch(typeof(PlayerModel), "AreAnyCardsInHandPlayable")] public static class PlayerModel_AreAnyCardsInHandPlayable_Patch { public static void Postfix(PlayerModel __instance, ref bool __result) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown try { if (!__result || Plugin.CardLockEnabled == null || !Plugin.CardLockEnabled.Value || (Object)(object)__instance == (Object)null) { return; } HandPileModel handPile = __instance.HandPile; object obj; if (handPile == null) { obj = null; } else { CardPileModel cardPile = handPile.CardPile; obj = ((cardPile != null) ? cardPile._cards : null); } List<CardModel> val = (List<CardModel>)obj; if (val == null) { return; } int count = val.Count; for (int i = 0; i < count; i++) { CardModel val2 = val[i]; if (!((Object)(object)val2 == (Object)null) && !ComboObserver.IsLocked(val2) && __instance.CanAffordCard(val2)) { return; } } __result = false; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(48, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] AreAnyCardsInHandPlayable patch err: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log.LogWarning(val3); } } } [HarmonyPatch(typeof(PlayerModel), "TryPlayCard", new Type[] { typeof(CardModel), typeof(bool) })] public static class PlayerModel_TryPlayCard_Patch { private static bool _firstHitLogged; public static bool Prefix(CardModel cardModel, bool isAutoPlay, ref bool __result) { //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown try { if (!_firstHitLogged) { _firstHitLogged = true; string lockKey = ComboObserver.GetLockKey(cardModel); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(75, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] PlayerModel.TryPlayCard prefix actif (guid="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lockKey ?? "null"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", autoPlay="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(isAutoPlay); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", locked="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(ComboObserver.IsLocked(cardModel)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } log.LogInfo(val); } if (Plugin.CardLockEnabled == null || !Plugin.CardLockEnabled.Value) { return true; } if ((Object)(object)cardModel == (Object)null) { return true; } if (!ComboObserver.IsLocked(cardModel)) { return true; } ComboObserver.PlayBlockedFeedback(null); __result = false; return false; } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; bool flag2 = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(46, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[CardLock] PlayerModel.TryPlayCard patch err: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log2.LogWarning(val2); return true; } } } [HarmonyPatch(typeof(PlayableCard), "TryPlayCard")] public static class PlayableCard_TryPlayCard_Patch { private static bool _firstFireLogged; public static void Postfix(PlayableCard __instance) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown bool flag2 = default(bool); try { CardModel val = ((__instance != null) ? __instance._cardModel : null); bool flag = ComboObserver.IsLocked(val); if (!_firstFireLogged) { _firstFireLogged = true; ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[CardLock] TryPlayCard 1st fire (locked="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(flag); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")"); } log.LogInfo(val2); } if (Plugin.CardLockEnabled != null && Plugin.CardLockEnabled.Value && !((Object)(object)val == (Object)null) && flag) { ComboObserver.PlayBlockedFeedback(__instance); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(28, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] TryPlayCard err: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log2.LogWarning(val3); } } } [HarmonyPatch(typeof(PlayableCard), "OnCardPlayRequested")] public static class PlayableCard_OnCardPlayRequested_Patch { private static bool _firstFireLogged; public static void Postfix(PlayableCard __instance) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown bool flag2 = default(bool); try { CardModel val = ((__instance != null) ? __instance._cardModel : null); bool flag = ComboObserver.IsLocked(val); if (!_firstFireLogged) { _firstFireLogged = true; ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(49, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[CardLock] OnCardPlayRequested 1st fire (locked="); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<bool>(flag); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")"); } log.LogInfo(val2); } if (Plugin.CardLockEnabled != null && Plugin.CardLockEnabled.Value && !((Object)(object)val == (Object)null) && flag) { ComboObserver.PlayBlockedFeedback(__instance); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] OnCardPlayRequested err: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log2.LogWarning(val3); } } } [HarmonyPatch(typeof(PlayerModel), "SimplePlayCard")] public static class PlayerModel_SimplePlayCard_Patch { private static bool _firstHitLogged; public static bool Prefix(CardModel cardModel) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown try { if (!_firstHitLogged) { _firstHitLogged = true; Plugin.Log.LogInfo((object)"[CardLock] PlayerModel.SimplePlayCard prefix actif"); } if (Plugin.CardLockEnabled == null || !Plugin.CardLockEnabled.Value) { return true; } if ((Object)(object)cardModel == (Object)null) { return true; } if (!ComboObserver.IsLocked(cardModel)) { return true; } ComboObserver.PlayBlockedFeedback(null); return false; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] SimplePlayCard err: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); return true; } } } [HarmonyPatch(typeof(CardModel), "TryEvolveCard")] public static class CardModel_TryEvolveCard_Patch { public static void Postfix(CardModel __instance, bool __result) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown try { if (Plugin.CardLockEnabled != null && Plugin.CardLockEnabled.Value && __result) { ComboObserver.RemoveLockForCard(__instance, "TryEvolveCard"); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] TryEvolveCard patch err: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } } [HarmonyPatch(typeof(PlayerModel), "OnCardEvolved")] public static class PlayerModel_OnCardEvolved_Patch { public static void Postfix(PlayerModel __instance) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown try { if (Plugin.CardLockEnabled != null && Plugin.CardLockEnabled.Value) { ComboObserver.PruneInvalidOrTransferredLocks(__instance, "OnCardEvolved"); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] OnCardEvolved patch err: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } } public class ComboObserver : MonoBehaviour { internal class LockPopAnim { public Transform badge; public CanvasGroup cg; public float startTime; } internal class AnimBadge { public Transform ring; public Transform shine; } private bool _wasOpen; private string _lastCardSignature = ""; private ChooseCardModal _cachedModal; private int _searchCooldown; private PlayerModel _cachedPlayerModel; private int _lockPruneCooldown; private static HashSet<string> _allKnownNorms; private static HashSet<string> _allCompRefs; private const string BadgeName = "VCComboBadge"; private static Sprite _ringSpriteRainbow; private static Sprite _ringSpriteSilver; private static Sprite _evoTextSprite; private static Sprite _shineSprite; private static Sprite _checkmarkSprite; private const string CountBadgeName = "VCCountBadge"; private static Sprite _newBadgeSprite; private static readonly Sprite[] _countBadgeCache = (Sprite[])(object)new Sprite[10]; private static readonly byte[][][] GlyphsNEW = new byte[3][][] { new byte[7][] { new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 1, 0, 0, 1 }, new byte[5] { 1, 1, 0, 0, 1 }, new byte[5] { 1, 0, 1, 0, 1 }, new byte[5] { 1, 0, 0, 1, 1 }, new byte[5] { 1, 0, 0, 1, 1 }, new byte[5] { 1, 0, 0, 0, 1 } }, new byte[7][] { new byte[5] { 1, 1, 1, 1, 1 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 1, 1, 1, 0 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 1, 1, 1, 1 } }, new byte[7][] { new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 1, 0, 1 }, new byte[5] { 1, 0, 1, 0, 1 }, new byte[5] { 0, 1, 0, 1, 0 }, new byte[5] { 0, 1, 0, 1, 0 } } }; private static readonly byte[][] GlyphTimes = new byte[3][] { new byte[3] { 1, 0, 1 }, new byte[3] { 0, 1, 0 }, new byte[3] { 1, 0, 1 } }; private static readonly byte[][][] GlyphsDigits = new byte[10][][] { new byte[5][] { new byte[3] { 0, 1, 0 }, new byte[3] { 1, 0, 1 }, new byte[3] { 1, 0, 1 }, new byte[3] { 1, 0, 1 }, new byte[3] { 0, 1, 0 } }, new byte[5][] { new byte[3] { 0, 1, 0 }, new byte[3] { 1, 1, 0 }, new byte[3] { 0, 1, 0 }, new byte[3] { 0, 1, 0 }, new byte[3] { 1, 1, 1 } }, new byte[5][] { new byte[3] { 1, 1, 0 }, new byte[3] { 0, 0, 1 }, new byte[3] { 0, 1, 0 }, new byte[3] { 1, 0, 0 }, new byte[3] { 1, 1, 1 } }, new byte[5][] { new byte[3] { 1, 1, 0 }, new byte[3] { 0, 0, 1 }, new byte[3] { 0, 1, 0 }, new byte[3] { 0, 0, 1 }, new byte[3] { 1, 1, 0 } }, new byte[5][] { new byte[3] { 1, 0, 1 }, new byte[3] { 1, 0, 1 }, new byte[3] { 1, 1, 1 }, new byte[3] { 0, 0, 1 }, new byte[3] { 0, 0, 1 } }, new byte[5][] { new byte[3] { 1, 1, 1 }, new byte[3] { 1, 0, 0 }, new byte[3] { 1, 1, 0 }, new byte[3] { 0, 0, 1 }, new byte[3] { 1, 1, 0 } }, new byte[5][] { new byte[3] { 0, 1, 1 }, new byte[3] { 1, 0, 0 }, new byte[3] { 1, 1, 0 }, new byte[3] { 1, 0, 1 }, new byte[3] { 0, 1, 0 } }, new byte[5][] { new byte[3] { 1, 1, 1 }, new byte[3] { 0, 0, 1 }, new byte[3] { 0, 1, 0 }, new byte[3] { 0, 1, 0 }, new byte[3] { 0, 1, 0 } }, new byte[5][] { new byte[3] { 0, 1, 0 }, new byte[3] { 1, 0, 1 }, new byte[3] { 0, 1, 0 }, new byte[3] { 1, 0, 1 }, new byte[3] { 0, 1, 0 } }, new byte[5][] { new byte[3] { 0, 1, 0 }, new byte[3] { 1, 0, 1 }, new byte[3] { 0, 1, 1 }, new byte[3] { 0, 0, 1 }, new byte[3] { 0, 1, 0 } } }; internal static readonly HashSet<string> _lockedCardKeys = new HashSet<string>(); internal static readonly Dictionary<string, string> _lockedKeyConfigs = new Dictionary<string, string>(); private const string LockBadgeName = "BC_LockBadge"; private const string LockDimOverlayName = "BC_LockDimOverlay"; private int _lockBadgeScanCooldown; private static Sprite _lockBadgeSprite; private static AudioSource _audioSource; private static AudioClip _clipLock; private static AudioClip _clipUnlock; private static AudioClip _clipBlocked; private static bool _assetsLoaded = false; private static Sprite _goldenDiscSprite; internal static readonly HashSet<string> _lockedConfigsCache = new HashSet<string>(); internal static bool _lockedConfigsCacheDirty = true; private static readonly List<string> _matchingGuidsBuf = new List<string>(); private int _autoEndPollCooldown; private bool _autoEndDone; private static float _lastBlockedFeedbackTime = -10f; private static bool _prevSpaceP; private static bool _prevEnterP; private static bool _prevNumEnterP; private static bool _firstBadgeLogged = false; internal static readonly List<LockPopAnim> _lockPopAnims = new List<LockPopAnim>(); private const float LOCK_POP_DURATION = 0.25f; private const float LOCK_POP_START_SCALE = 1.6f; private static bool _firstScanLogged = false; private static bool _firstRightClickLogged = false; internal static readonly List<AnimBadge> _animBadges = new List<AnimBadge>(); public ComboObserver(IntPtr ptr) : base(ptr) { } public void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown try { EnsureAssetsLoaded(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] Awake error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } private static string GetCardSignature(ChooseCardModal modal) { List<CardChoiceView> cardChoiceViews = modal._cardChoiceViews; if (cardChoiceViews == null) { return ""; } StringBuilder stringBuilder = new StringBuilder(); Enumerator<CardChoiceView> enumerator = cardChoiceViews.GetEnumerator(); while (enumerator.MoveNext()) { CardChoiceView current = enumerator.Current; object obj; if (current == null) { obj = null; } else { CardConfig cardConfig = current.CardConfig; obj = ((cardConfig != null) ? ((Object)cardConfig).name : null); } if (obj == null) { obj = "null"; } stringBuilder.Append((string?)obj).Append("|"); } return stringBuilder.ToString(); } public void Update() { //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) HandleRightClickToggle(); HandleKeyboardLockedFeedback(); CheckLockIntegrity(); ScanAndUpdateLockBadges(); TickLockPopAnims(); CheckAutoEndTurn(); if (_animBadges.Count > 0) { float unscaledTime = Time.unscaledTime; float num = unscaledTime * 35f % 360f; float num2 = unscaledTime * -120f % 360f; for (int num3 = _animBadges.Count - 1; num3 >= 0; num3--) { AnimBadge animBadge = _animBadges[num3]; if (animBadge == null || (Object)(object)animBadge.ring == (Object)null) { _animBadges.RemoveAt(num3); } else { try { animBadge.ring.localEulerAngles = new Vector3(0f, 0f, num); if ((Object)(object)animBadge.shine != (Object)null) { animBadge.shine.localEulerAngles = new Vector3(0f, 0f, num2); } } catch { _animBadges.RemoveAt(num3); } } } } if ((Object)(object)_cachedModal == (Object)null) { if (--_searchCooldown > 0) { return; } _searchCooldown = 20; _cachedModal = Object.FindObjectOfType<ChooseCardModal>(); } ChooseCardModal cachedModal = _cachedModal; bool flag = (Object)(object)cachedModal != (Object)null && ((Modal)cachedModal).IsOpen; if (flag) { string cardSignature = GetCardSignature(cachedModal); if (!_wasOpen || cardSignature != _lastCardSignature) { _lastCardSignature = cardSignature; OnModalOpened(cachedModal); } } else { _lastCardSignature = ""; if (_wasOpen) { _cachedModal = null; } } _wasOpen = flag; } private static Transform FindNamedChild(Transform t, string name, int maxDepth = 5) { if (maxDepth <= 0) { return null; } for (int i = 0; i < t.childCount; i++) { Transform child = t.GetChild(i); if (((Object)child).name == name) { return child; } Transform val = FindNamedChild(child, name, maxDepth - 1); if ((Object)(object)val != (Object)null) { return val; } } return null; } private void OnModalOpened(ChooseCardModal modal) { //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Expected O, but got Unknown try { PlayerModel playerModel = modal._playerModel; if ((Object)(object)playerModel == (Object)null) { return; } _cachedPlayerModel = playerModel; List<CardChoiceView> cardChoiceViews = modal._cardChoiceViews; if (cardChoiceViews == null) { return; } Dictionary<string, int> dictionary = new Dictionary<string, int>(); List<CardConfig> list = new List<CardConfig>(); List<CardModel> allCards = playerModel._allCards; if (allCards != null) { Enumerator<CardModel> enumerator = allCards.GetEnumerator(); while (enumerator.MoveNext()) { CardModel current = enumerator.Current; CardConfig val = ((current != null) ? current.CardConfig : null); if (!((Object)(object)val == (Object)null)) { if (((Object)val).name != null) { string baseKey = GetBaseKey(((Object)val).name); dictionary[baseKey] = ((!dictionary.TryGetValue(baseKey, out var value)) ? 1 : (value + 1)); } list.Add(val); } } } Enumerator<CardChoiceView> enumerator2 = cardChoiceViews.GetEnumerator(); while (enumerator2.MoveNext()) { CardChoiceView current2 = enumerator2.Current; if (!((Object)(object)current2 == (Object)null)) { Transform tweenContainer = GetTweenContainer(((Component)current2).gameObject); Transform val2 = tweenContainer.Find("VCComboBadge"); if ((Object)(object)val2 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val2).gameObject); } Transform val3 = tweenContainer.Find("VCCountBadge"); if ((Object)(object)val3 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val3).gameObject); } } } enumerator2 = cardChoiceViews.GetEnumerator(); while (enumerator2.MoveNext()) { CardChoiceView current3 = enumerator2.Current; if ((Object)(object)current3 == (Object)null) { continue; } CardConfig cardConfig = current3.CardConfig; if ((Object)(object)cardConfig == (Object)null) { continue; } string text = ((((Object)cardConfig).name != null) ? GetBaseKey(((Object)cardConfig).name) : ""); int value2; int count = ((text.Length > 0 && dictionary.TryGetValue(text, out value2)) ? value2 : 0); AddCountBadge(((Component)current3).gameObject, count); if (((Object)cardConfig).name != null) { var (flag, evoName, isRedundant) = CheckCombo(cardConfig, list); if (flag) { AddBadge(((Component)current3).gameObject, evoName, isRedundant); } } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(17, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[ComboIndicator] "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<Exception>(ex); } log.LogError(val4); } } private static string[] ParseComponents(string desc) { if (string.IsNullOrEmpty(desc)) { return Array.Empty<string>(); } int num = desc.IndexOf(':'); if (num < 0) { return Array.Empty<string>(); } return (from s in desc.Substring(num + 1).Replace(".", "").Split(',') select s.Trim() into s where s.Length > 0 select s).ToArray(); } private static string Norm(string s) { return new string(s.ToLowerInvariant().Where(char.IsLetter).ToArray()); } private static string GetBaseName(string assetName) { if (string.IsNullOrEmpty(assetName)) { return ""; } string[] array = assetName.Split('_'); if (array.Length < 4) { return Norm(assetName); } return Norm(string.Join("", array.Skip(3))); } private static string GetBaseKey(string assetName) { if (string.IsNullOrEmpty(assetName)) { return ""; } string[] array = assetName.Split('_'); if (array.Length >= 4) { return array[1].ToLowerInvariant() + "_" + array[2] + "_" + Norm(string.Join("", array.Skip(3))); } return Norm(assetName); } private static bool CardMatchesComp(CardConfig card, string compNorm) { if (compNorm.Length == 0) { return false; } if (((Object)card).name != null && GetBaseName(((Object)card).name) == compNorm) { return true; } if (card.Name != null && Norm(card.Name) == compNorm) { return true; } return false; } private static bool OwnsComp(string compName, List<CardConfig> owned) { string text = Norm(compName); if (text.Length == 0) { return false; } foreach (CardConfig item in owned) { if ((Object)(object)item != (Object)null && CardMatchesComp(item, text)) { return true; } } return false; } public static void InvalidateCardIndices() { _allKnownNorms = null; _allCompRefs = null; } private static void EnsureCardIndices() { //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown if (_allKnownNorms != null && _allCompRefs != null) { return; } HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); HashSet<string> hashSet2 = new HashSet<string>(StringComparer.Ordinal); try { foreach (CardConfig item in Resources.FindObjectsOfTypeAll<CardConfig>()) { if ((Object)(object)item == (Object)null) { continue; } if (!string.IsNullOrEmpty(((Object)item).name)) { string baseName = GetBaseName(((Object)item).name); if (baseName.Length > 0) { hashSet.Add(baseName); } } try { string name = item.Name; if (!string.IsNullOrEmpty(name)) { string text = Norm(name); if (text.Length > 0) { hashSet.Add(text); } } } catch { } try { if (!item.HasEvolution) { continue; } string evolveRequirementDescription = item.GetEvolveRequirementDescription(); if (string.IsNullOrEmpty(evolveRequirementDescription)) { continue; } string[] array = ParseComponents(evolveRequirementDescription); for (int i = 0; i < array.Length; i++) { string text2 = Norm(array[i]); if (text2.Length > 0) { hashSet2.Add(text2); } } } catch { } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ComboIndicator] EnsureCardIndices: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } _allKnownNorms = hashSet; _allCompRefs = hashSet2; } private static bool IsKnownCompName(string norm) { if (norm.Length > 0 && _allKnownNorms != null) { return _allKnownNorms.Contains(norm); } return false; } private static bool IsCardReferencedAsComp(CardConfig c) { if ((Object)(object)c == (Object)null || _allCompRefs == null) { return false; } if (!string.IsNullOrEmpty(((Object)c).name)) { string baseName = GetBaseName(((Object)c).name); if (baseName.Length > 0 && _allCompRefs.Contains(baseName)) { return true; } } try { string name = c.Name; if (!string.IsNullOrEmpty(name)) { string text = Norm(name); if (text.Length > 0 && _allCompRefs.Contains(text)) { return true; } } } catch { } return false; } private static HashSet<CardConfig> TryAssignComps(string[] comps, List<CardConfig> pool, CardConfig targetEvolved) { HashSet<CardConfig> hashSet = new HashSet<CardConfig>(); List<int> list = new List<int>(); int num = 0; for (int i = 0; i < comps.Length; i++) { string text = Norm(comps[i]); if (text.Length == 0) { continue; } CardConfig val = null; foreach (CardConfig item in pool) { if (!((Object)(object)item == (Object)null) && !hashSet.Contains(item) && CardMatchesComp(item, text)) { val = item; break; } } if ((Object)(object)val != (Object)null) { hashSet.Add(val); num++; continue; } if (IsKnownCompName(text)) { return null; } list.Add(i); } if (list.Count > 0 && num == 0) { return null; } if (list.Count > 0 && (Object)(object)targetEvolved == (Object)null) { return null; } foreach (int item2 in list) { string orphanNorm = Norm(comps[item2]); CardConfig val2 = null; foreach (CardConfig item3 in pool) { if ((Object)(object)item3 == (Object)null || hashSet.Contains(item3)) { continue; } bool flag = false; for (int j = 0; j < comps.Length; j++) { string text2 = Norm(comps[j]); if (text2.Length > 0 && CardMatchesComp(item3, text2)) { flag = true; break; } } if (!flag) { bool flag2 = false; if (SameEvolutionTarget(item3, targetEvolved)) { flag2 = true; } else if (IsAllowedOrphanComponentFallback(item3, orphanNorm)) { flag2 = true; } if (flag2) { val2 = item3; break; } } } if ((Object)(object)val2 == (Object)null) { return null; } hashSet.Add(val2); } return hashSet; } private static bool SameEvolutionTarget(CardConfig c, CardConfig target) { if ((Object)(object)c == (Object)null || (Object)(object)target == (Object)null) { return false; } try { if (!c.HasEvolution) { return false; } CardConfig evolvedCardConfig = c.EvolvedCardConfig; if ((Object)(object)evolvedCardConfig == (Object)null) { return false; } if (Object.ReferenceEquals((Object)(object)evolvedCardConfig, (Object)(object)target)) { return true; } return ((Object)evolvedCardConfig).name == ((Object)target).name; } catch { return false; } } private static bool IsAllowedOrphanComponentFallback(CardConfig c, string orphanNorm) { if ((Object)(object)c == (Object)null || string.IsNullOrEmpty(orphanNorm)) { return false; } if (orphanNorm != "tirimasu" && orphanNorm != "tiramisu") { return false; } try { if (c.HasEvolution) { return false; } } catch { } if (!string.IsNullOrEmpty(((Object)c).name)) { string baseName = GetBaseName(((Object)c).name); if (baseName == "tirajisu" || baseName == "tiragisu") { return true; } } try { string name = c.Name; if (!string.IsNullOrEmpty(name)) { string text = Norm(name); if (text == "tirajisu" || text == "tiragisu") { return true; } } } catch { } return false; } private static (bool hasCombo, string evoName, bool isRedundant) CheckCombo(CardConfig offered, List<CardConfig> ownedConfigs) { EnsureCardIndices(); if (offered.HasEvolution) { string[] array = ParseComponents(offered.GetEvolveRequirementDescription()); if (array.Length != 0) { List<CardConfig> list = new List<CardConfig>(ownedConfigs); if (!list.Contains(offered)) { list.Add(offered); } HashSet<CardConfig> hashSet = TryAssignComps(array, list, offered.EvolvedCardConfig); if (hashSet != null && hashSet.Any((CardConfig c) => !Object.ReferenceEquals((Object)(object)c, (Object)(object)offered) && ownedConfigs.Contains(c))) { bool item = hashSet.All((CardConfig c) => ownedConfigs.Contains(c)); CardConfig evolvedCardConfig = offered.EvolvedCardConfig; return (hasCombo: true, evoName: ((evolvedCardConfig != null) ? evolvedCardConfig.Name : null) ?? "?", isRedundant: item); } } } foreach (CardConfig ownedConfig in ownedConfigs) { if ((Object)(object)ownedConfig == (Object)null || !ownedConfig.HasEvolution) { continue; } string[] array2 = ParseComponents(ownedConfig.GetEvolveRequirementDescription()); if (array2.Length == 0) { continue; } List<CardConfig> list2 = new List<CardConfig> { offered }; foreach (CardConfig ownedConfig2 in ownedConfigs) { list2.Add(ownedConfig2); } HashSet<CardConfig> hashSet2 = TryAssignComps(array2, list2, ownedConfig.EvolvedCardConfig); if (hashSet2 != null && hashSet2.Contains(offered)) { bool item2 = hashSet2.All((CardConfig c) => ownedConfigs.Contains(c)); CardConfig evolvedCardConfig2 = ownedConfig.EvolvedCardConfig; return (hasCombo: true, evoName: ((evolvedCardConfig2 != null) ? evolvedCardConfig2.Name : null) ?? "?", isRedundant: item2); } } return (hasCombo: false, evoName: "", isRedundant: false); } private static Sprite GetBadgeRingSprite(bool silver = false) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0326: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026d: 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_0316: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) if (silver && (Object)(object)_ringSpriteSilver != (Object)null) { return _ringSpriteSilver; } if (!silver && (Object)(object)_ringSpriteRainbow != (Object)null) { return _ringSpriteRainbow; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; float num = 32f; float num2 = 32f; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num3 = (float)j + 0.5f - num; float num4 = (float)i + 0.5f - num2; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); Color val2 = Color.clear; if (num5 < 32f) { float num6 = Mathf.Atan2(num4, num3); float num7 = (Mathf.Cos(num6 + 0.9424779f) + 1f) * 0.5f; if (num5 >= 29f) { float num8 = 1f - (num5 - 29f) / 3f; val2 = (silver ? new Color(0.4f, 0.45f, 0.55f, num8 * num8 * 0.55f) : new Color(0.55f, 0.3f, 0.7f, num8 * num8 * 0.55f)); } else if (num5 >= 19.5f) { float num9 = (num5 - 19.5f) / 9.5f; float num10 = (Mathf.Sin(num9 * (float)Math.PI * 3.5f - 0.3f) + 1f) * 0.5f; float num11 = Mathf.Pow(Mathf.Abs(num9 * 2f - 1f), 1.5f); float num12 = num10 * 0.32f + num7 * 0.33f + num11 * 0.28f + 0.07f; num12 = Mathf.Clamp01(num12); if (silver) { ((Color)(ref val2))..ctor(Mathf.Lerp(0.42f, 0.96f, num12), Mathf.Lerp(0.46f, 0.98f, num12), Mathf.Lerp(0.55f, 1f, num12), 1f); } else { Color val3 = Color.HSVToRGB((num6 + (float)Math.PI) / ((float)Math.PI * 2f) % 1f, 0.92f, 1f); ((Color)(ref val2))..ctor(Mathf.Lerp(val3.r * 0.3f, val3.r, num12), Mathf.Lerp(val3.g * 0.3f, val3.g, num12), Mathf.Lerp(val3.b * 0.3f, val3.b, num12), 1f); } } else if (num5 >= 17.5f) { float num13 = (num5 - 17.5f) / 2f; val2 = (silver ? new Color(0.06f, 0.06f, 0.1f, num13 * 0.9f) : new Color(0.07f, 0.03f, 0.1f, num13 * 0.9f)); } else { val2 = (silver ? new Color(0.05f, 0.05f, 0.08f, 0.97f) : new Color(0.05f, 0.03f, 0.08f, 0.97f)); } } array[i * 64 + j] = val2; } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); Sprite val4 = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); if (silver) { _ringSpriteSilver = val4; } else { _ringSpriteRainbow = val4; } return val4; } private static Sprite GetEvoTextSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_evoTextSprite != (Object)null) { return _evoTextSprite; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[4096]; byte[][][] array2 = new byte[3][][] { new byte[7][] { new byte[5] { 1, 1, 1, 1, 1 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 1, 1, 1, 0 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 0, 0, 0, 0 }, new byte[5] { 1, 1, 1, 1, 1 } }, new byte[7][] { new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 0, 1, 0, 1, 0 }, new byte[5] { 0, 1, 0, 1, 0 }, new byte[5] { 0, 0, 1, 0, 0 } }, new byte[7][] { new byte[5] { 0, 1, 1, 1, 0 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 1, 0, 0, 0, 1 }, new byte[5] { 0, 1, 1, 1, 0 } } }; int num = 15; int num2 = 21; int num3 = 3; int num4 = 3 * num + 2 * num3; int num5 = (64 - num4) / 2; int num6 = (64 - num2) / 2; for (int i = 0; i < 3; i++) { int num7 = num5 + i * (num + num3); for (int j = 0; j < 7; j++) { for (int k = 0; k < 5; k++) { if (array2[i][j][k] == 0) { continue; } for (int l = 0; l < 3; l++) { for (int m = 0; m < 3; m++) { int num8 = num7 + k * 3 + m + 1; int num9 = num6 + (6 - j) * 3 + l - 1; if (num8 >= 0 && num8 < 64 && num9 >= 0 && num9 < 64) { array[num9 * 64 + num8] = new Color(0f, 0f, 0f, 0.92f); } } } } } } for (int n = 0; n < 3; n++) { int num10 = num5 + n * (num + num3); for (int num11 = 0; num11 < 7; num11++) { for (int num12 = 0; num12 < 5; num12++) { if (array2[n][num11][num12] == 0) { continue; } for (int num13 = 0; num13 < 3; num13++) { for (int num14 = 0; num14 < 3; num14++) { int num15 = num10 + num12 * 3 + num14; int num16 = num6 + (6 - num11) * 3 + num13; if (num15 >= 0 && num15 < 64 && num16 >= 0 && num16 < 64) { array[num16 * 64 + num15] = new Color(1f, 1f, 1f, 1f); } } } } } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); _evoTextSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); return _evoTextSprite; } private static Sprite GetShineSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_007e: 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_015b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_shineSprite != (Object)null) { return _shineSprite; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; float num = 32f; float num2 = 32f; Color[] array = (Color[])(object)new Color[4096]; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num3 = (float)j + 0.5f - num; float num4 = (float)i + 0.5f - num2; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); Color clear = Color.clear; if (num5 >= 18.5f && num5 <= 30.5f) { float num6; for (num6 = Mathf.Atan2(num4, num3) - (float)Math.PI / 2f; num6 > (float)Math.PI; num6 -= (float)Math.PI * 2f) { } for (; num6 < -(float)Math.PI; num6 += (float)Math.PI * 2f) { } float num7 = Mathf.Pow(Mathf.Clamp01(Mathf.Cos(num6 * 1.2f)), 5f); float num8 = (num5 - 18.5f) / 12f; float num9 = 1f - Mathf.Abs(num8 * 2f - 1f); num9 = Mathf.Pow(Mathf.Clamp01(num9), 1.4f); float num10 = num7 * num9; ((Color)(ref clear))..ctor(1f, 1f, 1f, num10 * 0.85f); } array[i * 64 + j] = clear; } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); _shineSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); return _shineSprite; } private static Sprite GetCheckmarkSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_012c: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0148: 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) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_checkmarkSprite != (Object)null) { return _checkmarkSprite; } Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[1024]; float num = 16f; float num2 = 16f; float num3 = 14f; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.32f, 0.85f, 0.36f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.1f, 0.5f, 0.18f, 1f); for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num4 = (float)j + 0.5f - num; float num5 = (float)i + 0.5f - num2; float num6 = Mathf.Sqrt(num4 * num4 + num5 * num5); if (num6 <= num3 + 0.5f) { float num7 = Mathf.Clamp01((Mathf.Cos(Mathf.Atan2(num5, num4) + 0.9424779f) + 1f) * 0.5f * 0.55f + (1f - num6 / num3) * 0.45f); Color val4 = Color.Lerp(val3, val2, num7); float num8 = Mathf.Clamp01(num3 - num6 + 0.5f); array[i * 32 + j] = new Color(val4.r, val4.g, val4.b, num8); } } } byte[][] array2 = new byte[7][] { new byte[10] { 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 }, new byte[10] { 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, new byte[10] { 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }, new byte[10] { 1, 0, 0, 0, 0, 1, 1, 0, 0, 0 }, new byte[10] { 1, 1, 0, 0, 1, 1, 0, 0, 0, 0 }, new byte[10] { 0, 1, 1, 1, 1, 0, 0, 0, 0, 0 }, new byte[10] { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0 } }; int num9 = 6; int num10 = 9; for (int k = 0; k < 2; k++) { for (int l = 0; l < 7; l++) { for (int m = 0; m < 10; m++) { if (array2[l][m] == 0) { continue; } for (int n = 0; n < 2; n++) { for (int num11 = 0; num11 < 2; num11++) { int num12 = num9 + m * 2 + num11 + ((k == 0) ? 1 : 0); int num13 = num10 + (6 - l) * 2 + n - ((k == 0) ? 1 : 0); if (num12 >= 0 && num12 < 32 && num13 >= 0 && num13 < 32) { array[num13 * 32 + num12] = ((k == 0) ? new Color(0f, 0f, 0f, 0.55f) : new Color(1f, 1f, 1f, 1f)); } } } } } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); _checkmarkSprite = Sprite.Create(val, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f); return _checkmarkSprite; } private static float PillDist(float x, float y, float cx, float cy, float halfLen, float r) { float num = Mathf.Max(0f, Mathf.Abs(x - cx) - halfLen); float num2 = y - cy; return Mathf.Sqrt(num * num + num2 * num2) / r; } private static Sprite GetNewBadgeSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_newBadgeSprite != (Object)null) { return _newBadgeSprite; } Texture2D val = new Texture2D(56, 20, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[1120]; float cx = 28f; float cy = 10f; float r = 9f; float halfLen = 18f; for (int i = 0; i < 20; i++) { for (int j = 0; j < 56; j++) { float num = PillDist((float)j + 0.5f, (float)i + 0.5f, cx, cy, halfLen, r); if (num <= 1f) { Color val2 = Color.HSVToRGB((float)j / 56f, 0.88f, 0.9f); float num2 = Mathf.Clamp01((1f - num) / 0.15f); array[i * 56 + j] = new Color(val2.r, val2.g, val2.b, num2 * 0.96f); } } } int num3 = 10; int num4 = 14; int num5 = (56 - (3 * num3 + 4)) / 2; int num6 = (20 - num4) / 2; for (int k = 0; k < 2; k++) { for (int l = 0; l < 3; l++) { int num7 = num5 + l * (num3 + 2); for (int m = 0; m < 7; m++) { for (int n = 0; n < 5; n++) { if (GlyphsNEW[l][m][n] == 0) { continue; } for (int num8 = 0; num8 < 2; num8++) { for (int num9 = 0; num9 < 2; num9++) { int num10 = num7 + n * 2 + num9 + ((k == 0) ? 1 : 0); int num11 = num6 + (6 - m) * 2 + num8 - ((k == 0) ? 1 : 0); if (num10 >= 0 && num10 < 56 && num11 >= 0 && num11 < 20) { array[num11 * 56 + num10] = (Color)((k == 0) ? new Color(0f, 0f, 0f, 0.65f) : Color.white); } } } } } } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); _newBadgeSprite = Sprite.Create(val, new Rect(0f, 0f, 56f, 20f), new Vector2(0.5f, 0.5f), 100f); return _newBadgeSprite; } private static Sprite GetCountBadgeSprite(int n) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0173: 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_0214: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Min(n, 9); if ((Object)(object)_countBadgeCache[num] != (Object)null) { return _countBadgeCache[num]; } Texture2D val = new Texture2D(30, 16, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[480]; float cx = 15f; float cy = 8f; float r = 7f; float halfLen = 7f; for (int i = 0; i < 16; i++) { for (int j = 0; j < 30; j++) { float num2 = PillDist((float)j + 0.5f, (float)i + 0.5f, cx, cy, halfLen, r); if (num2 <= 1f) { float num3 = Mathf.Clamp01((1f - num2) / 0.15f); array[i * 30 + j] = new Color(0.05f, 0.03f, 0f, num3 * 0.88f); } } } int num4 = 14; int num5 = (30 - num4) / 2; int num6 = 5; int num7 = 3; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 0.88f, 0.2f, 1f); for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { if (GlyphTimes[k][l] == 0) { continue; } for (int m = 0; m < 2; m++) { for (int num8 = 0; num8 < 2; num8++) { int num9 = num5 + l * 2 + num8; int num10 = num6 + (2 - k) * 2 + m; if (num9 >= 0 && num9 < 30 && num10 >= 0 && num10 < 16) { array[num10 * 30 + num9] = val2; } } } } } byte[][] array2 = GlyphsDigits[num]; int num11 = num5 + 6 + 2; for (int num12 = 0; num12 < 5; num12++) { for (int num13 = 0; num13 < 3; num13++) { if (array2[num12][num13] == 0) { continue; } for (int num14 = 0; num14 < 2; num14++) { for (int num15 = 0; num15 < 2; num15++) { int num16 = num11 + num13 * 2 + num15; int num17 = num7 + (4 - num12) * 2 + num14; if (num16 >= 0 && num16 < 30 && num17 >= 0 && num17 < 16) { array[num17 * 30 + num16] = val2; } } } } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); Sprite val3 = Sprite.Create(val, new Rect(0f, 0f, 30f, 16f), new Vector2(0.5f, 0.5f), 100f); _countBadgeCache[num] = val3; return val3; } private static Transform GetTweenContainer(GameObject go) { Transform val = go.transform; for (int i = 0; i < 4; i++) { if (val.childCount > 0) { val = val.GetChild(0); } } return val; } private static byte[] LoadResourceBytes(string name) { try { using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); return memoryStream.ToArray(); } catch { return null; } } private static Sprite LoadEmbeddedRawRgba(string resourceName, int width, int height) { //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { byte[] array = LoadResourceBytes(resourceName); if (array == null) { ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(26, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] resource null: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(resourceName); } log.LogWarning(val); return null; } int num = width * height * 4; if (array.Length != num) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] taille rgba "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(array.Length); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" != attendue "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); } log2.LogWarning(val); return null; } Il2CppStructArray<byte> val2 = new Il2CppStructArray<byte>((long)array.Length); for (int i = 0; i < array.Length; i++) { ((Il2CppArrayBase<byte>)(object)val2)[i] = array[i]; } Texture2D val3 = new Texture2D(width, height, (TextureFormat)4, false); ((Texture)val3).filterMode = (FilterMode)0; ((Object)val3).hideFlags = (HideFlags)61; val3.LoadRawTextureData(val2); val3.Apply(); ManualLogSource log3 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(28, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[CardLock] sprite chargé : "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((Texture)val3).width); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("x"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(((Texture)val3).height); } log3.LogInfo(val4); Sprite obj = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f), 100f); ((Object)obj).hideFlags = (HideFlags)61; return obj; } catch (Exception ex) { ManualLogSource log4 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] LoadEmbeddedRawRgba error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log4.LogWarning(val); return null; } } private static AudioClip LoadEmbeddedWav(string resourceName, string clipName) { //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown bool flag = default(bool); try { byte[] array = LoadResourceBytes(resourceName); if (array == null || array.Length < 44) { return null; } if (array[0] != 82 || array[1] != 73 || array[2] != 70 || array[3] != 70) { return null; } int num = array[22] | (array[23] << 8); int num2 = array[24] | (array[25] << 8) | (array[26] << 16) | (array[27] << 24); int num3 = array[34] | (array[35] << 8); if (num3 != 16) { ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] WAV "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(clipName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" : "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num3); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("-bit non supporté"); } log.LogWarning(val); return null; } int i = 12; int num4 = -1; int num5 = 0; int num6; for (; i + 8 <= array.Length; i += 8 + num6) { string text = Encoding.ASCII.GetString(array, i, 4); num6 = array[i + 4] | (array[i + 5] << 8) | (array[i + 6] << 16) | (array[i + 7] << 24); if (text == "data") { num4 = i + 8; num5 = num6; break; } } if (num4 < 0) { return null; } int num7 = num5 / 2; int num8 = num7 / num; Il2CppStructArray<float> val2 = new Il2CppStructArray<float>((long)num7); for (int j = 0; j < num7; j++) { short num9 = (short)(array[num4 + j * 2] | (array[num4 + j * 2 + 1] << 8)); ((Il2CppArrayBase<float>)(object)val2)[j] = (float)num9 / 32768f; } AudioClip obj = AudioClip.Create(clipName, num8, num, num2, false); obj.SetData(val2, 0); ((Object)obj).hideFlags = (HideFlags)61; return obj; } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(35, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] LoadEmbeddedWav "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(clipName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" error: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log2.LogWarning(val); return null; } } private void EnsureAssetsLoaded() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Expected O, but got Unknown if (_assetsLoaded) { return; } _assetsLoaded = true; _lockBadgeSprite = LoadEmbeddedRawRgba("BetterCards.assets.padlock.rgba", 128, 128); if ((Object)(object)_lockBadgeSprite == (Object)null) { Plugin.Log.LogWarning((object)"[CardLock] padlock.rgba introuvable, fallback procédural"); } _clipLock = LoadEmbeddedWav("BetterCards.assets.lock.wav", "bc_lock"); _clipUnlock = LoadEmbeddedWav("BetterCards.assets.unlock.wav", "bc_unlock"); _clipBlocked = LoadEmbeddedWav("BetterCards.assets.blocked.wav", "bc_blocked"); if ((Object)(object)_audioSource == (Object)null) { _audioSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _audioSource.playOnAwake = false; _audioSource.spatialBlend = 0f; _audioSource.volume = 1f; _audioSource.bypassListenerEffects = true; _audioSource.bypassEffects = true; } LoadLocks(); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(53, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] assets : sprite="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>((Object)(object)_lockBadgeSprite != (Object)null); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", lock="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>((Object)(object)_clipLock != (Object)null); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", unlock="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>((Object)(object)_clipUnlock != (Object)null); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", blocked="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>((Object)(object)_clipBlocked != (Object)null); } log.LogInfo(val); if ((Object)(object)_clipLock != (Object)null) { ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(42, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] clip lock : "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_clipLock.length, "F2"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s, "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_clipLock.samples); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" samples, "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_clipLock.channels); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("ch, "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_clipLock.frequency); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Hz"); } log2.LogInfo(val); } if ((Object)(object)_clipUnlock != (Object)null) { ManualLogSource log3 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(36, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] clip unlock : "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_clipUnlock.length, "F2"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s, "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_clipUnlock.samples); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" samples"); } log3.LogInfo(val); } if ((Object)(object)_clipBlocked != (Object)null) { ManualLogSource log4 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(37, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] clip blocked : "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(_clipBlocked.length, "F2"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("s, "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_clipBlocked.samples); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" samples"); } log4.LogInfo(val); } } private static Sprite GetGoldenDiscSprite() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_goldenDiscSprite != (Object)null) { return _goldenDiscSprite; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; Color[] array = (Color[])(object)new Color[4096]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.1f, 0.07f, 0.02f, 1f); new Color(0.55f, 0.36f, 0.05f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(1f, 0.78f, 0.2f, 1f); float num = 32f; float num2 = 32f; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num3 = (float)j + 0.5f - num; float num4 = (float)i + 0.5f - num2; float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); Color val4 = Color.clear; if (num5 >= 25f && num5 <= 31f) { val4 = ((!(num5 >= 30f)) ? ((!(num5 >= 26f)) ? val2 : val3) : val2); } array[i * 64 + j] = val4; } } val.SetPixels(Il2CppStructArray<Color>.op_Implicit(array)); val.Apply(); ((Object)val).hideFlags = (HideFlags)61; _goldenDiscSprite = Sprite.Create(val, new Rect(0f, 0f, 64f, 64f), new Vector2(0.5f, 0.5f), 100f); ((Object)_goldenDiscSprite).hideFlags = (HideFlags)61; return _goldenDiscSprite; } private static void PlayClip(AudioClip clip) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown if ((Object)(object)clip == (Object)null || (Object)(object)_audioSource == (Object)null) { return; } try { _audioSource.PlayOneShot(clip); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] PlayOneShot failed : "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } internal static string GetLockKey(CardModel cm) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) if ((Object)(object)cm == (Object)null) { return null; } try { SerializableGuid guid = cm.Guid; string text = ((object)((SerializableGuid)(ref guid)).ToGuid()/*cast due to .constrained prefix*/).ToString(); if (string.IsNullOrEmpty(text) || text == "00000000-0000-0000-0000-000000000000") { return null; } return text; } catch { return null; } } private static bool IsWildCard(CardModel cm) { string cardConfigName = GetCardConfigName(cm); if (cardConfigName == null) { return false; } string[] array = cardConfigName.Split('_'); if (array.Length == 3) { return true; } if (array.Length >= 2 && array[1].ToUpperInvariant() == "E") { return true; } return false; } private static string GetCardConfigName(CardModel cm) { if ((Object)(object)cm == (Object)null) { return null; } try { string text = null; try { CardView cardView = cm.CardView; object obj; if (cardView == null) { obj = null; } else { CardConfig appliedCardConfig = cardView._appliedCardConfig; obj = ((appliedCardConfig != null) ? ((Object)appliedCardConfig).name : null); } text = (string)obj; } catch { } if (string.IsNullOrEmpty(text)) { try { CardConfig cardConfig = cm.CardConfig; text = ((cardConfig != null) ? ((Object)cardConfig).name : null); } catch { } } if (string.IsNullOrEmpty(text)) { return null; } int num = text.IndexOf("(Clone)", StringComparison.Ordinal); if (num > 0) { text = text.Substring(0, num).TrimEnd(); } return text; } catch { return null; } } private static void RebuildLockedConfigsCache(PlayerModel pm) { _lockedConfigsCache.Clear(); if ((Object)(object)pm == (Object)null) { return; } List<CardModel> allCards = pm._allCards; if (allCards == null) { return; } Enumerator<CardModel> enumerator = allCards.GetEnumerator(); while (enumerator.MoveNext()) { CardModel current = enumerator.Current; if ((Object)(object)current == (Object)null) { continue; } string lockKey = GetLockKey(current); if (lockKey == null || !_lockedCardKeys.Contains(lockKey)) { continue; } string cardConfigName = GetCardConfigName(current); if (cardConfigName != null) { _lockedConfigsCache.Add(cardConfigName); if (!_lockedKeyConfigs.ContainsKey(lockKey)) { _lockedKeyConfigs[lockKey] = cardConfigName; } } } _lockedConfigsCacheDirty = false; } internal static bool IsLockedByConfig(CardModel cm, PlayerModel pm) { if ((Object)(object)cm == (Object)null) { return false; } string lockKey = GetLockKey(cm); if (lockKey != null && _lockedCardKeys.Contains(lockKey)) { return true; } if (_lockedConfigsCacheDirty) { RebuildLockedConfigsCache(pm); } string cardConfigName = GetCardConfigName(cm); if (cardConfigName != null) { return _lockedConfigsCache.Contains(cardConfigName); } return false; } private static int GetCscvRank(CardSelectionCardView cscv, string cfg) { if ((Object)(object)cscv == (Object)null || cfg == null) { return -1; } Transform parent = ((Component)cscv).transform.parent; if ((Object)(object)parent == (Object)null) { return -1; } int num = 0; int childCount = parent.childCount; for (int i = 0; i < childCount; i++) { Transform child = parent.GetChild(i); CardSelectionCardView val = null; try { val = ((Component)child).GetComponent<CardSelectionCardView>(); } catch { } if ((Object)(object)val == (Object)null) { continue; } CardModel val2 = null; try { ICardModel cardModel = val.CardModel; val2 = ((cardModel != null) ? ((Il2CppObjectBase)cardModel).TryCast<CardModel>() : null); } catch { } if (!((Object)(object)val2 == (Object)null) && !(GetCardConfigName(val2) != cfg)) { if ((Object)(object)val == (Object)(object)cscv) { return num; } num++; } } return -1; } private static string FindRealGuidForRank(PlayerModel pm, string cfg, int rank) { if ((Object)(object)pm == (Object)null || cfg == null || rank < 0) { return null; } List<CardModel> allCards = pm._allCards; if (allCards == null) { return null; } _matchingGuidsBuf.Clear(); Enumerator<CardModel> enumerator = allCards.GetEnumerator(); while (enumerator.MoveNext()) { CardModel current = enumerator.Current; if (!((Object)(object)current == (Object)null) && !(GetCardConfigName(current) != cfg)) { string lockKey = GetLockKey(current); if (lockKey != null) { _matchingGuidsBuf.Add(lockKey); } } } if (rank >= _matchingGuidsBuf.Count) { return null; } _matchingGuidsBuf.Sort(StringComparer.Ordinal); return _matchingGuidsBuf[rank]; } private static bool IsCscvRealCardLocked(CardSelectionCardView cscv, PlayerModel pm) { if ((Object)(object)cscv == (Object)null) { return false; } CardModel val = null; try { ICardModel cardModel = cscv.CardModel; val = ((cardModel != null) ? ((Il2CppObjectBase)cardModel).TryCast<CardModel>() : null); } catch { } if ((Object)(object)val == (Object)null) { return false; } string cardConfigName = GetCardConfigName(val); if (cardConfigName == null) { return false; } int cscvRank = GetCscvRank(cscv, cardConfigName); if (cscvRank < 0) { return false; } string text = FindRealGuidForRank(pm, cardConfigName, cscvRank); if (text != null) { return _lockedCardKeys.Contains(text); } return false; } internal static bool IsLocked(CardModel cm) { string lockKey = GetLockKey(cm); if (lockKey != null) { return _lockedCardKeys.Contains(lockKey); } return false; } internal static void ToggleLock(CardModel cm) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown string lockKey = GetLockKey(cm); if (lockKey == null) { return; } bool flag = default(bool); if (_lockedCardKeys.Contains(lockKey)) { _lockedCardKeys.Remove(lockKey); _lockedKeyConfigs.Remove(lockKey); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] unlocked "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lockKey); } log.LogInfo(val); PlayClip(_clipUnlock); RefreshHandCostText("unlock"); } else { _lockedCardKeys.Add(lockKey); string cardConfigName = GetCardConfigName(cm); if (cardConfigName != null) { _lockedKeyConfigs[lockKey] = cardConfigName; } ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] locked "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lockKey); } log2.LogInfo(val); PlayClip(_clipLock); } _lockedConfigsCacheDirty = true; SaveLocks(); TriggerAutoEndTurnCheck(); } internal static void ToggleLockFromCSCV(CardSelectionCardView cscv) { //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown if ((Object)(object)cscv == (Object)null) { return; } ICardModel cardModel = cscv.CardModel; CardModel val = ((cardModel != null) ? ((Il2CppObjectBase)cardModel).TryCast<CardModel>() : null); if ((Object)(object)val == (Object)null) { return; } string cardConfigName = GetCardConfigName(val); if (cardConfigName == null) { return; } PlayerModel val2 = Object.FindObjectOfType<PlayerModel>(); if ((Object)(object)val2 == (Object)null) { return; } int cscvRank = GetCscvRank(cscv, cardConfigName); if (cscvRank < 0) { return; } string text = FindRealGuidForRank(val2, cardConfigName, cscvRank); if (text == null) { return; } bool flag = default(bool); if (_lockedCardKeys.Contains(text)) { _lockedCardKeys.Remove(text); _lockedKeyConfigs.Remove(text); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(37, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] modal unlock "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (cfg="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(cardConfigName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" rank="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(cscvRank); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")"); } log.LogInfo(val3); PlayClip(_clipUnlock); RefreshHandCostText("modal unlock"); } else { _lockedCardKeys.Add(text); _lockedKeyConfigs[text] = cardConfigName; ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(35, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] modal lock "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" (cfg="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(cardConfigName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" rank="); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(cscvRank); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")"); } log2.LogInfo(val3); PlayClip(_clipLock); } _lockedConfigsCacheDirty = true; SaveLocks(); TriggerAutoEndTurnCheck(); } private static void RefreshHandCostText(string reason) { //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown bool flag = default(bool); try { PlayerModel val = Object.FindObjectOfType<PlayerModel>(); object obj; if (val == null) { obj = null; } else { HandPileModel handPile = val.HandPile; if (handPile == null) { obj = null; } else { CardPileModel cardPile = handPile.CardPile; obj = ((cardPile != null) ? cardPile._cards : null); } } List<CardModel> val2 = (List<CardModel>)obj; if ((Object)(object)val == (Object)null || val2 == null) { return; } int num = 0; for (int i = 0; i < val2.Count; i++) { CardModel val3 = val2[i]; if ((Object)(object)val3 == (Object)null) { continue; } try { val3.RefreshReceivesComboMultiplier(); } catch { } try { val3.RefreshCard(); } catch { } try { CardView cardView = val3.CardView; if ((Object)(object)cardView == (Object)null) { continue; } try { cardView.UnfreezeComboValue(); } catch { } try { cardView.RefreshView(val); } catch { } cardView.UpdateCostText(val); try { TMP_Text costText = cardView._costText; if ((Object)(object)costText != (Object)null) { SetTmpTextVisible(costText, !IsLocked(val3) && !IsWildCard(val3)); } } catch { } num++; } catch { } } if (num > 0) { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[CardLock] coût/combo refresh après "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" : "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" carte(s)"); } log.LogInfo(val4); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(41, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[CardLock] refresh cost text failed ("); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(") : "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message); } log2.LogWarning(val5); } } internal static void RemoveLockForCard(CardModel cm, string reason) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown string lockKey = GetLockKey(cm); if (lockKey != null && _lockedCardKeys.Contains(lockKey)) { string text = GetCardConfigName(cm) ?? "unknown"; _lockedCardKeys.Remove(lockKey); _lockedKeyConfigs.Remove(lockKey); _lockedConfigsCacheDirty = true; SaveLocks(); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(51, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] lock removed before evolution ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") : "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(lockKey); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" cfg="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } log.LogInfo(val); } } internal static void PruneInvalidOrTransferredLocks(PlayerModel pm, string reason) { //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown bool flag = default(bool); try { if (_lockedCardKeys.Count == 0) { return; } if ((Object)(object)pm == (Object)null) { pm = Object.FindObjectOfType<PlayerModel>(); } List<CardModel> val = ((pm != null) ? pm._allCards : null); if (val == null) { return; } Dictionary<string, string> dictionary = new Dictionary<string, string>(); Enumerator<CardModel> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { CardModel current = enumerator.Current; if ((Object)(object)current == (Object)null) { continue; } string lockKey = GetLockKey(current); if (lockKey != null) { string cardConfigName = GetCardConfigName(current); if (cardConfigName != null) { dictionary[lockKey] = cardConfigName; } } } int num = 0; int num2 = 0; string[] array = _lockedCardKeys.ToArray(); foreach (string text in array) { string value2; if (!dictionary.TryGetValue(text, out var value)) { _lockedCardKeys.Remove(text); _lockedKeyConfigs.Remove(text); num++; } else if (_lockedKeyConfigs.TryGetValue(text, out value2) && !string.IsNullOrEmpty(value2)) { if (!string.IsNullOrEmpty(value) && value != value2) { _lockedCardKeys.Remove(text); _lockedKeyConfigs.Remove(text); num++; } } else if (!string.IsNullOrEmpty(value)) { _lockedKeyConfigs[text] = value; num2++; } } if (num > 0) { _lockedConfigsCacheDirty = true; SaveLocks(); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(33, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[CardLock] "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" verrou(s) purgé(s) ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")"); } log.LogInfo(val2); } else if (num2 > 0) { ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(49, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[CardLock] "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" verrou(s) associé(s) à leur config ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(")"); } log2.LogInfo(val2); } } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(35, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] prune locks failed ("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(reason); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") : "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log3.LogWarning(val3); } } private static string GetLocksFilePath() { return Path.Combine(Paths.ConfigPath, "BetterCards.locks.txt"); } private static void SaveLocks() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown try { File.WriteAllLines(GetLocksFilePath(), _lockedCardKeys); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] sauvegarde locks failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } private static bool LooksLikeGuid(string s) { if (s != null && s.Length == 36 && s[8] == '-' && s[13] == '-' && s[18] == '-') { return s[23] == '-'; } return false; } private static void LoadLocks() { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown bool flag = default(bool); try { string locksFilePath = GetLocksFilePath(); if (!File.Exists(locksFilePath)) { return; } int num = 0; int num2 = 0; string[] array = File.ReadAllLines(locksFilePath); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (!string.IsNullOrEmpty(text)) { if (!LooksLikeGuid(text)) { num2++; } else if (_lockedCardKeys.Add(text)) { num++; } } } _lockedConfigsCacheDirty = true; if (num > 0) { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" verrous restaurés depuis disque"); } log.LogInfo(val); } if (num2 > 0) { ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(72, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[CardLock] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entrées non-GUID ignorées (migration), réécriture du fichier"); } log2.LogInfo(val); SaveLocks(); } } catch (Exception ex) { ManualLogSource log3 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[CardLock] chargement locks failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log3.LogWarning(val2); } } private static void TriggerAutoEndTurnCheck() { try { PlayerModel obj = Object.FindObjectOfType<PlayerModel>(); if (obj != null) { obj.AutoEndTurnCheck(); } } catch { } } private void CheckLockIntegrity() { if (--_lockPruneCooldown > 0) { return; } _lockPruneCooldown = 120; if (_lockedCardKeys.Count != 0) { if ((Object)(object)_cachedPlayerModel == (Object)null) { _cachedPlayerModel = Object.FindObjectOfType<PlayerModel>(); } PruneInvalidOrTransferredLocks(_cachedPlayerModel, "periodic"); } } private void CheckAutoEndTurn() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown if (--_autoEndPollCooldown > 0) { return; } _autoEndPollCooldown = 30; if (Plugin.CardLockEnabled == null || !Plugin.CardLockEnabled.Value) { return; } if ((Object)(object)_cachedPlayerModel == (Object)null) { _cachedPlayerModel = Object.FindObjectOfType<PlayerModel>(); } PlayerModel cachedPlayerModel = _cachedPlayerModel; if ((Object)(object)cachedPlayerModel == (Object)null) { return; } HandPileModel handPile = cachedPlayerModel.HandPile; object obj; if (handPile == null) { obj = null; } else { CardPileModel cardPile = handPile.CardPile; obj = ((cardPile != null) ? cardPile._cards : null); } List<CardModel> val = (List<CardModel>)obj; if (val == null || val.Count == 0) { _autoEndDone = false; return; } int count = val.Count; bool flag = false; bool flag2 = false; for (int i = 0; i < count; i++) { CardModel val2 = val[i]; if ((Object)(object)val2 == (Object)null) { continue; } if (IsLocked(val2)) { flag2 = true; continue; } try { if (cachedPlayerModel.CanAffordCard(val2)) { flag = true; break; } } catch { } } if (flag) { _autoEndDone = false; } else { if (!(!_autoEndDone && flag2)) { return; } _autoEndDone = true; Plugin.Log.LogInfo((object)"[CardLock] auto-skip déclenché : toute la main est verrouillée ou non-affordable"); try { cachedPlayerModel.Button_EndTurn(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag3 = default(bool); BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(31, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[CardLock] Button_EndTurn err: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } log.LogWarning(val3); } } } internal static void PlayBlockedFeedback(PlayableCard pc) { float unscaledTime = Time.unscaledTime; if (unscaledTime - _lastBlockedFeedbackTime < 0.03f) { return; } _lastBlockedFeedbackTime = unscaledTime; if ((Object)(object)pc != (Object)null) { try { pc.PlayInvalidCardShake(); } catch { } } PlayClip(_clipBlocked); } private void HandleKeyboardLockedFeedback() { if (Plugin.CardLockEnabled == null || !Plugin.CardLockEnabled.Value) { return; } bool flag = false; try { Keyboard current = Keyboard.current; if (current == null) { return; } bool isPressed = ((ButtonControl)current.spaceKey).isPressed; bool isPressed2 = ((ButtonControl)current.enterKey).isPressed; bool isPressed3 = ((ButtonControl)current.numpadEnterKey).isPressed; if ((isPressed && !_prevSpaceP) || (isPressed2 && !_prevEnterP) || (isPressed3 && !_prevNumEnterP)) { flag = true; } _prevSpaceP = isPressed; _prevEnterP = isPressed2; _prevNumEnterP = isPressed3; } catch { return; } if (!flag) { return; } try { Il2CppArrayBase<InteractableCard> val = Object.FindObjectsOfType<InteractableCard>(); if (val == null) { return; } foreach (InteractableCard item in val) { try { if ((Object)(object)item == (Object)null) { continue; } bool flag2 = false; try { flag2 = item.IsHovering || item.IsSelected; } catch { } if (!flag2) { continue; } CardView cardView = item._cardView; CardModel val2 = ((cardView != null) ? cardView._cardModel : null); if ((Object)(object)val2 == (Object)null || !IsLocked(val2)) { break; } PlayableCard val3 = null; try { val3 = ((Component)item).gameObject.GetComponent<PlayableCard>(); } catch { } if ((Object)(object)val3 == (Object)null) { try { val3 = ((Component)item).gameObject.GetComponentInParent<PlayableCard>(); } catch { } } if ((Object)(object)val3 == (Object)null) { try { val3 = ((Component)item).gameObject.GetComponentInChildren<PlayableCard>(); } catch { } } if ((Object)(object)val3 == (Object)null) { try { Il2CppArrayBase<PlayableCard> val4 = Object.FindObjectsOfType<PlayableCard>(); if (val4 != null) { foreach (PlayableCard item2 in val4) { try { if ((Object)(object)item2 != (Object)null && (Object)(object)item2._interactableCard == (Object)(object)item) { val3 = item2; break; } } catch { } } } } catch { } } PlayBlockedFeedback(val3); break; } catch { } } } catch { } } private static bool IsPointerOverCscv(CardSelectionCardView cscv, Vector2 screenPos) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cscv == (Object)null) { return false; } try { RectTransform component = ((Component)cscv).GetComponent<RectTransform>(); if ((Object)(object)component == (Object)null) { return false; } Camera val = null; try { Canvas componentInParent = ((Component)cscv).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) { val = componentInParent.worldCamera; } } catch {