Decompiled source of MT2CheatGUI v1.2.6
plugins/MT2CheatGUI/MT2CheatGUI.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; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using I2.Loc; using Microsoft.CodeAnalysis; using ShinyShoe; using ShinyShoe.Loading; using TMPro; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MT2CheatGUI")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MT2CheatGUI")] [assembly: AssemblyTitle("MT2CheatGUI")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MT2CheatGUI { [BepInPlugin("jiesi.mt2.cheatgui", "MT2 Cheat GUI", "1.2.6")] public class Plugin : BaseUnityPlugin { private class EditPlayback { public float started; public bool executed; } private class UpgradeRow { public CardUpgradeState state; public string name; public string desc; public string rich; public Sprite icon; } private enum PickerMode { Cards, Relics, Enhancers, Deck } private class Entry { public GameData data; public string id; public string name; public string english; public string asset; public string info; public string clan; public int classIndex; public CardType cardType; public string searchKey; public CollectableRarity rarity = (CollectableRarity)(-1); public int cost = -1; public bool costX; public Sprite icon; public string desc; public string rich; public CardState state; } private class Runner : MonoBehaviour { public Plugin owner; private void Update() { owner?.Tick(); } private void OnGUI() { owner?.DrawGUI(); } } private enum TitanState { Won, Missed, NotYet } private class TitanRow { public int index; public int distance; public TitanState state; public CompletedBattleRecord record; } private enum UnlockAction { None, All, Discover, Mastery } private const string EditPrefix = "MT2CheatGUI "; private static Plugin instance; private bool replayingEdit; private const BindingFlags AnyInstance = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static readonly FieldInfo CheatCommandField = typeof(ReplayEntryCheatCommand).GetField("cheatCommand", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly PropertyInfo IsBusyProp = typeof(CheatManager).GetProperty("IsBusy", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo PilesChanged = typeof(CardManager).GetMethod("DispatchCardPilesChangedSignal", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo DetectDoneM = typeof(ReplayEntry).GetMethod("DetectDone", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly FieldInfo CurrentEntryField = typeof(ReplayManager).GetField("currentPlaybackEntry", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private float nextWaitLog; private static readonly Dictionary<ReplayEntry, EditPlayback> editPlaybacks = new Dictionary<ReplayEntry, EditPlayback>(); private static float nextDiag; private Entry pEditEntry; private RectTransform pPreviewRoot; private CardUI pPreviewUI; private Vector2 pEditScroll; private string pEditSearch = ""; private Dictionary<string, EnhancerData> pEnhancerByUpgrade; private bool pEditIgnoreRules; private Action pPendingEdit; private bool pPreviewPending; private Action pPendingDeckOp; private const string InfuseTrait = "CardTraitCorruptState"; private int lastInfuseAllCount; private List<CardUpgradeMaskData> pDefaultUpgradeMasks; private ConfigEntry<bool> showButton; private ConfigEntry<float> buttonX; private ConfigEntry<float> buttonY; private const float BtnSize = 64f; private RectTransform pBtnBlocker; private bool btnDragging; private bool btnMoved; private bool btnToggleRequested; private Vector2 btnDragStartMouse; private Vector2 btnDragStartPos; private GUIStyle sFloatBtn; private ConfigEntry<bool> buttonInTopBar; private RectTransform hudClassesUI; private float hudLookupAt; private GUIStyle sFloatBtnOn; private GUIStyle sBtnTip; private bool btnForceHover; private Texture2D buttonIcon; private bool buttonIconTried; private static readonly FieldInfo I2CurrentLanguageField = typeof(LocalizationManager).GetField("mCurrentLanguage", BindingFlags.Static | BindingFlags.NonPublic); private static readonly Dictionary<string, string> En = new Dictionary<string, string> { ["常用"] = "Common", ["加卡"] = "Add Cards", ["神器"] = "Artifacts", ["牌组"] = "Deck", ["强化石"] = "Upgrades", ["全部"] = "All", ["无派系"] = "No clan", ["找不到游戏命令 "] = "Game command not found: ", ["(游戏可能更新了)"] = " (the game may have been updated)", ["执行失败:"] = "Failed: ", ["要先开始或继续一局游戏才能用"] = "Start or continue a run first", ["这个只能在战斗中用"] = "Only available in battle", ["普通"] = "Common", ["罕见"] = "Uncommon", ["稀有"] = "Rare", ["勇者"] = "Champion", ["初始"] = "Starter", ["法术"] = "Spell", ["单位"] = "Unit", ["灾祸"] = "Blight", ["垃圾"] = "Junk", ["装备"] = "Equipment", ["房间"] = "Room", [" · 非图鉴"] = " · not in logbook", ["游戏还没加载完,进入主菜单后再打开。"] = "The game hasn't finished loading. Open this again from the main menu.", ["未加载"] = "Not loaded", ["不在对局中(主菜单)"] = "Not in a run (main menu)", ["金币"] = "Gold", ["设为这个数"] = "Set to this", ["金币 +"] = "Gold +", ["金币设为 "] = "Gold set to ", ["请输入非负整数"] = "Enter a number ≥ 0", ["请输入正整数"] = "Enter a number > 0", ["余烬(战斗中)"] = "Ember (in battle)", ["余烬 +"] = "Ember +", ["火炉"] = "Pyre", ["回满血"] = "Full heal", ["火炉已回满"] = "Pyre fully healed", ["+10 血"] = "+10 HP", ["火炉 +10"] = "Pyre +10", ["上限"] = "Max", ["设上限(≤999)"] = "Set max (≤999)", ["火炉上限设为 "] = "Pyre max HP set to ", ["开关"] = "Toggles", ["开"] = "on", ["关"] = "off", [" 无限余烬"] = " Unlimited ember", ["无限余烬 "] = "Unlimited ember ", [" 我方单位无敌"] = " Invincible units", ["我方单位无敌 "] = "Invincible units ", [" 火炉无敌"] = " Invincible pyre", ["火炉无敌 "] = "Invincible pyre ", [" 敌人无敌"] = " Invincible enemies", ["敌人无敌 "] = "Invincible enemies ", ["开关只在本次游戏进程有效,重启游戏会恢复。"] = "Toggles last until the game is restarted.", ["战斗"] = "Battle", ["抽 1 张"] = "Draw 1", ["抽 3 张"] = "Draw 3", ["弃掉手牌"] = "Discard hand", ["清除技能冷却"] = "Clear ability cooldowns", ["已清除技能冷却"] = "Ability cooldowns cleared", ["直接赢下本场战斗"] = "Win this battle now", ["结束战斗"] = "Battle ended", ["每层容量"] = "Capacity per floor", ["三层都设为这个"] = "Set all 3 floors", ["每层容量设为 "] = "Capacity per floor set to ", ["随机奖励"] = "Random rewards", ["随机一张卡"] = "Random card", ["已给一张随机卡"] = "Gave a random card", ["随机一个神器"] = "Random artifact", ["已给一个随机神器"] = "Gave a random artifact", ["主氏族经验 +1000"] = "Main clan XP +1000", ["已给一张随机卡:"] = "Gave a random card: ", ["已给一个随机神器:"] = "Gave a random artifact: ", ["没有可给的神器了"] = "No artifacts left to give", ["加强化失败"] = "Couldn't add the upgrade", ["卡牌数据还没准备好"] = "Card data isn't ready yet", ["永久解锁(存档进度)"] = "Permanent unlocks (profile save)", ["解锁全部"] = "Unlock everything", ["图鉴全开"] = "Discover whole logbook", ["所有卡牌精通"] = "Master all cards", ["再点一次确认"] = "Click again to confirm", ["战斗中不能解锁,先打完这一场"] = "Can't unlock during a battle, finish it first", ["备份存档失败,没有解锁:"] = "Save backup failed, nothing unlocked: ", ["解锁全部 = 所有氏族满级、圣约 10、所有挑战、炎心、车厢外观、卡框、灵魂、剧情,并且图鉴全开(含勇者升级)(没买的 DLC 氏族解锁不了)。会改你的永久存档,也会触发对应的 Steam 成就,不能撤销;点之前自动备份存档。最好在主菜单用。"] = "Unlock everything = all clans at max level, Covenant 10, all challenges, pyre hearts, train cosmetics, card frames, souls, story, and the whole logbook incl. champion upgrades (clans from DLC you don't own stay locked). Changes your permanent save and triggers the matching Steam achievements; cannot be undone. The save is backed up first. Best used from the main menu.", ["提示:点按钮时游戏本身也可能收到点击,尽量把窗口拖到空白处再点。加卡/神器在「加卡」「神器」页签里搜索。"] = "Tip: the Add Cards / Artifacts / Deck / Upgrades tabs open a full-screen picker with search and filters.", ["读不到余烬"] = "Can't read ember", ["默认"] = "Default", ["费用"] = "Cost", ["名字"] = "Name", ["稀有度"] = "Rarity", ["已拥有"] = "Owned", ["未拥有"] = "Not owned", ["小"] = "S", ["中"] = "M", ["大"] = "L", [" · 勇者"] = " · Champion", ["勇者卡不能删"] = "Champion cards can't be removed", ["游戏还在处理上一个操作,稍等一下"] = "The game is still busy, try again in a moment", ["已删除:"] = "Removed: ", ["删除失败:"] = "Remove failed: ", ["复制一张:"] = "Copied: ", ["(进手牌)"] = " (to hand)", ["(进牌组)"] = " (to deck)", ["已移除:"] = "Removed: ", ["已获得:"] = "Got: ", ["战斗中不能用强化石"] = "Upgrades can't be used in battle", ["找不到游戏的强化接口(游戏可能更新了)"] = "Can't find the game's upgrade function (the game may have been updated)", ["请选择要强化的卡:"] = "Choose a card to upgrade: ", ["牌组/删牌"] = "Deck / Remove", ["搜索"] = "Search", ["清空"] = "Clear", ["排序"] = "Sort", ["点击卡牌"] = "On click", ["删除"] = "Remove", ["复制一张"] = "Copy", ["改卡(去掉/加强化)"] = "Edit upgrades", ["每次加"] = "Add", ["卡牌大小"] = "Card size", ["返回面板"] = "Back to panel", ["✕ 关闭"] = "✕ Close", ["点击图标获得神器,已拥有的(绿色)再点一下移除。"] = "Click to get an artifact; click an owned (green) one to remove it.", ["点击强化石,会弹出游戏的选卡界面来升级一张卡。"] = "Click an upgrade stone, then pick a card in the game's card screen.", ["点击:改这张卡的强化"] = "Click: edit this card's upgrades", ["<color=#ff8a7a>点击:删除这张</color>"] = "<color=#ff8a7a>Click: remove this card</color>", ["点击:复制一张"] = "Click: add a copy", ["这里是你现在的牌组(含升级)。\n顶部选「删除」或「复制一张」,再点卡牌。"] = "Your current deck (with upgrades).\nChoose Remove / Copy / Edit at the top, then click a card.", ["滚轮上下滚动,点击卡牌加入。\n鼠标移到卡牌上可看氏族和稀有度。"] = "Scroll with the mouse wheel, click a card to add it.\nHover a card to see its clan and rarity.", ["<color=#ff9a6a>战斗中</color>:加卡直接进手牌"] = "<color=#ff9a6a>In battle</color>: added cards go to your hand", ["地图/商店:加卡进牌组"] = "Map / shop: added cards go to your deck", ["清除全部筛选"] = "Clear all filters", ["氏族"] = "Clan", ["只看本局的两个氏族"] = "Only this run's clans", ["类型"] = "Type", [" 只显示图鉴里的正常卡"] = " Logbook cards only", [" 搜索也匹配卡牌描述"] = " Search card text too", ["拥有"] = "Owned", [" 只显示正常能拿到的神器"] = " Obtainable artifacts only", ["\n(卡图加载失败,仍可点击加入)"] = "\n(art failed to load, still clickable)", ["\n加载中…"] = "\nLoading…", ["已删除"] = "Removed", ["牌组是空的"] = "Your deck is empty", ["没有符合条件的卡"] = "No matching cards", ["<color=#8fe08f>✔ 已拥有 · 点击移除</color> "] = "<color=#8fe08f>✔ Owned · click to remove</color> ", ["(内部强化)"] = "(internal) ", ["(未知强化)"] = "(unknown upgrade)", ["已去掉:"] = "Removed: ", ["去掉失败:"] = "Remove failed: ", ["这个强化石没有可用的效果"] = "This stone has no usable effect", ["已加上:"] = "Added: ", ["加强化失败:"] = "Add failed: ", ["卡图加载中…"] = "Loading card art…", ["← 返回牌组"] = "← Back to deck", ["改卡:"] = "Edit: ", ["这张卡现在的强化"] = "Upgrades on this card", ["(没有强化)"] = "(none)", ["去掉"] = "Remove", ["加一个强化石(只列出能用在这张卡上的)"] = "Add an upgrade (only ones that fit this card)", ["(没有合适的强化石)"] = "(no fitting upgrades)", ["加上"] = "Add", ["虫裔"] = "Wurmkin", ["<color=#9be37a>已注能</color>"] = "<color=#9be37a>infused</color>", ["<color=#aaaaaa>未注能</color>"] = "<color=#aaaaaa>not infused</color>", ["加上注能"] = "Infuse", ["去掉注能"] = "Remove Infused", ["勇者卡不能复制"] = "Champion cards can't be copied", ["全部注能"] = "Infuse all", ["全部去注能"] = "Un-infuse all", ["操作失败"] = "Failed", [" 显示全部强化石(无视游戏限制)"] = " Show all upgrades (ignore the game's rules)", ["<color=#ff8a7a>游戏通常不允许用在这张卡上</color>"] = "<color=#ff8a7a>The game normally doesn't allow this on this card</color>", ["关闭"] = "Close", ["作弊"] = "Cheat" }; private bool pickerOpen; private PickerMode pickerMode; private string pSearch = ""; private bool pSearchText = true; private readonly HashSet<int> fClan = new HashSet<int>(); private readonly HashSet<int> fType = new HashSet<int>(); private readonly HashSet<int> fRarity = new HashSet<int>(); private readonly HashSet<int> fCost = new HashSet<int>(); private int fOwned; private bool pLogbookOnly = true; private int pSort; private int pAddCount = 1; private int pCardSize = 1; private Vector2 pSideScroll; private Vector2 pGridScroll; private float pScrollY; private Entry pHover; private Entry pHoverLatched; private int pHoverIdx = -1; private int pFocusIdx = -1; private CardUI pFocusUI; internal int pForceHoverIdx = -1; private Entry pFlash; private float pFlashUntil; private List<ClassData> classList = new List<ClassData>(); private List<Entry> pFiltered = new List<Entry>(); private string pFilterSig; private string pUserFilterSig; private GameObject pCanvasGo; private Canvas pCanvas; private RectTransform pCardRoot; private RectTransform pDim; private RectTransform pBlocker; private CardUI pPrefab; private Vector2 pCardNative = new Vector2(255f, 450f); private readonly Dictionary<int, CardUI> pAssigned = new Dictionary<int, CardUI>(); private readonly List<CardUI> pAllCardUIs = new List<CardUI>(); private readonly Stack<CardUI> pFree = new Stack<CardUI>(); private readonly Dictionary<CardData, float> pRequestedAt = new Dictionary<CardData, float>(); private string pAssignedSig; private int pCols; private int pVisFirst; private int pVisLast; private float pRowH; private float pCardK; private float pCardW; private float pCardH; private float pGridX0; private Rect pGridRect; private readonly Queue<string> pAddQueue = new Queue<string>(); private bool pAddRunning; private Dictionary<string, int> pDeckCounts = new Dictionary<string, int>(); private float pDeckCountsAt; private Dictionary<CardData, string> pCardText; private readonly List<float> pTileRowY = new List<float>(); private string pTileSig; private bool pDeckDelete = true; private bool pDeckEdit; private string pDeckSig = ""; private float pDeckSigAt; private Dictionary<string, Entry> pCardById; private GUIStyle sPanel; private GUIStyle sChip; private GUIStyle sChipOn; private GUIStyle sChipDanger; private GUIStyle sDeleteFrame; private GUIStyle sCellName; private GUIStyle sCellSub; private GUIStyle sHoverFrame; private GUIStyle sOwnedFrame; private GUIStyle sBadge; private GUIStyle sInfoTitle; private GUIStyle sInfo; private GUIStyle sTile; private GUIStyle sTileName; private GUIStyle sTileDesc; private static readonly CollectableRarity[] RarityValues; private static readonly string[] CostNames; private static readonly float[] RowsVisibleBySize; private const float TopH = 62f; private const float SideW = 300f; private const float Pad = 10f; private const float CardGap = 14f; private const float LabelH = 24f; private const float ScrollbarW = 18f; private const float TileW = 380f; private const float TileIcon = 84f; private const float TileGap = 10f; private ConfigEntry<KeyboardShortcut> toggleKey; private ConfigEntry<float> uiScale; private bool show; private Rect winRect = new Rect(30f, 60f, 760f, 900f); private int tab; private Vector2 scroll; private string goldInput = "9999"; private string emberInput = "99"; private string pyreMaxInput = "999"; private string capacityInput = "20"; private string status = ""; private float statusUntil; private List<Entry> cardEntries; private List<Entry> relicEntries; private List<Entry> enhancerEntries; private string[] classNames = new string[1] { T("全部") }; private string cachedLanguageProbe; private Font font; private bool stylesReady; private GUIStyle sWindow; private GUIStyle sLabel; private GUIStyle sLabelNW; private GUIStyle sSmall; private GUIStyle sButton; private GUIStyle sToggle; private GUIStyle sField; private GUIStyle sHeader; private GUIStyle sTab; private GUIStyle sTabOn; private GUIStyle sBox; private GUIStyle sBig; private static readonly BindingFlags AnyStatic; private static readonly FieldInfo SaveManagerField; private static readonly FieldInfo AllGameManagersField; private static readonly Regex TagRegex; private Runner runner; private static readonly CardType[] TypeFilterValues; private HashSet<CardData> logbookSet; private HashSet<CollectableRelicData> accessibleRelicSet; private RichTextCache richText; private static readonly PropertyInfo ActiveSaveDataProp; private bool pPendingTitanFix; private UnlockAction confirmAction; private UnlockAction pendingUnlock; private float confirmUntil; private string lastUnlockBackup; private bool TopBarMode { get { if (buttonInTopBar != null) { return buttonInTopBar.Value; } return true; } } private bool FloatButtonVisible { get { if (showButton != null && showButton.Value && !pickerOpen && (Object)(object)SM != (Object)null) { if (TopBarMode) { return (Object)(object)HudAnchor() != (Object)null; } return true; } return false; } } private static bool LocReady => GameLanguageOrNull() != null; private static bool IsZh => GameLanguageOrNull()?.StartsWith("Chinese", StringComparison.OrdinalIgnoreCase) ?? CultureInfo.CurrentUICulture.Name.StartsWith("zh", StringComparison.OrdinalIgnoreCase); private bool IsCardMode { get { if (pickerMode != PickerMode.Cards) { return pickerMode == PickerMode.Deck; } return true; } } private static string[] SortNames => new string[4] { T("默认"), T("费用"), T("名字"), T("稀有度") }; private static string[] RarityNames => RarityValues.Select(RarityName).ToArray(); private static string[] OwnedNames => new string[3] { T("全部"), T("已拥有"), T("未拥有") }; private static string[] SizeNames => new string[3] { T("小"), T("中"), T("大") }; private static string[] Tabs => new string[5] { T("常用"), T("加卡"), T("神器"), T("牌组"), T("强化石") }; private static SaveManager SM { get { object? obj = SaveManagerField?.GetValue(null); return (SaveManager)((obj is SaveManager) ? obj : null); } } private static AllGameManagers AGM { get { object? obj = AllGameManagersField?.GetValue(null); return (AllGameManagers)((obj is AllGameManagers) ? obj : null); } } private static string[] TypeFilterNames => new string[1] { T("全部") }.Concat(TypeFilterValues.Select(TypeName)).ToArray(); private RichTextCache Rich => richText ?? (richText = new RichTextCache(((BaseUnityPlugin)this).Logger)); private void InstallReplayPatch() { instance = this; if (CheatCommandField == null || DetectDoneM == null || CurrentEntryField == null || IsBusyProp == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"game changed: in-battle edits won't survive restart-turn"); } } private void DriveEditReplay() { //IL_002e: 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 (CurrentEntryField == null || CheatCommandField == null) { return; } try { if ((Object)(object)SM == (Object)null || ((object)SM.UndoMode/*cast due to .constrained prefix*/).ToString() == "None") { return; } ReplayManager replayManager = AGM.GetReplayManager(); if (!((Object)(object)replayManager == (Object)null) && replayManager.IsActivelyPlaying()) { object? value = CurrentEntryField.GetValue(replayManager); ReplayEntryCheatCommand val = (ReplayEntryCheatCommand)((value is ReplayEntryCheatCommand) ? value : null); if (val != null && !((ReplayEntry)val).IsPlaybackDone() && CheatCommandField.GetValue(val) is string text && text.StartsWith("MT2CheatGUI ", StringComparison.Ordinal)) { UpdateEditPlayback((ReplayEntry)(object)val, replayManager, text.Substring("MT2CheatGUI ".Length)); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("battle edit replay: " + ex)); } } private static bool ManagerUpdatePrefix(ReplayManager __instance) { if ((Object)(object)instance != (Object)null && Time.realtimeSinceStartup > nextDiag && __instance.IsActivelyPlaying()) { nextDiag = Time.realtimeSinceStartup + 1f; object? value = CurrentEntryField.GetValue(__instance); ReplayEntry val = (ReplayEntry)((value is ReplayEntry) ? value : null); ((BaseUnityPlugin)instance).Logger.LogInfo((object)$"replay step: entry={val} type={((object)val)?.GetType().Name} done={((val != null) ? new bool?(val.IsPlaybackDone()) : ((bool?)null))} busy={CheatManager.IsBusy} control={__instance.DoesPlayerHaveControlOfInput(false)}"); } if ((Object)(object)instance == (Object)null || !__instance.IsActivelyPlaying()) { return true; } object? value2 = CurrentEntryField.GetValue(__instance); ReplayEntryCheatCommand val2 = (ReplayEntryCheatCommand)((value2 is ReplayEntryCheatCommand) ? value2 : null); if (val2 == null || ((ReplayEntry)val2).IsPlaybackDone()) { return true; } if (!(CheatCommandField.GetValue(val2) is string text) || !text.StartsWith("MT2CheatGUI ", StringComparison.Ordinal)) { return true; } return instance.UpdateEditPlayback((ReplayEntry)(object)val2, __instance, text.Substring("MT2CheatGUI ".Length)); } private bool UpdateEditPlayback(ReplayEntry entry, ReplayManager replayManager, string cmd) { if (!editPlaybacks.TryGetValue(entry, out var value)) { if (editPlaybacks.Count > 64) { editPlaybacks.Clear(); } value = (editPlaybacks[entry] = new EditPlayback { started = Time.realtimeSinceStartup }); } if (!value.executed) { if (Time.realtimeSinceStartup - value.started > 10f) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("battle edit could not be replayed in time: " + cmd)); return true; } if (CheatManager.IsBusy || !replayManager.DoesPlayerHaveControlOfInput(false)) { if (Time.realtimeSinceStartup > nextWaitLog) { nextWaitLog = Time.realtimeSinceStartup + 1f; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"battle edit waits: busy={CheatManager.IsBusy} control={replayManager.DoesPlayerHaveControlOfInput(false)}"); } return false; } value.executed = true; replayingEdit = true; try { ((BaseUnityPlugin)this).Logger.LogInfo((object)("replaying battle edit: " + cmd)); Record(cmd); ExecEdit(cmd); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("replaying battle edit failed: " + cmd + " " + ex)); } finally { replayingEdit = false; } return false; } if (CheatManager.IsBusy) { return false; } bool flag = false; try { flag = (bool)DetectDoneM.Invoke(entry, new object[1] { replayManager }); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogError((object)("replaying battle edit: " + ex2)); } if (flag) { editPlaybacks.Remove(entry); return false; } if (Time.realtimeSinceStartup - value.started > 10f) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("battle edit replayed but not confirmed: " + cmd)); return true; } return false; } private bool Edit(string cmd) { if (InBattle()) { Record(cmd); } return ExecEdit(cmd); } private void Record(string cmd) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown try { AGM.GetReplayManager().RecordEntry((ReplayEntry)new ReplayEntryCheatCommand("MT2CheatGUI " + cmd)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("could not record battle edit: " + ex.Message)); } } private bool ExecEdit(string cmd) { string[] array = cmd.Split(' '); switch (array[0]) { case "gold": return Run("Command_AdjustGold", array[1]); case "ember": return Run("Command_Ember", array[1]); case "hp": return Run("Command_AdjustTowerHP", array[1]); case "maxhp": return Run("Command_AdjustTowerMaxHP", array[1]); case "draw": return Run("Command_DrawCards", array[1]); case "discardall": return Run("Command_DiscardAll"); case "cooldowns": return Run("Command_ClearAllAbilityCooldowns"); case "capacity": return Run("Command_SetCapacity", int.Parse(array[1]), int.Parse(array[2])); case "addcard": return Run("Command_AddCard", array[1], false); case "addrelic": return Run("Command_AddArtifact", array[1]); case "removerelic": return Run("Command_RemoveArtifact", array[1]); case "purge": return Purge(FindDeckCard(int.Parse(array[1]), array[2])); case "upgrade+": return AddUpgradeTo(FindDeckCard(int.Parse(array[1]), array[2]), array[3]); case "upgrade-": return RemoveUpgradeAt(FindDeckCard(int.Parse(array[1]), array[2]), int.Parse(array[3])); case "copy": return CopyDeckCard(FindDeckCard(int.Parse(array[1]), array[2])); case "infuseall": return (lastInfuseAllCount = InfuseAll(array[1] == "1")) >= 0; default: ((BaseUnityPlugin)this).Logger.LogWarning((object)("unknown battle edit: " + cmd)); return false; } } private static string DeckRef(CardState cs) { return SM.GetDeckState().IndexOf(cs) + " " + cs.GetCardDataID(); } private CardState FindDeckCard(int index, string cardDataId) { List<CardState> deckState = SM.GetDeckState(); if (index >= 0 && index < deckState.Count && deckState[index].GetCardDataID() == cardDataId) { return deckState[index]; } CardState? obj = ((IEnumerable<CardState>)deckState).FirstOrDefault((Func<CardState, bool>)((CardState x) => x.GetCardDataID() == cardDataId)); if (obj == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"battle edit: card {cardDataId} (#{index}) not in deck"); } return obj; } private bool Purge(CardState cs) { if (cs == null) { return false; } if (!InBattle()) { SM.RemoveCardFromDeck(cs); return true; } IsBusyProp?.SetValue(null, true); ((MonoBehaviour)SM).StartCoroutine(PurgeInBattle(cs)); return true; } private IEnumerator PurgeInBattle(CardState cs) { try { CardManager cm = AGM.GetCardManager(); MethodInfo method = typeof(CheatManager).GetMethod("PurgeCard", AnyStatic); yield return (IEnumerator)method.Invoke(null, new object[2] { cm, cs }); if (cm.GetDrawPile(false).Remove(cs)) { PilesChanged?.Invoke(cm, null); } } finally { IsBusyProp?.SetValue(null, false); } } private bool CopyDeckCard(CardState src) { if (src == null || src.IsChampionCard()) { return false; } CardState made = null; RelicEffectCardDuplicator.CopyExistingCardPermanently(SM, SM.GetAllGameData(), src, (Action<CardState>)delegate(CardState c) { made = c; }); if (made == null) { return false; } if (InBattle()) { SM.DrawSpecificCard(made); } return true; } private bool AddUpgradeTo(CardState cs, string upgradeDataId) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown CardUpgradeData val = SM.GetAllGameData().FindCardUpgradeData(upgradeDataId); if (cs == null || (Object)(object)val == (Object)null) { return false; } CardUpgradeState val2 = new CardUpgradeState(); val2.Setup(val, false, false); cs.ApplyPermanentUpgrade(val2, SM, true, (string)null); try { cs.RefreshCardBodyTextLocalization(); } catch { } return true; } private bool RemoveUpgradeAt(CardState cs, int index) { object obj; if (cs == null) { obj = null; } else { CardStateModifiers cardStateModifiers = cs.GetCardStateModifiers(); obj = ((cardStateModifiers != null) ? cardStateModifiers.GetCardUpgrades() : null); } List<CardUpgradeState> list = (List<CardUpgradeState>)obj; if (list == null || index < 0 || index >= list.Count) { return false; } bool result = cs.RemoveUpgrade(list[index], cs.GetCardStateModifiers(), (string)null); try { cs.RefreshCardBodyTextLocalization(); } catch { } return result; } private void RunPendingEdit() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown Action action = pPendingDeckOp; pPendingDeckOp = null; action?.Invoke(); if (pPreviewPending && pEditEntry != null && ArtReady((CardData)pEditEntry.data)) { RefreshPreview(); } Action action2 = pPendingEdit; pPendingEdit = null; if (action2 != null && pEditEntry != null) { action2(); } } private void OpenCardEdit(Entry e) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (e?.state != null) { pEditEntry = e; pEditScroll = Vector2.zero; pEditSearch = ""; RefreshPreview(); } } private void CloseCardEdit() { pEditEntry = null; if ((Object)(object)pPreviewUI != (Object)null) { ((Component)pPreviewUI).gameObject.SetActive(false); } pAssignedSig = null; } private void EnsurePreviewRoot() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)pPreviewRoot != (Object)null)) { pPreviewRoot = NewChild("Preview"); pPreviewRoot.anchorMin = Vector2.zero; pPreviewRoot.anchorMax = Vector2.one; RectTransform obj = pPreviewRoot; Vector2 offsetMin = (pPreviewRoot.offsetMax = Vector2.zero); obj.offsetMin = offsetMin; ((Component)pPreviewRoot).gameObject.layer = pCanvasGo.layer; } } private void RefreshPreview() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_0149: 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_00c6: Expected O, but got Unknown if (pEditEntry == null || (Object)(object)SM == (Object)null) { return; } EnsureCanvas(); EnsurePreviewRoot(); CardUI cardPrefab = GetCardPrefab(); if ((Object)(object)cardPrefab == (Object)null) { return; } if ((Object)(object)pPreviewUI == (Object)null) { pPreviewUI = Object.Instantiate<CardUI>(cardPrefab, (Transform)(object)pPreviewRoot, false); ((Object)pPreviewUI).name = "PickerPreviewCard"; } CardData val = (CardData)pEditEntry.data; if (!ArtReady(val)) { ((Component)pPreviewUI).gameObject.SetActive(false); if (!pRequestedAt.ContainsKey(val)) { pRequestedAt[val] = Time.realtimeSinceStartup; try { LoadingScreen.AddTask((LoadingTask)new LoadCardsForCompendium((IEnumerable<CardData>)new List<CardData> { val }, (DisplayStyle)0, (Action)null), true); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("preview art load failed: " + ex.Message)); } } pPreviewPending = true; return; } pPreviewPending = false; ((Component)pPreviewUI).gameObject.SetActive(true); try { pPreviewUI.SetCardVisibleAndInteractable(true, (HandUI)null); pPreviewUI.SetUIState((CardUIState)3); pPreviewUI.ApplyStateToUI(pEditEntry.state, (CardStatistics)null, (MonsterManager)null, (HeroManager)null, (RelicManager)null, SM, SM.GetMastery(pEditEntry.state), true, false, (List<CardUpgradeState>)null, (CardArtPool)null, (CardEdgeVfxPool)null); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("preview render failed: " + ex2.Message)); } } private EnhancerData EnhancerFor(string upgradeId) { if (pEnhancerByUpgrade == null) { pEnhancerByUpgrade = new Dictionary<string, EnhancerData>(); foreach (EnhancerData allEnhancerDatum in SM.GetAllGameData().GetAllEnhancerData()) { if ((Object)(object)allEnhancerDatum == (Object)null) { continue; } foreach (RelicEffectData item in ((RelicData)allEnhancerDatum).GetEffects() ?? new List<RelicEffectData>()) { CardUpgradeData val = null; try { val = ((item != null) ? item.GetParamCardUpgradeData() : null); } catch { } if ((Object)(object)val != (Object)null && !pEnhancerByUpgrade.ContainsKey(((GameData)val).GetID())) { pEnhancerByUpgrade[((GameData)val).GetID()] = allEnhancerDatum; } } } } if (!pEnhancerByUpgrade.TryGetValue(upgradeId ?? "", out var value)) { return null; } return value; } private static CardUpgradeData UpgradeDataOf(EnhancerData en) { foreach (RelicEffectData item in ((RelicData)en).GetEffects() ?? new List<RelicEffectData>()) { try { CardUpgradeData val = ((item != null) ? item.GetParamCardUpgradeData() : null); if ((Object)(object)val != (Object)null) { return val; } } catch { } } return null; } private List<UpgradeRow> CurrentUpgrades(CardState cs) { List<UpgradeRow> list = new List<UpgradeRow>(); List<CardUpgradeState> list2 = null; try { CardStateModifiers cardStateModifiers = cs.GetCardStateModifiers(); list2 = ((cardStateModifiers != null) ? cardStateModifiers.GetCardUpgrades() : null); } catch { } if (list2 == null) { return list; } foreach (CardUpgradeState u in list2.ToList()) { string upgradeId = Safe((Func<string>)u.GetCardUpgradeDataId); CardUpgradeData data = Safe2(() => u.GetSourceCardUpgradeData()); EnhancerData val = EnhancerFor(upgradeId); string text = (((Object)(object)val != (Object)null) ? Clean(Safe((Func<string>)((RelicData)val).GetName)) : ""); if (text.Length == 0 && (Object)(object)data != (Object)null) { text = Clean(Loc(() => LocalizationExtensions.Localize(data.GetUpgradeTitleKey(), (ILocalizationParameterContext)new CardEffectLocalizationContext((ILocalizationEffectPower)(object)data, (CharacterState)null, (CardState)null, (IRoomStateModifier)null, (CharacterStatusEffectAdjustments)null)))); } if (text.Length == 0 && (Object)(object)data != (Object)null) { text = Clean(TraitsText(data, "_CardText", "、")); } if (text.Length == 0) { text = (((Object)(object)data != (Object)null) ? (T("(内部强化)") + ((Object)data).name) : T("(未知强化)")); } string text2 = (((Object)(object)val != (Object)null) ? Clean(Safe((Func<string>)((RelicData)val).GetDescription)) : ""); if (text2.Length == 0 && (Object)(object)data != (Object)null) { text2 = Clean(Loc(() => LocalizationExtensions.Localize(data.GetUpgradeDescriptionKey(), (ILocalizationParameterContext)new CardEffectLocalizationContext((ILocalizationEffectPower)(object)data, (CharacterState)null, (CardState)null, (IRoomStateModifier)null, (CharacterStatusEffectAdjustments)null)))); } if (text2.Length == 0 && (Object)(object)data != (Object)null) { text2 = Clean(TraitsText(data, "_TooltipText", " ")); } Sprite icon = (((Object)(object)val != (Object)null) ? SafeIcon((RelicData)(object)val) : Safe2(delegate { CardUpgradeData obj2 = data; return (obj2 == null) ? null : obj2.GetUpgradeIcon(); })); string text3 = (((Object)(object)val != (Object)null) ? Safe((Func<string>)((RelicData)val).GetDescription) : ""); if (text3.Length == 0 && (Object)(object)data != (Object)null) { text3 = Loc(() => LocalizationExtensions.Localize(data.GetUpgradeDescriptionKey(), (ILocalizationParameterContext)new CardEffectLocalizationContext((ILocalizationEffectPower)(object)data, (CharacterState)null, (CardState)null, (IRoomStateModifier)null, (CharacterStatusEffectAdjustments)null))); } if (text3.Length == 0 && (Object)(object)data != (Object)null) { text3 = TraitsText(data, "_TooltipText", " "); } list.Add(new UpgradeRow { state = u, name = text, desc = text2, rich = text3, icon = icon }); } return list; } private static string Loc(Func<string> f) { string text = Safe(f); if (!text.Contains(">>")) { return text; } return ""; } private static string TraitsText(CardUpgradeData data, string suffix, string sep) { return string.Join(sep, from t in data.GetTraitDataUpgrades() ?? new List<CardTraitData>() select Loc(() => LocalizationExtensions.Localize(t.GetTraitStateName() + suffix, (ILocalizationParameterContext)null)) into s where s.Length > 0 select s); } private static bool AddsTrait(CardUpgradeData d, string trait) { if ((Object)(object)d != (Object)null) { return (d.GetTraitDataUpgrades() ?? new List<CardTraitData>()).Any((CardTraitData t) => t.GetTraitStateName() == trait); } return false; } private static bool IsInfused(CardState cs) { return Safe3(() => cs.HasTrait<CardTraitCorruptState>()); } private static bool Safe3(Func<bool> f) { try { return f(); } catch { return false; } } private CardUpgradeData InfusionUpgrade() { AllGameData allGameData = SM.GetAllGameData(); foreach (ClassData c in allGameData.GetAllClassDatas()) { CardUpgradeData val = (((Object)(object)c != (Object)null && c.IsWurmkin) ? Safe2(() => c.GetStarterCardUpgrade()) : null); if (AddsTrait(val, "CardTraitCorruptState")) { return val; } } return ((IEnumerable<CardUpgradeData>)allGameData.GetAllCardUpgradeData()).FirstOrDefault((Func<CardUpgradeData, bool>)((CardUpgradeData u) => (Object)(object)u != (Object)null && ((Object)u).name == "TraitCorrupt")); } private bool RunHasWurmkin() { return Safe3(delegate { ClassData mainClass = SM.GetMainClass(); if (mainClass == null || !mainClass.IsWurmkin) { ClassData subClass = SM.GetSubClass(); if (subClass == null) { return false; } return subClass.IsWurmkin; } return true; }); } private static string InfuseName() { string text = Clean(Loc(() => LocalizationExtensions.Localize("CardTraitCorruptState_CardText", (ILocalizationParameterContext)null))); if (text.Length <= 0) { return T("注能", "Infused"); } return text; } private bool SetInfused(bool on) { CardState state = pEditEntry.state; bool flag = false; try { if (on) { CardUpgradeData val = InfusionUpgrade(); flag = (Object)(object)val != (Object)null && Edit("upgrade+ " + DeckRef(state) + " " + ((GameData)val).GetID()); } else { flag = true; foreach (int item in InfusionUpgradeIndices(state)) { flag &= Edit($"upgrade- {DeckRef(state)} {item}"); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); flag = false; } flag &= IsInfused(state) == on; AfterCardChanged(flag ? ((on ? T("已加上:") : T("已去掉:")) + InfuseName()) : (on ? T("加强化失败") : (T("去掉失败:") + InfuseName()))); return flag; } private static List<int> InfusionUpgradeIndices(CardState cs) { List<int> list = new List<int>(); object obj; if (cs == null) { obj = null; } else { CardStateModifiers cardStateModifiers = cs.GetCardStateModifiers(); obj = ((cardStateModifiers != null) ? cardStateModifiers.GetCardUpgrades() : null); } List<CardUpgradeState> list2 = (List<CardUpgradeState>)obj; if (list2 == null) { return list; } for (int num = list2.Count - 1; num >= 0; num--) { CardUpgradeState u = list2[num]; if (AddsTrait(Safe2(() => u.GetSourceCardUpgradeData()), "CardTraitCorruptState")) { list.Add(num); } } return list; } private bool AnyDeckCardInfused() { try { return SM.GetDeckState().Any(IsInfused); } catch { return false; } } private int InfuseAll(bool on) { CardUpgradeData val = (on ? InfusionUpgrade() : null); if (on && (Object)(object)val == (Object)null) { return -1; } int num = 0; foreach (CardState item in SM.GetDeckState().ToList()) { if (item == null || Safe3((Func<bool>)item.IsChampionCard) || IsInfused(item) == on) { continue; } if (on) { if (AddUpgradeTo(item, ((GameData)val).GetID())) { num++; } continue; } foreach (int item2 in InfusionUpgradeIndices(item)) { RemoveUpgradeAt(item, item2); } if (!IsInfused(item)) { num++; } } return num; } private void InfuseAllFromUI(bool on) { bool flag = Edit(on ? "infuseall 1" : "infuseall 0"); pAssignedSig = null; if (!InBattle()) { Run("Command_Save"); } Toast((!flag) ? T("操作失败") : (on ? T($"已给 {lastInfuseAllCount} 张卡加上注能", $"Infused {lastInfuseAllCount} cards") : T($"已去掉 {lastInfuseAllCount} 张卡的注能", $"Removed Infused from {lastInfuseAllCount} cards"))); } private bool EnhancerFits(EnhancerData en, CardState cs) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) RelicEffectData val = null; foreach (RelicEffectData item in ((RelicData)en).GetEffects() ?? new List<RelicEffectData>()) { try { if ((Object)(object)((item != null) ? item.GetParamCardUpgradeData() : null) != (Object)null) { val = item; break; } } catch { } } if (val == null) { return false; } CardUpgradeData paramCardUpgradeData = val.GetParamCardUpgradeData(); try { if ((int)val.GetParamCardType() != 4 && cs.GetCardType() != val.GetParamCardType()) { return false; } if (!val.GetParamCharacterSubtype().IsNone) { foreach (CardEffectState effectState in cs.GetEffectStates()) { if (effectState.GetCardEffect() is CardEffectSpawnMonster && !effectState.GetParamCharacterData().GetSubtypes().Contains(val.GetParamCharacterSubtype())) { return false; } } } if (val.GetUseIntRange()) { int costWithoutAnyModifications = cs.GetCostWithoutAnyModifications(); if (costWithoutAnyModifications < val.GetParamMinInt() || costWithoutAnyModifications > val.GetParamMaxInt()) { return false; } } RelicManager relicManager = AGM.GetRelicManager(); List<CardUpgradeMaskData> list = new List<CardUpgradeMaskData>(paramCardUpgradeData.GetFilters() ?? new List<CardUpgradeMaskData>()); if ((Object)(object)val.GetParamCardFilter() != (Object)null) { list.Add(val.GetParamCardFilter()); } list.AddRange(DeckScreenDefaultUpgradeMasks()); foreach (CardUpgradeMaskData item2 in list) { if ((Object)(object)item2 != (Object)null && !item2.FilterCard<CardState>(cs, relicManager)) { return false; } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("EnhancerFits " + ((Object)en).name + ": " + ex.Message)); } return true; } private List<CardUpgradeMaskData> DeckScreenDefaultUpgradeMasks() { //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Invalid comparison between Unknown and I4 if (pDefaultUpgradeMasks != null) { return pDefaultUpgradeMasks; } List<CardUpgradeMaskData> list = new List<CardUpgradeMaskData>(); try { IScreen screen = AGM.GetScreenManager().GetScreen((ScreenName)3); DeckScreen obj = (DeckScreen)(object)((screen is DeckScreen) ? screen : null); if (typeof(DeckScreen).GetField("defaultFilters", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(obj) is IEnumerable enumerable) { foreach (object item in enumerable) { Type type = item.GetType(); if (type.GetField("mode")?.GetValue(item) is Mode val && (int)val == 6 && type.GetField("masks")?.GetValue(item) is IEnumerable<CardUpgradeMaskData> collection) { list.AddRange(collection); } } } pDefaultUpgradeMasks = list; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("default upgrade masks: " + ex.Message)); } return list; } private void AfterCardChanged(string msg) { try { pEditEntry.state.RefreshCardBodyTextLocalization(); } catch { } RefreshPreview(); pAssignedSig = null; if (!InBattle()) { Run("Command_Save"); } Toast(msg); } private bool RemoveCardUpgrade(UpgradeRow row) { CardState state = pEditEntry.state; bool flag = false; try { int num = state.GetCardStateModifiers().GetCardUpgrades().IndexOf(row.state); flag = num >= 0 && Edit($"upgrade- {DeckRef(state)} {num}"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); } AfterCardChanged(flag ? (T("已去掉:") + row.name) : (T("去掉失败:") + row.name)); return flag; } private bool AddCardUpgrade(EnhancerData en) { CardState state = pEditEntry.state; CardUpgradeData val = UpgradeDataOf(en); if ((Object)(object)val == (Object)null) { Toast(T("这个强化石没有可用的效果")); return false; } try { if (!Edit("upgrade+ " + DeckRef(state) + " " + ((GameData)val).GetID())) { Toast(T("加强化失败")); return false; } AfterCardChanged(T("已加上:") + Clean(Safe((Func<string>)((RelicData)en).GetName))); return true; } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); Toast(T("加强化失败:") + ex.Message); return false; } } private int CurrentUpgradeCount() { if (pEditEntry?.state != null) { return Safe2(delegate { CardStateModifiers cardStateModifiers = pEditEntry.state.GetCardStateModifiers(); return (cardStateModifiers == null) ? null : cardStateModifiers.GetCardUpgrades(); })?.Count ?? (-1); } return -1; } private void DrawCardEdit(Rect grid) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_0817: Expected O, but got Unknown //IL_0887: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Expected O, but got Unknown CardState cs = pEditEntry.state; float num = Mathf.Min(((Rect)(ref grid)).width * 0.32f, 460f); GUI.Box(new Rect(((Rect)(ref grid)).x + num, ((Rect)(ref grid)).y - 10f, ((Rect)(ref grid)).width - num, ((Rect)(ref grid)).height + 10f), GUIContent.none, sPanel); float num2 = Mathf.Min((num - 40f) / pCardNative.x, (((Rect)(ref grid)).height - 120f) / (pCardNative.y * 1.08f)); if ((Object)(object)pPreviewUI != (Object)null) { RectTransform val = (RectTransform)((Component)pPreviewUI).transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 1f); val.anchorMax = val2; val.anchorMin = val2; val.pivot = new Vector2(0.5f, 0.5f); val.anchoredPosition = new Vector2(((Rect)(ref grid)).x + num / 2f, 0f - (((Rect)(ref grid)).y + (((Rect)(ref grid)).height - 60f) / 2f)); ((Transform)val).localScale = new Vector3(num2, num2, 1f); } if (pPreviewPending) { GUI.Label(new Rect(((Rect)(ref grid)).x, ((Rect)(ref grid)).y + ((Rect)(ref grid)).height / 2f - 20f, num, 40f), T("卡图加载中…"), sCellName); } if (GUI.Button(new Rect(((Rect)(ref grid)).x + 20f, ((Rect)(ref grid)).yMax - 52f, num - 40f, 40f), T("← 返回牌组"), sBig)) { CloseCardEdit(); return; } Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(((Rect)(ref grid)).x + num + 10f, ((Rect)(ref grid)).y, ((Rect)(ref grid)).width - num - 20f, ((Rect)(ref grid)).height - 4f); GUILayout.BeginArea(val3); try { GUILayout.Label(T("改卡:") + pEditEntry.name, sInfoTitle, Array.Empty<GUILayoutOption>()); pEditScroll = GUILayout.BeginScrollView(pEditScroll, Array.Empty<GUILayoutOption>()); try { GUILayout.Label(T("这张卡现在的强化"), sHeader, Array.Empty<GUILayoutOption>()); List<UpgradeRow> list = CurrentUpgrades(cs); if (list.Count == 0) { GUILayout.Label(T("(没有强化)"), sSmall, Array.Empty<GUILayoutOption>()); } foreach (UpgradeRow item in list) { GUILayout.BeginHorizontal(sBox, Array.Empty<GUILayoutOption>()); DrawSprite(GUILayoutUtility.GetRect(56f, 56f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(56f), GUILayout.Height(56f) }), item.icon); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>" + item.name + "</b>", sLabel, Array.Empty<GUILayoutOption>()); if (item.desc.Length > 0) { LayoutRich(item.rich, item.desc, sSmall, Mathf.Max(80f, ((Rect)(ref val3)).width - 56f - 80f - 60f)); } GUILayout.EndVertical(); if (GUILayout.Button(T("去掉"), sChipDanger, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(80f), GUILayout.Height(40f) })) { UpgradeRow r = item; pPendingEdit = delegate { RemoveCardUpgrade(r); }; } GUILayout.EndHorizontal(); } bool flag = IsInfused(cs); if (flag || RunHasWurmkin()) { GUILayout.Space(8f); GUILayout.BeginHorizontal(sBox, Array.Empty<GUILayoutOption>()); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>" + T("虫裔") + " · " + InfuseName() + "</b>\u3000" + (flag ? T("<color=#9be37a>已注能</color>") : T("<color=#aaaaaa>未注能</color>")), sLabel, Array.Empty<GUILayoutOption>()); string text = Loc(() => LocalizationExtensions.Localize("CardTraitCorruptState_TooltipText", (ILocalizationParameterContext)null)); if (text.Length > 0) { LayoutRich(text, Clean(text), sSmall, Mathf.Max(80f, ((Rect)(ref val3)).width - 140f - 60f)); } GUILayout.EndVertical(); if (GUILayout.Button(flag ? T("去掉注能") : T("加上注能"), flag ? sChipDanger : sChipOn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(40f) })) { bool want = !flag; pPendingEdit = delegate { SetInfused(want); }; } GUILayout.EndHorizontal(); } GUILayout.Space(12f); GUILayout.Label(T("加一个强化石(只列出能用在这张卡上的)"), sHeader, Array.Empty<GUILayoutOption>()); pEditIgnoreRules = GUILayout.Toggle(pEditIgnoreRules, T(" 显示全部强化石(无视游戏限制)"), sToggle, Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(T("搜索"), sLabelNW, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) }); pEditSearch = GUILayout.TextField(pEditSearch, 30, sField, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(260f) }); GUILayout.EndHorizontal(); string q = (pEditSearch ?? "").Trim().ToLowerInvariant(); List<Entry> list2 = (enhancerEntries ?? new List<Entry>()).Where((Entry en) => (Object)(object)UpgradeDataOf((EnhancerData)en.data) != (Object)null && (pEditIgnoreRules || EnhancerFits((EnhancerData)en.data, cs)) && (q.Length == 0 || en.searchKey.Contains(q))).ToList(); if (list2.Count == 0) { GUILayout.Label(T("(没有合适的强化石)"), sSmall, Array.Empty<GUILayoutOption>()); } int num3 = Mathf.Max(1, Mathf.FloorToInt((((Rect)(ref val3)).width - 30f) / 330f)); for (int num4 = 0; num4 < list2.Count; num4 += num3) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); foreach (Entry item2 in list2.Skip(num4).Take(num3)) { GUILayout.BeginHorizontal(sBox, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width((((Rect)(ref val3)).width - 30f) / (float)num3 - 6f) }); DrawSprite(GUILayoutUtility.GetRect(44f, 44f, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(44f), GUILayout.Height(44f) }), item2.icon); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); GUILayout.Label("<b>" + item2.name + "</b>", sLabel, Array.Empty<GUILayoutOption>()); LayoutRich(item2.rich, item2.desc ?? "", sSmall, Mathf.Max(60f, (((Rect)(ref val3)).width - 30f) / (float)num3 - 6f - 44f - 60f - 28f)); if (pEditIgnoreRules && !EnhancerFits((EnhancerData)item2.data, cs)) { GUILayout.Label(T("<color=#ff8a7a>游戏通常不允许用在这张卡上</color>"), sSmall, Array.Empty<GUILayoutOption>()); } GUILayout.EndVertical(); if (GUILayout.Button(T("加上"), sChipOn, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(60f), GUILayout.Height(36f) })) { EnhancerData d = (EnhancerData)item2.data; pPendingEdit = delegate { AddCardUpgrade(d); }; } GUILayout.EndHorizontal(); } GUILayout.EndHorizontal(); } } finally { GUILayout.EndScrollView(); } } finally { GUILayout.EndArea(); } } private static IEnumerator WaitReal(float seconds) { float until = Time.realtimeSinceStartup + seconds; while (Time.realtimeSinceStartup < until) { yield return null; } } private IEnumerator WaitFor(Func<bool> cond, float timeout, string what) { float until = Time.realtimeSinceStartup + timeout; while (Time.realtimeSinceStartup < until) { bool flag = false; try { flag = cond(); } catch { } if (flag) { yield break; } yield return null; } ((BaseUnityPlugin)this).Logger.LogWarning((object)("timeout waiting for " + what)); } private static Rect ScreenRectOf(RectTransform rt) { //IL_0009: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00e2: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)rt == (Object)null) { return Rect.zero; } Vector3[] array = (Vector3[])(object)new Vector3[4]; rt.GetWorldCorners(array); Canvas componentInParent = ((Component)rt).GetComponentInParent<Canvas>(); Canvas val = ((componentInParent != null) ? componentInParent.rootCanvas : null); Camera val2 = (((Object)(object)val != (Object)null && (int)val.renderMode != 0) ? val.worldCamera : null); float num = float.MaxValue; float num2 = float.MaxValue; float num3 = float.MinValue; float num4 = float.MinValue; Vector3[] array2 = array; foreach (Vector3 val3 in array2) { Vector2 val4 = RectTransformUtility.WorldToScreenPoint(val2, val3); num = Mathf.Min(num, val4.x); num3 = Mathf.Max(num3, val4.x); num2 = Mathf.Min(num2, val4.y); num4 = Mathf.Max(num4, val4.y); } return new Rect(num, (float)Screen.height - num4, num3 - num, num4 - num2); } private static Rect VisibleRectOf(GameObject go) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) Rect result = Rect.zero; bool flag = false; Graphic[] componentsInChildren = go.GetComponentsInChildren<Graphic>(false); foreach (Graphic val in componentsInChildren) { if (!((Behaviour)val).enabled || val.color.a < 0.05f || val.canvasRenderer.GetAlpha() < 0.05f) { continue; } Rect val2 = ScreenRectOf(val.rectTransform); if (!(((Rect)(ref val2)).width < 2f) && !(((Rect)(ref val2)).height < 2f)) { if (!flag) { result = val2; flag = true; } else { result = Rect.MinMaxRect(Mathf.Min(((Rect)(ref result)).xMin, ((Rect)(ref val2)).xMin), Mathf.Min(((Rect)(ref result)).yMin, ((Rect)(ref val2)).yMin), Mathf.Max(((Rect)(ref result)).xMax, ((Rect)(ref val2)).xMax), Mathf.Max(((Rect)(ref result)).yMax, ((Rect)(ref val2)).yMax)); } } } return result; } private static Texture2D MakeFramedTex(Color fill, Color rim) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(12, 12) { hideFlags = (HideFlags)61, filterMode = (FilterMode)0 }; for (int i = 0; i < 12; i++) { for (int j = 0; j < 12; j++) { val.SetPixel(j, i, (j < 2 || i < 2 || j > 9 || i > 9) ? rim : fill); } } val.Apply(); return val; } private void BindButtonConfig() { showButton = ((BaseUnityPlugin)this).Config.Bind<bool>("Button", "ShowButton", true, "显示打开面板的按钮 / Show the button that opens the panel"); buttonX = ((BaseUnityPlugin)this).Config.Bind<float>("Button", "PositionX", 0.004f, "自由位置模式下按钮的横向位置 0~1 / Button X (0~1) when InTopBar = false"); buttonY = ((BaseUnityPlugin)this).Config.Bind<float>("Button", "PositionY", 0.4f, "自由位置模式下按钮的纵向位置 0~1 / Button Y (0~1) when InTopBar = false"); buttonInTopBar = ((BaseUnityPlugin)this).Config.Bind<bool>("Button", "InTopBar", true, "true = 按钮在顶部状态栏(神器右边、氏族图标左边),false = 自由位置可拖动 / true = button in the top bar (between artifacts and clan icons), false = free draggable position"); } private RectTransform HudAnchor() { if ((Object)(object)hudClassesUI == (Object)null && Time.realtimeSinceStartup > hudLookupAt) { hudLookupAt = Time.realtimeSinceStartup + 1f; try { AllGameManagers aGM = AGM; object obj; if (aGM == null) { obj = null; } else { ScreenManager screenManager = aGM.GetScreenManager(); obj = ((screenManager != null) ? screenManager.GetScreen((ScreenName)14) : null); } IScreen val = (IScreen)obj; object? obj2 = ((object)val)?.GetType().GetField("classesUI", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(val); Component val2 = (Component)((obj2 is Component) ? obj2 : null); hudClassesUI = (RectTransform)(((Object)(object)val2 != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); } catch { hudClassesUI = null; } } if (!((Object)(object)hudClassesUI != (Object)null) || !((Component)hudClassesUI).gameObject.activeInHierarchy) { return null; } return hudClassesUI; } private Rect FloatButtonRect(float s) { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (TopBarMode) { RectTransform val = HudAnchor(); if ((Object)(object)val != (Object)null) { Rect val2 = ScreenRectOf(val); float num = Mathf.Clamp(((Rect)(ref val2)).height / s - 18f, 36f, 60f); float num2 = num; return new Rect(((Rect)(ref val2)).x / s - num2 - 8f, ((Rect)(ref val2)).y / s + (((Rect)(ref val2)).height / s - num) / 2f, num2, num); } } float num3 = (float)Screen.width / s; float num4 = (float)Screen.height / s; float num5 = Mathf.Clamp(buttonX.Value * num3, 0f, num3 - 64f); float num6 = Mathf.Clamp(buttonY.Value * num4, 0f, num4 - 64f); return new Rect(num5, num6, 64f, 64f); } private void EnsureButtonBlocker() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) if (!((Object)(object)pBtnBlocker != (Object)null)) { pBtnBlocker = NewChild("ButtonBlocker", typeof(Image)); RectTransform obj = pBtnBlocker; RectTransform obj2 = pBtnBlocker; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); obj2.anchorMax = val; obj.anchorMin = val; pBtnBlocker.pivot = new Vector2(0f, 1f); Image component = ((Component)pBtnBlocker).GetComponent<Image>(); ((Graphic)component).color = new Color(0f, 0f, 0f, 0.004f); ((Graphic)component).raycastTarget = true; } } private void SyncButtonBlocker(float s, int layer) { //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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) EnsureButtonBlocker(); ((Component)pBtnBlocker).gameObject.layer = layer; bool floatButtonVisible = FloatButtonVisible; ((Component)pBtnBlocker).gameObject.SetActive(floatButtonVisible); if (floatButtonVisible) { Rect val = FloatButtonRect(s); pBtnBlocker.anchoredPosition = new Vector2(((Rect)(ref val)).x, 0f - ((Rect)(ref val)).y); pBtnBlocker.sizeDelta = new Vector2(((Rect)(ref val)).width, ((Rect)(ref val)).height); } } private void HandleButtonToggle() { if (btnToggleRequested) { btnToggleRequested = false; ToggleFromButton(); } } private void ToggleFromButton() { if (pickerOpen) { ClosePicker(); show = false; } else { show = !show; } } private void DrawFloatButton(float s) { //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: 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) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0050: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01b0: Expected O, but got Unknown //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: 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_0295: Expected I4, but got Unknown //IL_03bb: 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_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: 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_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Expected O, but got Unknown //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04e7: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) if (!FloatButtonVisible) { return; } if (sFloatBtn == null) { sFloatBtn = new GUIStyle { font = font, fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, border = new RectOffset(3, 3, 3, 3) }; sFloatBtn.normal.background = MakeFramedTex(new Color(0.13f, 0.11f, 0.1f, 0.96f), new Color(0.86f, 0.66f, 0.3f, 1f)); sFloatBtn.hover.background = MakeFramedTex(new Color(0.32f, 0.22f, 0.1f, 0.98f), new Color(1f, 0.82f, 0.45f, 1f)); sFloatBtn.normal.textColor = new Color(1f, 0.84f, 0.5f); sFloatBtn.hover.textColor = Color.white; sFloatBtnOn = new GUIStyle(sFloatBtn); GUIStyleState normal = sFloatBtnOn.normal; Texture2D background = (sFloatBtnOn.hover.background = MakeFramedTex(new Color(0.45f, 0.3f, 0.1f, 0.98f), new Color(1f, 0.9f, 0.6f, 1f))); normal.background = background; sBtnTip = new GUIStyle(sSmall) { alignment = (TextAnchor)4, wordWrap = false, padding = new RectOffset(8, 8, 4, 4) }; sBtnTip.normal.background = MakeFramedTex(new Color(0.08f, 0.07f, 0.09f, 0.96f), new Color(0.86f, 0.66f, 0.3f, 1f)); sBtnTip.border = new RectOffset(3, 3, 3, 3); sBtnTip.normal.textColor = new Color(1f, 0.9f, 0.7f); } Texture2D val2 = ButtonIcon(); Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.Scale(new Vector3(s, s, 1f)); try { Rect val3 = FloatButtonRect(s); Event current = Event.current; float num = (float)Screen.width / s; float num2 = (float)Screen.height / s; EventType type = current.type; switch ((int)type) { case 0: if (current.button == 0 && ((Rect)(ref val3)).Contains(current.mousePosition)) { btnDragging = true; btnMoved = false; btnDragStartMouse = current.mousePosition; btnDragStartPos = new Vector2(((Rect)(ref val3)).x, ((Rect)(ref val3)).y); current.Use(); } break; case 3: if (btnDragging) { Vector2 val4 = current.mousePosition - btnDragStartMouse; if (((Vector2)(ref val4)).magnitude > 4f && !TopBarMode) { btnMoved = true; } if (btnMoved) { buttonX.Value = Mathf.Clamp01((btnDragStartPos.x + val4.x) / num); buttonY.Value = Mathf.Clamp01((btnDragStartPos.y + val4.y) / num2); } current.Use(); } break; case 1: if (btnDragging) { btnDragging = false; if (!btnMoved) { btnToggleRequested = true; } current.Use(); } break; } bool flag = ((Rect)(ref val3)).Contains(current.mousePosition) || btnForceHover; if (show) { GUI.Box(val3, GUIContent.none, sFloatBtnOn); } else if (flag || !TopBarMode) { GUI.Box(val3, GUIContent.none, sFloatBtn); } if ((Object)(object)val2 != (Object)null) { float num3 = ((Rect)(ref val3)).height * 0.12f; GUI.DrawTexture(new Rect(((Rect)(ref val3)).x + num3, ((Rect)(ref val3)).y + num3, ((Rect)(ref val3)).width - 2f * num3, ((Rect)(ref val3)).height - 2f * num3), (Texture)(object)val2, (ScaleMode)2, true); } else { GUI.Box(val3, show ? T("关闭") : T("作弊"), sFloatBtn); } if (flag) { GUIContent val5 = new GUIContent(T($"作弊面板({toggleKey.Value})", $"Cheat panel ({toggleKey.Value})")); Vector2 val6 = sBtnTip.CalcSize(val5); GUI.Box(new Rect(((Rect)(ref val3)).center.x - val6.x / 2f, ((Rect)(ref val3)).yMax + 6f, val6.x, val6.y), val5, sBtnTip); } } finally { GUI.matrix = matrix; } } private Texture2D ButtonIcon() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown if (buttonIconTried) { return buttonIcon; } buttonIconTried = true; try { using Stream stream = typeof(Plugin).Assembly.GetManifestResourceStream("MT2CheatGUI.button_icon.png"); if (stream == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"button icon resource missing"); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false) { hideFlags = (HideFlags)61, filterMode = (FilterMode)1 }; if (ImageConversion.LoadImage(val, array)) { buttonIcon = val; } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("button icon load failed: " + ex.Message)); } return buttonIcon; } private static string GameLanguageOrNull() { try { string text = I2CurrentLanguageField?.GetValue(null) as string; return string.IsNullOrEmpty(text) ? null : text; } catch { return null; } } private static string T(string zh) { if (!IsZh) { if (!En.TryGetValue(zh, out var value)) { return zh; } return value; } return zh; } private static string T(string zh, string en) { if (!IsZh) { return en; } return zh; } private static string GameTerm(string key, string fallbackZh) { try { if (LocReady && LocalizationExtensions.HasTranslation(key)) { string text = LocalizationExtensions.Localize(key, (ILocalizationParameterContext)null); if (!string.IsNullOrWhiteSpace(text) && !text.Contains(">>")) { return text; } } } catch { } return T(fallbackZh); } private void BuildPickerStyles() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown //IL_00c0: 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_00cf: Expected O, but got Unknown //IL_00d4: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_029f: 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) //IL_02b9: Expected O, but got Unknown //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Expected O, but got Unknown //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Expected O, but got Unknown //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown //IL_0445: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_046f: Expected O, but got Unknown //IL_0489: Unknown result type (might be due to invalid IL or missing references) sPanel = new GUIStyle(GUI.skin.box); sPanel.normal.background = MakeTex(new Color(0.07f, 0.07f, 0.1f, 1f)); sPanel.normal.textColor = new Color(0.8f, 0.8f, 0.85f); sPanel.font = font; sPanel.fontSize = 14; sPanel.alignment = (TextAnchor)4; sPanel.wordWrap = true; sChip = new GUIStyle(sButton) { fontSize = 14, margin = new RectOffset(2, 2, 2, 2), padding = new RectOffset(4, 4, 3, 3) }; sChipOn = new GUIStyle(sChip) { fontStyle = (FontStyle)1 }; GUIStyleState normal = sChipOn.normal; GUIStyleState hover = sChipOn.hover; Texture2D val = (sChipOn.active.background = MakeTex(new Color(0.75f, 0.48f, 0.15f, 1f))); Texture2D background = (hover.background = val); normal.background = background; GUIStyleState normal2 = sChipOn.normal; Color textColor = (sChipOn.hover.textColor = Color.white); normal2.textColor = textColor; sCellName = new GUIStyle(sLabel) { fontSize = 14, alignment = (TextAnchor)1, wordWrap = true }; sCellName.normal.textColor = Color.white; sCellSub = new GUIStyle(sCellName) { fontSize = 13 }; sCellSub.normal.textColor = new Color(0.62f, 0.9f, 0.62f); sChipDanger = new GUIStyle(sChip) { fontStyle = (FontStyle)1 }; GUIStyleState normal3 = sChipDanger.normal; GUIStyleState hover2 = sChipDanger.hover; val = (sChipDanger.active.background = MakeTex(new Color(0.75f, 0.18f, 0.15f, 1f))); background = (hover2.background = val); normal3.background = background; GUIStyleState normal4 = sChipDanger.normal; textColor = (sChipDanger.hover.textColor = Color.white); normal4.textColor = textColor; sDeleteFrame = new GUIStyle(); sDeleteFrame.normal.background = MakeTex(new Color(1f, 0.2f, 0.15f, 0.28f)); sHoverFrame = new GUIStyle(); sHoverFrame.normal.background = MakeTex(new Color(1f, 0.85f, 0.4f, 0.16f)); sOwnedFrame = new GUIStyle(); sOwnedFrame.normal.background = MakeTex(new Color(0.3f, 0.9f, 0.4f, 0.16f)); sBadge = new GUIStyle(sLabel) { fontSize = 22, fontStyle = (FontStyle)1, alignment = (TextAnchor)4 }; sBadge.normal.textColor = new Color(0.55f, 1f, 0.55f); sBadge.normal.background = MakeTex(new Color(0f, 0f, 0f, 0.7f)); sInfoTitle = new GUIStyle(sHeader) { fontSize = 17 }; sInfo = new GUIStyle(sLabel) { fontSize = 14 }; sTile = new GUIStyle(); sTile.normal.background = MakeTex(new Color(1f, 1f, 1f, 0.06f)); sTileName = new GUIStyle(sLabel) { fontSize = 16, fontStyle = (FontStyle)1, wordWrap = true }; sTileName.normal.textColor = new Color(1f, 0.86f, 0.55f); sTileDesc = new GUIStyle(sLabel) { fontSize = 14, wordWrap = true }; sTileDesc.normal.textColor = new Color(0.88f, 0.88f, 0.92f); } private void OpenPicker(PickerMode mode) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) if (!InRun()) { Toast(T("要先开始或继续一局游戏才能用")); return; } EnsureData(); if (pickerMode != mode) { fClan.Clear(); fType.Clear(); fRarity.Clear(); fCost.Clear(); fOwned = 0; pSearch = ""; } pickerMode = mode; pickerOpen = true; pScrollY = 0f; pGridScroll = Vector2.zero; pFilterSig = null; pTileSig = null; } private void ClosePicker() { pickerOpen = false; if (pEditEntry != null) { CloseCardEdit(); } DestroyCardUIs(); if ((Object)(object)pCardRoot != (Object)null) { ((Component)pCardRoot).gameObject.SetActive(false); } if ((Object)(object)pDim != (Object)null) { ((Component)pDim).gameObject.SetActive(false); } } private void DestroyCardUIs() { pFocusUI = null; pFocusIdx = (pHoverIdx = -1); foreach (CardUI pAllCardUI in pAllCardUIs) { if ((Object)(object)pAllCardUI != (Object)null) { Object.Destroy((Object)(object)((Component)pAllCardUI).gameObject); } } pAllCardUIs.Clear(); pAssigned.Clear(); pFree.Clear(); pAssignedSig = null; } private RectTransform NewChild(string name, params Type[] comps) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }.Concat(comps).ToArray()); val.transform.SetParent(pCanvasGo.transform, false); return (RectTransform)val.transform; } private void EnsureCanvas() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)pCanvasGo != (Object)null)) { pCanvasGo = new GameObject("MT2CheatGUI_Canvas"); Object.DontDestroyOnLoad((Object)(object)pCanvasGo); pCanvas = pCanvasGo.AddComponent<Canvas>(); pCanvas.renderMode = (RenderMode)0; pCanvas.sortingOrder = 32000; pCanvasGo.AddComponent<GraphicRaycaster>(); pDim = NewChild("Dim", typeof(Image)); pDim.anchorMin = Vector2.zero; pDim.anchorMax = Vector2.one; Vector2 val = (pDim.offsetMin = (pDim.offsetMax = Vector2.zero)); Image component = ((Component)pDim).GetComponent<Image>(); ((Graphic)component).color = new Color(0.035f, 0.035f, 0.055f, 1f); ((Graphic)component).raycastTarget = true; pCardRoot = NewChild("Cards", typeof(CanvasGroup)); pCardRoot.anchorMin = Vector2.zero; pCardRoot.anchorMax = Vector2.one; val = (pCardRoot.offsetMin = (pCardRoot.offsetMax = Vector2.zero)); CanvasGroup component2 = ((Component)pCardRoot).GetComponent<CanvasGroup>(); component2.interactable = false; component2.blocksRaycasts = false; pBlocker = NewChild("PanelBlocker", typeof(Image)); RectTransform obj = pBlocker; RectTransform obj2 = pBlocker; ((Vector2)(ref val))..ctor(0f, 1f); obj2.anchorMax = val; obj.anchorMin = val; pBlocker.pivot = new Vector2(0f, 1f); Image component3 = ((Component)pBlocker).GetComponent<Image>(); ((Graphic)component3).color = new Color(0f, 0f, 0f, 0.004f); ((Graphic)component3).raycastTarget = true; } } private void SyncCanvas(float s, bool panelVisible) { //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) EnsureCanvas(); pCanvas.scaleFactor = s; int num = GuiLayer(); if (pCanvasGo.layer != num) { pCanvasGo.layer = num; ((Component)pDim).gameObject.layer = num; ((Component)pBlocker).gameObject.layer = num; ((Component)pCardRoot).gameObject.layer = num; } ((Component)pDim).gameObject.SetActive(pickerOpen); ((Component)pCardRoot).gameObject.SetActive(pickerOpen && IsCardMode && pEditEntry == null); if ((Object)(object)pPreviewRoot != (Object)null) { ((Component)pPreviewRoot).gameObject.SetActive(pickerOpen && pEditEntry != null); } SyncButtonBlocker(s, num); ((Component)pBlocker).gameObject.SetActive(panelVisible && !pickerOpen); if (panelVisible) { pBlocker.anchoredPosition = new Vector2(((Rect)(ref winRect)).x, 0f - ((Rect)(ref winRect)).y); pBlocker.sizeDelta = new Vector2(((Rect)(ref winRect)).width, ((Rect)(ref winRect)).height); } } private static int GuiLayer() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) int num = 0; try { LayerMask currentGuiLayers = CoreInput.currentGuiLayers; num = ((LayerMask)(ref currentGuiLayers)).value; } catch { } int num2 = LayerMask.NameToLayer("UI"); if (num2 >= 0 && (num & (1 << num2)) != 0) { return num2; } for (int i = 0; i < 32; i++) { if ((num & (1 << i)) != 0) { return i; } } if (num2 < 0) { return 5; } return num2; } private CardUI GetCardPrefab() { if ((Object)(object)pPrefab != (Object)null) { return pPrefab; } try { IScreen screen = AGM.GetScreenManager().GetScreen((ScreenName)3); DeckScreen val = (DeckScreen)(object)((screen is DeckScreen) ? screen : null); if ((Object)(object)val != (Object)null) { ref CardUI reference = ref pPrefab; object? obj = typeof(DeckScreen).GetField("cardPrefab", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(val); reference = (CardUI)((obj is CardUI) ? obj : null); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("card prefab via DeckScreen failed: " + ex.Message)); } if ((Object)(object)pPrefab == (Object)null) { pPrefab = ((IEnumerable<CardUI>)Resources.FindObjectsOfTypeAll<CardUI>()).FirstOrDefault((Func<CardUI, bool>)delegate(CardUI c) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Scene scene = ((Component)c).gameObject.scene; return !((Scene)(ref scene)).IsValid(); }); } return pPrefab; } private static bool ArtReady(CardData cd) { try { GameObject val = default(GameObject); return cd.GetCardArtPrefabVariant(ref val); } catch { return false; } } private bool ArtFailed(CardData cd) { if (pRequestedAt.TryGetValue(cd, out var value) && Time.realtimeSinceStartup - value > 15f) { return !ArtReady(cd); } return false; } private void UpdateCardGrid() { //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_03d7: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Expected O, but got Unknown if (!pickerOpen || !IsCardMode || pCols <= 0) { return; } SaveManager sM = SM; if ((Object)(object)sM == (Object)null) { return; } if (pAssignedSig != pFilterSig) { foreach (KeyValuePair<int, CardUI> item in pAssigned) { Unfocus(item.Value); ((Component)item.Value).gameObject.SetActive(false); pFree.Push(item.Value); } pAssigned.Clear(); pAssignedSig = pFilterSig; } int first = Mathf.Max(0, pVisFirst - pCols); int last = Mathf.Min(pFiltered.Count - 1, pVisLast + pCols); foreach (int item2 in pAssigned.Keys.Where((int i) => i < first || i > last).ToList()) { CardUI val = pAssigned[item2]; Unfocus(val); ((Component)val).gameObject.SetActive(false); pFree.Push(val); pAssigned.Remove(item2); } List<CardData> list = new List<CardData>(); for (int num = first; num <= last; num++) { if (!pAssigned.ContainsKey(num)) { CardData val2 = (CardData)pFiltered[num].data; if (!ArtReady(val2) && !pRequestedAt.ContainsKey(val2)) { list.Add(val2); } } } if (list.Count > 0) { foreach (CardData item3 in list) { pRequestedAt[item3] = Time.realtimeSinceStartup; } try { LoadingScreen.AddTask((LoadingTask)new LoadCardsForCompendium((IEnumerable<CardData>)list, (DisplayStyle)0, (Action)null), true); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("card art load request failed: " + ex.Message)); } } UpdatePickerFocus(); CardUI cardPrefab = GetCardPrefab(); if ((Object)(object)cardPrefab == (Object)null) { return; } int num2 = 6; foreach (int item4 in Enumerable.Range(pVisFirst, Mathf.Max(0, Mathf.Min(pVisLast, pFiltered.Count - 1) - pVisFirst + 1)).Concat(Enumerable.Range(first, last - first + 1))) { if (num2 <= 0) { break; } if (item4 < 0 || item4 >= pFiltered.Count || pAssigned.ContainsKey(item4)) { continue; } CardData val3 = (CardData)pFiltered[item4].data; if (!ArtReady(val3)) { continue; } CardUI val4 = ((pFree.Count > 0) ? pFree.Pop() : CreateCardUI(cardPrefab)); ((Co