Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MetaMarket v1.0.1
MetaMarket.dll
Decompiled 38 minutes agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using On.RoR2; using On.RoR2.UI; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.Stats; using RoR2.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MetaMarket")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MetaMarket")] [assembly: AssemblyTitle("MetaMarket")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MetaMarket { public class LoadoutUI : MonoBehaviour { private bool _isOpen = false; private string _currentSurvivorName = null; private string _currentSurvivorDisplay = null; private GameObject _root; private Text _indicatorText; private GameObject _lobbyIndicator; private Text _levelText; private RectTransform _xpBarFillRect; private Text _xpText; private Text _tokenText; private Text _survivorText; private Text _costText; private Transform _gridParent; private Transform _equipmentGridParent; private readonly List<ItemIconCell> _cells = new List<ItemIconCell>(); private readonly List<ItemIconCell> _equipmentCells = new List<ItemIconCell>(); private GameObject _equipmentHeader; private const int ICON_SIZE = 64; private const int ICON_PADDING = 6; private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown BuildCanvas(); _root.SetActive(false); NetworkUser.onNetworkUserBodyPreferenceChanged += new NetworkUserGenericDelegate(OnBodyPreferenceChanged); SceneManager.activeSceneChanged += OnSceneChanged; } private void OnDestroy() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown NetworkUser.onNetworkUserBodyPreferenceChanged -= new NetworkUserGenericDelegate(OnBodyPreferenceChanged); SceneManager.activeSceneChanged -= OnSceneChanged; } private void OnSceneChanged(Scene prev, Scene next) { bool flag = ((Scene)(ref next)).name == "lobby"; if ((Object)(object)_lobbyIndicator != (Object)null) { _lobbyIndicator.SetActive(flag); } if (_isOpen && !flag) { Close(); } } private void Update() { //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) KeyboardShortcut value = Plugin.OpenMenuKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Toggle(); } } private void OnBodyPreferenceChanged(NetworkUser user) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser != null && !((Object)(object)user != (Object)(object)firstLocalUser.currentNetworkUser)) { SetSurvivorFromBodyIndex(user.bodyIndexPreference); } } private void SetSurvivorFromBodyIndex(BodyIndex bodyIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if ((int)bodyIndex != -1) { SurvivorDef survivorDef = SurvivorCatalog.GetSurvivorDef(SurvivorCatalog.GetSurvivorIndexFromBodyIndex(bodyIndex)); if ((Object)(object)survivorDef != (Object)null) { SetSurvivorFromDef(survivorDef); } } } internal void SetSurvivorFromDef(SurvivorDef def) { _currentSurvivorName = def.cachedName; _currentSurvivorDisplay = (Language.IsTokenInvalid(def.displayNameToken) ? def.cachedName : Language.GetString(def.displayNameToken)); Plugin.Logger.LogInfo((object)("[MetaMarket] Survivor: " + _currentSurvivorDisplay)); if (_isOpen) { _survivorText.text = "Survivor: " + _currentSurvivorDisplay; RefreshGrid(); } } private void TryReadSurvivorFromNetworkUser() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (!((Object)(object)((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null) == (Object)null)) { BodyIndex bodyIndexPreference = firstLocalUser.currentNetworkUser.bodyIndexPreference; if ((int)bodyIndexPreference != -1) { SetSurvivorFromBodyIndex(bodyIndexPreference); } } } private void TryReadSurvivorFromRun() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (firstLocalUser == null) { return; } GameObject cachedMasterObject = firstLocalUser.cachedMasterObject; CharacterMaster val = ((cachedMasterObject != null) ? cachedMasterObject.GetComponent<CharacterMaster>() : null); if (!((Object)(object)val == (Object)null)) { SurvivorDef val2 = SurvivorCatalog.FindSurvivorDefFromBody(val.bodyPrefab); if ((Object)(object)val2 != (Object)null) { SetSurvivorFromDef(val2); } } } public void Toggle() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (_isOpen) { Close(); return; } Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "lobby") { Open(); } } public void Open() { _isOpen = true; RunHooks.SyncUnlockedItemsFromProfile(); if (_currentSurvivorName == null) { TryReadSurvivorFromNetworkUser(); } if (_currentSurvivorName == null) { TryReadSurvivorFromRun(); } Refresh(); _root.SetActive(true); } public void Close() { _isOpen = false; _root.SetActive(false); } public void Refresh() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (_isOpen) { ProgressionSaveData data = ProgressionManager.Data; int level = data.Level; long num = ProgressionManager.CurrentLevelXP(); long num2 = ProgressionManager.XPForNextLevel(level); _levelText.text = $"Level {level}"; float num3 = ((num2 > 0) ? Mathf.Clamp01((float)num / (float)num2) : 1f); _xpBarFillRect.anchorMax = new Vector2(num3, 1f); _xpText.text = $"{num:N0} / {num2:N0} XP"; _tokenText.text = $"Total Tokens: {data.AvailableTokens}"; _survivorText.text = ((_currentSurvivorDisplay != null) ? ("Survivor: " + _currentSurvivorDisplay) : "Survivor: (open character select first)"); RefreshGrid(); } } private void RefreshGrid() { //IL_0128: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Invalid comparison between Unknown and I4 //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Invalid comparison between Unknown and I4 //IL_02a5: Unknown result type (might be due to invalid IL or missing references) foreach (ItemIconCell cell in _cells) { cell.Root.SetActive(false); } foreach (ItemIconCell equipmentCell in _equipmentCells) { equipmentCell.Root.SetActive(false); } if ((Object)(object)_equipmentHeader != (Object)null) { _equipmentHeader.SetActive(false); } _costText.text = ""; if (_currentSurvivorName == null) { return; } ProgressionSaveData data = ProgressionManager.Data; CharacterLoadout loadout = ProgressionManager.GetLoadout(_currentSurvivorName); int num = 0; List<string> list = new List<string>(data.UnlockedItems); list.Sort(delegate(string a, string b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) ItemIndex val3 = ItemCatalog.FindItemIndex(a); ItemIndex val4 = ItemCatalog.FindItemIndex(b); ItemDef val5 = (((int)val3 != -1) ? ItemCatalog.GetItemDef(val3) : null); ItemDef val6 = (((int)val4 != -1) ? ItemCatalog.GetItemDef(val4) : null); int num3 = (((Object)(object)val5 != (Object)null) ? TierOrder(val5.tier) : 99); int value2 = (((Object)(object)val6 != (Object)null) ? TierOrder(val6.tier) : 99); return num3.CompareTo(value2); }); foreach (string item in list) { ItemIndex val = ItemCatalog.FindItemIndex(item); if ((int)val == -1) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(val); if ((Object)(object)itemDef == (Object)null) { continue; } int itemCost = ProgressionManager.GetItemCost(itemDef.tier); if (itemCost >= 0) { loadout.ItemCounts.TryGetValue(item, out var value); ItemIconCell itemIconCell; if (num < _cells.Count) { itemIconCell = _cells[num]; } else { itemIconCell = CreateIconCell(_gridParent); _cells.Add(itemIconCell); } itemIconCell.Configure(item, itemDef, itemCost, value, OnItemClicked); itemIconCell.Root.SetActive(true); num++; } } if (data.UnlockedEquipment.Count > 0) { _equipmentHeader.SetActive(true); List<string> list2 = new List<string>(data.UnlockedEquipment); list2.Sort(delegate(string a, string b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) EquipmentDef equipmentDef2 = EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex(a)); EquipmentDef equipmentDef3 = EquipmentCatalog.GetEquipmentDef(EquipmentCatalog.FindEquipmentIndex(b)); return EqOrder(equipmentDef2).CompareTo(EqOrder(equipmentDef3)); }); int num2 = 0; foreach (string item2 in list2) { EquipmentIndex val2 = EquipmentCatalog.FindEquipmentIndex(item2); if ((int)val2 == -1) { continue; } EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val2); if ((Object)(object)equipmentDef == (Object)null) { continue; } int equipmentCost = ProgressionManager.GetEquipmentCost(equipmentDef); if (equipmentCost >= 0) { bool selected = loadout.EquipmentName == item2; ItemIconCell itemIconCell2; if (num2 < _equipmentCells.Count) { itemIconCell2 = _equipmentCells[num2]; } else { itemIconCell2 = CreateIconCell(_equipmentGridParent); _equipmentCells.Add(itemIconCell2); } itemIconCell2.ConfigureEquipment(item2, equipmentDef, equipmentCost, selected, OnEquipmentClicked); itemIconCell2.Root.SetActive(true); num2++; } } } UpdateCostLabel(); static int EqOrder(EquipmentDef d) { if ((Object)(object)d == (Object)null) { return 99; } if (d.isLunar) { return 2; } if ((Object)(object)d.passiveBuffDef != (Object)null) { return 1; } return 0; } static int TierOrder(ItemTier t) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown if (1 == 0) { } int result = (int)t switch { 0 => 0, 1 => 1, 2 => 2, 4 => 3, 3 => 4, 6 => 5, 7 => 6, 8 => 7, _ => 99, }; if (1 == 0) { } return result; } } private void OnItemClicked(string itemName, int delta) { //IL_005c: 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) if (_currentSurvivorName == null) { return; } CharacterLoadout loadout = ProgressionManager.GetLoadout(_currentSurvivorName); ProgressionSaveData data = ProgressionManager.Data; if (delta == 0) { ProgressionManager.ResetLoadout(_currentSurvivorName); } else { loadout.ItemCounts.TryGetValue(itemName, out var value); if (delta > 0) { ItemDef itemDef = ItemCatalog.GetItemDef(ItemCatalog.FindItemIndex(itemName)); int num = ((!((Object)(object)itemDef != (Object)null)) ? 1 : ProgressionManager.CostOfNextCopy(itemDef.tier, value)); int num2 = ProgressionManager.LoadoutCost(_currentSurvivorName); if (num2 + num > data.AvailableTokens) { Plugin.Logger.LogInfo((object)"[MetaMarket] Not enough tokens."); return; } loadout.ItemCounts[itemName] = value + 1; } else { if (value <= 0) { return; } if (value == 1) { loadout.ItemCounts.Remove(itemName); } else { loadout.ItemCounts[itemName] = value - 1; } } ProgressionManager.Save(); } RefreshGrid(); } private void OnEquipmentClicked(string eqName, int delta) { //IL_0052: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (_currentSurvivorName == null || delta == 0) { return; } CharacterLoadout loadout = ProgressionManager.GetLoadout(_currentSurvivorName); ProgressionSaveData data = ProgressionManager.Data; if (loadout.EquipmentName == eqName) { loadout.EquipmentName = null; } else { EquipmentIndex val = EquipmentCatalog.FindEquipmentIndex(eqName); EquipmentDef def = (((int)val != -1) ? EquipmentCatalog.GetEquipmentDef(val) : null); int equipmentCost = ProgressionManager.GetEquipmentCost(def); string equipmentName = loadout.EquipmentName; loadout.EquipmentName = null; int num = ProgressionManager.LoadoutCost(_currentSurvivorName); loadout.EquipmentName = equipmentName; if (num + equipmentCost > data.AvailableTokens) { Plugin.Logger.LogInfo((object)"[MetaMarket] Not enough tokens for equipment."); return; } loadout.EquipmentName = eqName; } ProgressionManager.Save(); RefreshGrid(); } private void UpdateCostLabel() { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (_currentSurvivorName == null) { _costText.text = ""; return; } int num = ProgressionManager.LoadoutCost(_currentSurvivorName); int availableTokens = ProgressionManager.Data.AvailableTokens; _costText.supportRichText = false; ((Graphic)_costText).color = (Color)((num > availableTokens) ? new Color(1f, 0.38f, 0.38f) : Color.white); _costText.text = ((num > availableTokens) ? $"Loadout: {num} / {availableTokens} tokens ! over budget" : $"Loadout: {num} / {availableTokens} tokens"); } private static ItemIconCell CreateIconCell(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_00c0: 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_00d7: Expected O, but got Unknown //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Expected O, but got Unknown //IL_020f: 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_023d: 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_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: 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) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0389: 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_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Expected O, but got Unknown //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("IconCell"); val.transform.SetParent(parent, false); LayoutElement val2 = val.AddComponent<LayoutElement>(); val2.preferredWidth = 70f; val2.preferredHeight = 70f; GameObject val3 = new GameObject("Border"); val3.transform.SetParent(val.transform, false); RectTransform val4 = val3.AddComponent<RectTransform>(); val4.anchorMin = Vector2.zero; val4.anchorMax = Vector2.one; val4.offsetMin = new Vector2(3f, 3f); val4.offsetMax = new Vector2(-3f, -3f); Image val5 = val3.AddComponent<Image>(); ((Graphic)val5).color = new Color(0.3f, 0.3f, 0.3f, 1f); GameObject val6 = new GameObject("Icon"); val6.transform.SetParent(val3.transform, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.offsetMin = new Vector2(3f, 3f); val7.offsetMax = new Vector2(-3f, -3f); Image val8 = val6.AddComponent<Image>(); val8.preserveAspect = true; GameObject val9 = new GameObject("SelectedOverlay"); val9.transform.SetParent(val3.transform, false); RectTransform val10 = val9.AddComponent<RectTransform>(); val10.anchorMin = Vector2.zero; val10.anchorMax = Vector2.one; Vector2 offsetMin = (val10.offsetMax = Vector2.zero); val10.offsetMin = offsetMin; ((Graphic)val9.AddComponent<Image>()).color = new Color(0.2f, 0.8f, 0.2f, 0.25f); val9.SetActive(false); GameObject val11 = new GameObject("CountBadge"); val11.transform.SetParent(val3.transform, false); RectTransform val12 = val11.AddComponent<RectTransform>(); val12.anchorMin = new Vector2(0f, 1f); val12.anchorMax = new Vector2(0f, 1f); val12.pivot = new Vector2(0f, 1f); val12.sizeDelta = new Vector2(28f, 18f); val12.anchoredPosition = Vector2.zero; ((Graphic)val11.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.75f); GameObject val13 = new GameObject("CountText"); val13.transform.SetParent(val11.transform, false); RectTransform val14 = val13.AddComponent<RectTransform>(); val14.anchorMin = Vector2.zero; val14.anchorMax = Vector2.one; offsetMin = (val14.offsetMax = Vector2.zero); val14.offsetMin = offsetMin; Text val15 = val13.AddComponent<Text>(); val15.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val15.fontSize = 12; val15.fontStyle = (FontStyle)1; ((Graphic)val15).color = Color.white; val15.alignment = (TextAnchor)4; val11.SetActive(false); GameObject val16 = new GameObject("CostBadge"); val16.transform.SetParent(val3.transform, false); RectTransform val17 = val16.AddComponent<RectTransform>(); val17.anchorMin = new Vector2(1f, 0f); val17.anchorMax = new Vector2(1f, 0f); val17.pivot = new Vector2(1f, 0f); val17.sizeDelta = new Vector2(22f, 16f); val17.anchoredPosition = Vector2.zero; ((Graphic)val16.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.7f); GameObject val18 = new GameObject("CostText"); val18.transform.SetParent(val16.transform, false); RectTransform val19 = val18.AddComponent<RectTransform>(); val19.anchorMin = Vector2.zero; val19.anchorMax = Vector2.one; offsetMin = (val19.offsetMax = Vector2.zero); val19.offsetMin = offsetMin; Text val20 = val18.AddComponent<Text>(); val20.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val20.fontSize = 11; val20.fontStyle = (FontStyle)1; ((Graphic)val20).color = new Color(1f, 0.85f, 0.2f); val20.alignment = (TextAnchor)4; ((Graphic)val.AddComponent<Image>()).color = Color.clear; TooltipProvider tooltip = val.AddComponent<TooltipProvider>(); return new ItemIconCell(val, val5, val8, val9, val11, val15, val20, tooltip); } private void BuildCanvas() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0089: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0164: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0365: 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_0386: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Expected O, but got Unknown //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c6: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0526: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_055e: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Expected O, but got Unknown //IL_0598: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_062f: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_0664: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06b2: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06d0: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_077d: Unknown result type (might be due to invalid IL or missing references) //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07f0: Unknown result type (might be due to invalid IL or missing references) //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0854: Unknown result type (might be due to invalid IL or missing references) //IL_085b: Expected O, but got Unknown //IL_0885: Unknown result type (might be due to invalid IL or missing references) //IL_089c: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Unknown result type (might be due to invalid IL or missing references) //IL_08c7: Unknown result type (might be due to invalid IL or missing references) //IL_08ff: Unknown result type (might be due to invalid IL or missing references) //IL_0906: Expected O, but got Unknown //IL_0926: Unknown result type (might be due to invalid IL or missing references) //IL_0933: Unknown result type (might be due to invalid IL or missing references) //IL_0942: Unknown result type (might be due to invalid IL or missing references) //IL_0947: Unknown result type (might be due to invalid IL or missing references) //IL_0948: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Unknown result type (might be due to invalid IL or missing references) //IL_0973: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0998: Expected O, but got Unknown //IL_09c2: Unknown result type (might be due to invalid IL or missing references) //IL_09d9: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_09ff: Unknown result type (might be due to invalid IL or missing references) //IL_0a04: Unknown result type (might be due to invalid IL or missing references) //IL_0a05: Unknown result type (might be due to invalid IL or missing references) //IL_0a0d: Unknown result type (might be due to invalid IL or missing references) //IL_0a78: Unknown result type (might be due to invalid IL or missing references) //IL_0a7f: Expected O, but got Unknown //IL_0ab2: Unknown result type (might be due to invalid IL or missing references) //IL_0ac9: Unknown result type (might be due to invalid IL or missing references) //IL_0ada: Unknown result type (might be due to invalid IL or missing references) //IL_0ae4: Expected O, but got Unknown //IL_0b26: Unknown result type (might be due to invalid IL or missing references) //IL_0b2d: Expected O, but got Unknown //IL_0b77: Unknown result type (might be due to invalid IL or missing references) //IL_0b87: Unknown result type (might be due to invalid IL or missing references) //IL_0b8e: Expected O, but got Unknown //IL_0bae: Unknown result type (might be due to invalid IL or missing references) //IL_0bbb: Unknown result type (might be due to invalid IL or missing references) //IL_0bd2: Unknown result type (might be due to invalid IL or missing references) //IL_0bdf: Unknown result type (might be due to invalid IL or missing references) //IL_0c36: Unknown result type (might be due to invalid IL or missing references) //IL_0c64: Unknown result type (might be due to invalid IL or missing references) //IL_0c6b: Expected O, but got Unknown //IL_0c95: Unknown result type (might be due to invalid IL or missing references) //IL_0cac: Unknown result type (might be due to invalid IL or missing references) //IL_0cbd: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Expected O, but got Unknown //IL_0d50: Unknown result type (might be due to invalid IL or missing references) //IL_0d78: Unknown result type (might be due to invalid IL or missing references) //IL_0d87: Unknown result type (might be due to invalid IL or missing references) //IL_0d96: Unknown result type (might be due to invalid IL or missing references) //IL_0daa: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("MetaMarketIndicator"); Object.DontDestroyOnLoad((Object)(object)val); Canvas val2 = val.AddComponent<Canvas>(); val2.renderMode = (RenderMode)0; val2.sortingOrder = 99; CanvasScaler val3 = val.AddComponent<CanvasScaler>(); val3.uiScaleMode = (ScaleMode)1; val3.referenceResolution = new Vector2(1920f, 1080f); val.AddComponent<GraphicRaycaster>(); GameObject val4 = new GameObject("LobbyIndicator"); val4.transform.SetParent(val.transform, false); RectTransform val5 = val4.AddComponent<RectTransform>(); val5.anchorMin = new Vector2(0f, 0f); val5.anchorMax = new Vector2(0f, 0f); val5.pivot = new Vector2(0f, 0f); val5.sizeDelta = new Vector2(300f, 28f); val5.anchoredPosition = new Vector2(10f, 10f); ((Graphic)val4.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.55f); GameObject val6 = new GameObject("Text"); val6.transform.SetParent(val4.transform, false); RectTransform val7 = val6.AddComponent<RectTransform>(); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.offsetMin = new Vector2(8f, 0f); val7.offsetMax = Vector2.zero; Text val8 = val6.AddComponent<Text>(); KeyboardShortcut value = Plugin.OpenMenuKey.Value; val8.text = $"[{((KeyboardShortcut)(ref value)).MainKey}] Meta Progression"; val8.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val8.fontSize = 14; val8.fontStyle = (FontStyle)1; ((Graphic)val8).color = new Color(1f, 0.85f, 0.2f); val8.alignment = (TextAnchor)3; _indicatorText = val8; Plugin.OpenMenuKey.SettingChanged += delegate { //IL_0021: 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_0029: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_indicatorText != (Object)null) { Text indicatorText = _indicatorText; KeyboardShortcut value2 = Plugin.OpenMenuKey.Value; indicatorText.text = $"[{((KeyboardShortcut)(ref value2)).MainKey}] Meta Progression"; } }; _lobbyIndicator = val4; _lobbyIndicator.SetActive(false); _root = new GameObject("MetaMarketPanel"); Object.DontDestroyOnLoad((Object)(object)_root); Canvas val9 = _root.AddComponent<Canvas>(); val9.renderMode = (RenderMode)0; val9.sortingOrder = 100; CanvasScaler val10 = _root.AddComponent<CanvasScaler>(); val10.uiScaleMode = (ScaleMode)1; val10.referenceResolution = new Vector2(1920f, 1080f); _root.AddComponent<GraphicRaycaster>(); GameObject val11 = new GameObject("Panel"); val11.transform.SetParent(_root.transform, false); RectTransform val12 = val11.AddComponent<RectTransform>(); Vector2 val13 = default(Vector2); ((Vector2)(ref val13))..ctor(0.5f, 0.5f); val12.anchorMax = val13; val12.anchorMin = val13; val12.sizeDelta = new Vector2(780f, 660f); val12.anchoredPosition = new Vector2(150f, 0f); ((Graphic)val11.AddComponent<Image>()).color = new Color(0.05f, 0.05f, 0.08f, 1f); float num = -15f; RectTransform val14 = MakeRect(val11.transform, "Header", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(10f, num - 30f), new Vector2(-10f, num)); HorizontalLayoutGroup val15 = ((Component)val14).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val15).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val15).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val15).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val15).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val15).childControlWidth = false; ((HorizontalOrVerticalLayoutGroup)val15).spacing = 8f; MakeLabel(((Component)val14).transform, "META PROGRESSION", 20, (FontStyle)1, Color.white); MakeFlexSpacer(((Component)val14).transform); _levelText = MakeLabel(((Component)val14).transform, "Level 1", 18, (FontStyle)1, new Color(1f, 0.85f, 0.2f)); MakeFlexSpacer(((Component)val14).transform); MakeButton(((Component)val14).transform, "✕", 18, new UnityAction(Close)); num -= 38f; _xpText = MakeLabel(val11.transform, "0 / 50,000 XP", 13, (FontStyle)0, new Color(0.7f, 0.7f, 0.7f)); PlaceRect((Component)(object)_xpText, val11.transform, new Vector2(10f, num - 20f), new Vector2(-10f, num)); num -= 24f; RectTransform val16 = MakeRect(val11.transform, "XPBarBg", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(10f, num - 14f), new Vector2(-10f, num)); ((Graphic)((Component)val16).gameObject.AddComponent<Image>()).color = new Color(0.15f, 0.15f, 0.15f, 1f); GameObject val17 = new GameObject("Fill"); val17.transform.SetParent((Transform)(object)val16, false); _xpBarFillRect = val17.AddComponent<RectTransform>(); _xpBarFillRect.anchorMin = Vector2.zero; _xpBarFillRect.anchorMax = new Vector2(0f, 1f); val13 = (_xpBarFillRect.offsetMin = (_xpBarFillRect.offsetMax = Vector2.zero)); ((Graphic)val17.AddComponent<Image>()).color = new Color(0.25f, 0.75f, 0.25f, 1f); num -= 20f; _tokenText = MakeLabel(val11.transform, "Total Tokens: 0", 16, (FontStyle)1, new Color(1f, 0.85f, 0.2f)); PlaceRect((Component)(object)_tokenText, val11.transform, new Vector2(10f, num - 26f), new Vector2(-10f, num)); num -= 32f; RectTransform val19 = MakeRect(val11.transform, "InfoRow", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(10f, num - 22f), new Vector2(-10f, num)); HorizontalLayoutGroup val20 = ((Component)val19).gameObject.AddComponent<HorizontalLayoutGroup>(); ((LayoutGroup)val20).childAlignment = (TextAnchor)3; ((HorizontalOrVerticalLayoutGroup)val20).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val20).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val20).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val20).childControlWidth = false; _survivorText = MakeLabel(((Component)val19).transform, "Survivor: —", 14, (FontStyle)0, new Color(0.7f, 0.9f, 1f)); ((Component)_survivorText).gameObject.AddComponent<LayoutElement>().flexibleWidth = 1f; MakeFlexSpacer(((Component)val19).transform); _costText = MakeLabel(((Component)val19).transform, "", 13, (FontStyle)0, Color.white); _costText.supportRichText = false; ((Component)_costText).gameObject.AddComponent<LayoutElement>().preferredWidth = 320f; _costText.alignment = (TextAnchor)5; num -= 28f; RectTransform val21 = MakeRect(val11.transform, "Divider", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(10f, num - 2f), new Vector2(-10f, num)); ((Graphic)((Component)val21).gameObject.AddComponent<Image>()).color = new Color(0.3f, 0.3f, 0.4f, 1f); num -= 8f; GameObject val22 = new GameObject("ScrollView"); val22.transform.SetParent(val11.transform, false); RectTransform val23 = val22.AddComponent<RectTransform>(); val23.anchorMin = new Vector2(0f, 0f); val23.anchorMax = new Vector2(1f, 1f); val23.offsetMin = new Vector2(5f, 28f); val23.offsetMax = new Vector2(-5f, num); ScrollRect val24 = val22.AddComponent<ScrollRect>(); val24.horizontal = false; val24.vertical = true; val24.scrollSensitivity = 40f; GameObject val25 = new GameObject("Viewport"); val25.transform.SetParent(val22.transform, false); RectTransform val26 = val25.AddComponent<RectTransform>(); val26.anchorMin = Vector2.zero; val26.anchorMax = Vector2.one; val13 = (val26.offsetMin = (val26.offsetMax = Vector2.zero)); ((Graphic)val25.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f); val25.AddComponent<Mask>().showMaskGraphic = false; GameObject val28 = new GameObject("Content"); val28.transform.SetParent(val25.transform, false); RectTransform val29 = val28.AddComponent<RectTransform>(); val29.anchorMin = new Vector2(0f, 1f); val29.anchorMax = new Vector2(1f, 1f); val29.pivot = new Vector2(0.5f, 1f); val13 = (val29.offsetMin = (val29.offsetMax = Vector2.zero)); VerticalLayoutGroup val31 = val28.AddComponent<VerticalLayoutGroup>(); ((LayoutGroup)val31).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)val31).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)val31).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)val31).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val31).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val31).spacing = 0f; ContentSizeFitter val32 = val28.AddComponent<ContentSizeFitter>(); val32.verticalFit = (FitMode)2; val32.horizontalFit = (FitMode)0; GameObject val33 = new GameObject("ItemsGrid"); val33.transform.SetParent(val28.transform, false); RectTransform val34 = val33.AddComponent<RectTransform>(); GridLayoutGroup val35 = val33.AddComponent<GridLayoutGroup>(); val35.cellSize = new Vector2(70f, 70f); val35.spacing = new Vector2(4f, 4f); ((LayoutGroup)val35).padding = new RectOffset(8, 4, 8, 4); val35.constraint = (Constraint)1; val35.constraintCount = 10; val35.startCorner = (Corner)0; val35.startAxis = (Axis)0; ((LayoutGroup)val35).childAlignment = (TextAnchor)0; val33.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; GameObject val36 = new GameObject("EquipmentHeader"); val36.transform.SetParent(val28.transform, false); LayoutElement val37 = val36.AddComponent<LayoutElement>(); val37.preferredHeight = 28f; Image val38 = val36.AddComponent<Image>(); ((Graphic)val38).color = new Color(0.12f, 0.12f, 0.18f, 1f); GameObject val39 = new GameObject("Text"); val39.transform.SetParent(val36.transform, false); RectTransform val40 = val39.AddComponent<RectTransform>(); val40.anchorMin = Vector2.zero; val40.anchorMax = Vector2.one; val40.offsetMin = new Vector2(10f, 0f); val40.offsetMax = Vector2.zero; Text val41 = val39.AddComponent<Text>(); val41.text = "Equipment (You can only pick 1)"; val41.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val41.fontSize = 12; val41.fontStyle = (FontStyle)1; ((Graphic)val41).color = new Color(0.7f, 0.7f, 0.7f); val41.alignment = (TextAnchor)3; _equipmentHeader = val36; _equipmentHeader.SetActive(false); GameObject val42 = new GameObject("EquipmentGrid"); val42.transform.SetParent(val28.transform, false); GridLayoutGroup val43 = val42.AddComponent<GridLayoutGroup>(); val43.cellSize = new Vector2(70f, 70f); val43.spacing = new Vector2(4f, 4f); ((LayoutGroup)val43).padding = new RectOffset(8, 4, 4, 8); val43.constraint = (Constraint)1; val43.constraintCount = 10; val43.startCorner = (Corner)0; val43.startAxis = (Axis)0; ((LayoutGroup)val43).childAlignment = (TextAnchor)0; val42.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; val24.viewport = val26; val24.content = val29; _gridParent = val33.transform; _equipmentGridParent = val42.transform; Text val44 = MakeLabel(val11.transform, "Left-click to add · Right-click to remove · Middle-click to reset · Hover for details", 11, (FontStyle)0, new Color(0.45f, 0.45f, 0.45f)); val44.alignment = (TextAnchor)4; PlaceRect((Component)(object)val44, val11.transform, new Vector2(0f, 4f), new Vector2(0f, 22f), (Vector2?)new Vector2(0f, 0f), (Vector2?)new Vector2(1f, 0f)); } private static RectTransform MakeRect(Transform parent, string name, Vector2 anchMin, Vector2 anchMax, Vector2 offMin, Vector2 offMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: 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_0037: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); RectTransform val2 = val.AddComponent<RectTransform>(); val2.anchorMin = anchMin; val2.anchorMax = anchMax; val2.offsetMin = offMin; val2.offsetMax = offMax; return val2; } private static Text MakeLabel(Transform parent, string text, int size, FontStyle style, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0039: 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) GameObject val = new GameObject("Label"); val.transform.SetParent(parent, false); val.AddComponent<RectTransform>(); Text val2 = val.AddComponent<Text>(); val2.text = text; val2.fontSize = size; val2.fontStyle = style; ((Graphic)val2).color = color; val2.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val2.supportRichText = false; return val2; } private static void PlaceRect(Component c, Transform parent, Vector2 offMin, Vector2 offMax, Vector2? anchMin = null, Vector2? anchMax = null) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) RectTransform component = c.GetComponent<RectTransform>(); ((Transform)component).SetParent(parent, false); component.anchorMin = (Vector2)(((??)anchMin) ?? new Vector2(0f, 1f)); component.anchorMax = (Vector2)(((??)anchMax) ?? new Vector2(1f, 1f)); component.offsetMin = offMin; component.offsetMax = offMax; } private static Button MakeButton(Transform parent, string label, int fontSize, UnityAction onClick) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008f: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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) GameObject val = new GameObject("Button"); val.transform.SetParent(parent, false); val.AddComponent<RectTransform>(); ((Graphic)val.AddComponent<Image>()).color = new Color(0.3f, 0.1f, 0.1f, 0.9f); Button val2 = val.AddComponent<Button>(); ((UnityEvent)val2.onClick).AddListener(onClick); val.AddComponent<LayoutElement>().preferredWidth = 36f; Text val3 = MakeLabel(val.transform, label, fontSize, (FontStyle)1, Color.white); val3.alignment = (TextAnchor)4; RectTransform component = ((Component)val3).GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; Vector2 offsetMin = (component.offsetMax = Vector2.zero); component.offsetMin = offsetMin; return val2; } private static void MakeFlexSpacer(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown GameObject val = new GameObject("Spacer"); val.transform.SetParent(parent, false); val.AddComponent<RectTransform>(); val.AddComponent<LayoutElement>().flexibleWidth = 1f; } private static Color TierColor(ItemTier tier) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_00be: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) if (1 == 0) { } Color result = (Color)((int)tier switch { 0 => new Color(0.55f, 0.55f, 0.55f), 1 => new Color(0.15f, 0.55f, 0.15f), 2 => new Color(0.75f, 0.15f, 0.1f), 3 => new Color(0.1f, 0.55f, 0.85f), 4 => new Color(0.65f, 0.5f, 0.1f), 6 => new Color(0.55f, 0.1f, 0.75f), 7 => new Color(0.55f, 0.1f, 0.75f), 8 => new Color(0.55f, 0.1f, 0.75f), _ => new Color(0.3f, 0.3f, 0.3f), }); if (1 == 0) { } return result; } } internal class ItemIconCell : IPointerClickHandler, IEventSystemHandler { private readonly Image _border; private readonly Image _icon; private readonly GameObject _selOverlay; private readonly GameObject _countBadge; private readonly Text _countLabel; private readonly Text _costLabel; private readonly TooltipProvider _tooltip; private string _itemName; private int _baseCost; private int _count; private Action<string, int> _onClick; public GameObject Root { get; } private static Color TierColor(ItemTier tier) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected I4, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_00be: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) if (1 == 0) { } Color result = (Color)((int)tier switch { 0 => new Color(0.55f, 0.55f, 0.55f), 1 => new Color(0.15f, 0.55f, 0.15f), 2 => new Color(0.75f, 0.15f, 0.1f), 3 => new Color(0.1f, 0.55f, 0.85f), 4 => new Color(0.65f, 0.5f, 0.1f), 6 => new Color(0.55f, 0.1f, 0.75f), 7 => new Color(0.55f, 0.1f, 0.75f), 8 => new Color(0.55f, 0.1f, 0.75f), _ => new Color(0.3f, 0.3f, 0.3f), }); if (1 == 0) { } return result; } public ItemIconCell(GameObject root, Image border, Image icon, GameObject selOverlay, GameObject countBadge, Text countLabel, Text costLabel, TooltipProvider tooltip) { Root = root; _border = border; _icon = icon; _selOverlay = selOverlay; _countBadge = countBadge; _countLabel = countLabel; _costLabel = costLabel; _tooltip = tooltip; PointerClickRelay pointerClickRelay = root.AddComponent<PointerClickRelay>(); pointerClickRelay.Target = this; } public void ConfigureEquipment(string eqName, EquipmentDef eqDef, int cost, bool selected, Action<string, int> onClick) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) _itemName = eqName; _baseCost = cost; _count = (selected ? 1 : 0); _onClick = onClick; _icon.sprite = eqDef.pickupIconSprite; ((Graphic)_icon).color = (Color)(((Object)(object)_icon.sprite != (Object)null) ? Color.white : new Color(0.3f, 0.3f, 0.3f)); ((Graphic)_border).color = (eqDef.isLunar ? new Color(0.1f, 0.55f, 0.85f) : (((Object)(object)eqDef.passiveBuffDef != (Object)null) ? new Color(0.75f, 0.3f, 0f) : new Color(0.55f, 0.55f, 0.55f))); _costLabel.text = $"{cost}T"; _countBadge.SetActive(false); _selOverlay.SetActive(selected); string overrideTitleText = (Language.IsTokenInvalid(eqDef.nameToken) ? ((Object)eqDef).name : Language.GetString(eqDef.nameToken)); string overrideBodyText = (Language.IsTokenInvalid(eqDef.descriptionToken) ? "" : Language.GetString(eqDef.descriptionToken)); _tooltip.overrideTitleText = overrideTitleText; _tooltip.overrideBodyText = overrideBodyText; _tooltip.titleColor = ((Graphic)_border).color; _tooltip.bodyColor = Color.white; } public void Configure(string itemName, ItemDef itemDef, int baseCost, int count, Action<string, int> onClick) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0083: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) _itemName = itemName; _baseCost = baseCost; _count = count; _onClick = onClick; _icon.sprite = itemDef.pickupIconSprite; ((Graphic)_icon).color = (Color)(((Object)(object)_icon.sprite != (Object)null) ? Color.white : new Color(0.3f, 0.3f, 0.3f)); ((Graphic)_border).color = TierColor(itemDef.tier); int num = ProgressionManager.CostOfNextCopy(itemDef.tier, count); _costLabel.text = $"{num}T"; if (count > 0) { _countLabel.text = $"x{count}"; _countBadge.SetActive(true); _selOverlay.SetActive(true); } else { _countBadge.SetActive(false); _selOverlay.SetActive(false); } string overrideTitleText = (Language.IsTokenInvalid(itemDef.nameToken) ? ((Object)itemDef).name : Language.GetString(itemDef.nameToken)); string overrideBodyText = (Language.IsTokenInvalid(itemDef.descriptionToken) ? "" : Language.GetString(itemDef.descriptionToken)); _tooltip.overrideTitleText = overrideTitleText; _tooltip.overrideBodyText = overrideBodyText; _tooltip.titleColor = TierColor(itemDef.tier); _tooltip.bodyColor = Color.white; } public void OnPointerClick(PointerEventData eventData) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 if ((int)eventData.button == 0) { _onClick?.Invoke(_itemName, 1); } else if ((int)eventData.button == 1) { _onClick?.Invoke(_itemName, -1); } else if ((int)eventData.button == 2) { _onClick?.Invoke(_itemName, 0); } } } internal class PointerClickRelay : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public ItemIconCell Target; public void OnPointerClick(PointerEventData eventData) { Target?.OnPointerClick(eventData); } } [BepInPlugin("com.asgavin.metamarket", "MetaMarket", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Logger; internal static LoadoutUI UI { get; private set; } internal static string PluginDirectory { get; private set; } internal static ConfigEntry<KeyboardShortcut> OpenMenuKey { get; private set; } private void Awake() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location); OpenMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "Open Loadout Menu", new KeyboardShortcut((KeyCode)109, Array.Empty<KeyCode>()), "Key to open/close the Meta Progression loadout panel."); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(OpenMenuKey)); ModSettingsManager.SetModDescription("Meta Progression loadout settings."); Logger.LogInfo((object)"[MetaMarket] Risk of Options registered."); } ProgressionManager.Load(); RunHooks.Init(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(ProgressionManager.PruneAfterCatalogReady)); GameObject val = new GameObject("MetaMarketUIHost"); Object.DontDestroyOnLoad((Object)(object)val); UI = val.AddComponent<LoadoutUI>(); Logger.LogInfo((object)"MetaMarket loaded."); } private void OnDestroy() { RunHooks.Cleanup(); } } [Serializable] public class CharacterLoadout { public Dictionary<string, int> ItemCounts { get; set; } = new Dictionary<string, int>(); public string EquipmentName { get; set; } = null; } [Serializable] public class ProgressionSaveData { public long TotalXP { get; set; } = 0L; public int Level { get; set; } = 1; public int AvailableTokens { get; set; } = 0; public HashSet<string> UnlockedItems { get; set; } = new HashSet<string>(); public HashSet<string> UnlockedEquipment { get; set; } = new HashSet<string>(); public Dictionary<string, CharacterLoadout> CharacterLoadouts { get; set; } = new Dictionary<string, CharacterLoadout>(); } public static class ProgressionManager { private static string SavePath { get { string text = Path.Combine(Plugin.PluginDirectory, "Saves"); Directory.CreateDirectory(text); return Path.Combine(text, "MetaMarket_" + GetProfileName() + ".json"); } } public static ProgressionSaveData Data { get; private set; } = new ProgressionSaveData(); private static string GetProfileName() { try { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); UserProfile val = ((firstLocalUser != null) ? firstLocalUser.userProfile : null); if (val != null && !string.IsNullOrEmpty(val.fileName)) { return val.fileName; } } catch { } return "default"; } public static long XPForNextLevel(int currentLevel) { return 50000 + (long)(currentLevel - 1) * 10000L; } public static long TotalXPForLevel(int level) { long num = 0L; for (int i = 1; i < level; i++) { num += XPForNextLevel(i); } return num; } public static void AddXP(long xpGained) { Data.TotalXP += xpGained; bool flag = true; while (flag) { long num = XPForNextLevel(Data.Level); long num2 = Data.TotalXP - TotalXPForLevel(Data.Level); if (num2 >= num) { Data.Level++; Data.AvailableTokens++; Plugin.Logger.LogInfo((object)$"[MetaMarket] Leveled up to {Data.Level}! Tokens: {Data.AvailableTokens}"); } else { flag = false; } } Save(); } public static long CurrentLevelXP() { return Data.TotalXP - TotalXPForLevel(Data.Level); } public static CharacterLoadout GetLoadout(string survivorName) { if (!Data.CharacterLoadouts.ContainsKey(survivorName)) { Data.CharacterLoadouts[survivorName] = new CharacterLoadout(); } return Data.CharacterLoadouts[survivorName]; } public static int GetItemCost(ItemTier tier) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown if (1 == 0) { } int result = (int)tier switch { 0 => 1, 1 => 2, 2 => 4, 3 => 5, 4 => 5, 6 => 2, 7 => 3, 8 => 5, _ => -1, }; if (1 == 0) { } return result; } public static int GetEquipmentCost(EquipmentDef def) { if ((Object)(object)def == (Object)null) { return -1; } if (def.isLunar) { return 5; } if ((Object)(object)def.passiveBuffDef != (Object)null) { return 6; } return 3; } public static int CostOfNextCopy(ItemTier tier, int currentCount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) int itemCost = GetItemCost(tier); if (itemCost < 0) { return -1; } return itemCost + currentCount; } public static int LoadoutCost(string survivorName) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_0070: 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) CharacterLoadout loadout = GetLoadout(survivorName); int num = 0; foreach (KeyValuePair<string, int> itemCount in loadout.ItemCounts) { if (itemCount.Value <= 0) { continue; } ItemIndex val = ItemCatalog.FindItemIndex(itemCount.Key); if ((int)val == -1) { continue; } ItemDef itemDef = ItemCatalog.GetItemDef(val); if (!((Object)(object)itemDef == (Object)null)) { int itemCost = GetItemCost(itemDef.tier); if (itemCost >= 0) { int value = itemCount.Value; num += value * itemCost + value * (value - 1) / 2; } } } if (!string.IsNullOrEmpty(loadout.EquipmentName)) { EquipmentIndex val2 = EquipmentCatalog.FindEquipmentIndex(loadout.EquipmentName); if ((int)val2 != -1) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(val2); int equipmentCost = GetEquipmentCost(equipmentDef); if (equipmentCost > 0) { num += equipmentCost; } } } return num; } public static void ResetLoadout(string survivorName) { CharacterLoadout loadout = GetLoadout(survivorName); loadout.ItemCounts.Clear(); loadout.EquipmentName = null; Save(); } public static void UnlockItem(string itemDefName) { if (Data.UnlockedItems.Add(itemDefName)) { Save(); } } public static void UnlockEquipment(string equipmentDefName) { if (Data.UnlockedEquipment.Add(equipmentDefName)) { Save(); } } private static void PruneStaleItems() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 List<string> list = new List<string>(); foreach (string unlockedItem in Data.UnlockedItems) { if ((int)ItemCatalog.FindItemIndex(unlockedItem) == -1) { list.Add(unlockedItem); } } foreach (string item in list) { Data.UnlockedItems.Remove(item); Plugin.Logger.LogWarning((object)("[MetaMarket] Pruned stale item: " + item)); foreach (CharacterLoadout value in Data.CharacterLoadouts.Values) { value.ItemCounts.Remove(item); } } List<string> list2 = new List<string>(); foreach (string item2 in Data.UnlockedEquipment) { if ((int)EquipmentCatalog.FindEquipmentIndex(item2) == -1) { list2.Add(item2); } } foreach (string item3 in list2) { Data.UnlockedEquipment.Remove(item3); Plugin.Logger.LogWarning((object)("[MetaMarket] Pruned stale equipment: " + item3)); foreach (CharacterLoadout value2 in Data.CharacterLoadouts.Values) { if (value2.EquipmentName == item3) { value2.EquipmentName = null; } } } if (list.Count > 0 || list2.Count > 0) { Save(); } } public static void Load() { try { if (File.Exists(SavePath)) { string text = File.ReadAllText(SavePath); Data = JsonConvert.DeserializeObject<ProgressionSaveData>(text) ?? new ProgressionSaveData(); Plugin.Logger.LogInfo((object)$"[MetaMarket] Loaded. Level: {Data.Level}, XP: {Data.TotalXP}, Tokens: {Data.AvailableTokens}"); } else { Data = new ProgressionSaveData(); Plugin.Logger.LogInfo((object)"[MetaMarket] No save found, starting fresh."); } } catch (Exception ex) { Plugin.Logger.LogError((object)("[MetaMarket] Failed to load save: " + ex.Message)); Data = new ProgressionSaveData(); } } public static void PruneAfterCatalogReady() { PruneStaleItems(); } public static void Save() { try { string contents = JsonConvert.SerializeObject((object)Data, (Formatting)1); File.WriteAllText(SavePath, contents); } catch (Exception ex) { Plugin.Logger.LogError((object)("[MetaMarket] Failed to save: " + ex.Message)); } } } public static class RunHooks { [CompilerGenerated] private static class <>O { public static Action<Run> <0>__OnRunStart; public static hook_Generate <1>__OnRunReportGenerate; public static hook_OnEnable <2>__OnCharacterSelectEnabled; public static hook_OnDisable <3>__OnCharacterSelectDisabled; public static Action <4>__OnLocalUsersUpdated; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__6_0; internal void <InjectLobbyButton>b__6_0() { Plugin.UI?.Toggle(); } } private static GameObject _lobbyButton; private static readonly string[] DisplayedStats = new string[13] { "totalTimeAlive", "totalKills", "totalMinionKills", "totalDeaths", "totalDamageDealt", "totalMinionDamageDealt", "highestDamageDealt", "totalDamageTaken", "highestLevel", "totalGoldCollected", "totalItemsCollected", "totalStagesCompleted", "totalPurchases" }; public static void Init() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown Run.onRunStartGlobal += OnRunStart; object obj = <>O.<1>__OnRunReportGenerate; if (obj == null) { hook_Generate val = OnRunReportGenerate; <>O.<1>__OnRunReportGenerate = val; obj = (object)val; } RunReport.Generate += (hook_Generate)obj; object obj2 = <>O.<2>__OnCharacterSelectEnabled; if (obj2 == null) { hook_OnEnable val2 = OnCharacterSelectEnabled; <>O.<2>__OnCharacterSelectEnabled = val2; obj2 = (object)val2; } CharacterSelectController.OnEnable += (hook_OnEnable)obj2; object obj3 = <>O.<3>__OnCharacterSelectDisabled; if (obj3 == null) { hook_OnDisable val3 = OnCharacterSelectDisabled; <>O.<3>__OnCharacterSelectDisabled = val3; obj3 = (object)val3; } CharacterSelectController.OnDisable += (hook_OnDisable)obj3; LocalUserManager.onLocalUsersUpdated += OnLocalUsersUpdated; } public static void Cleanup() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown Run.onRunStartGlobal -= OnRunStart; object obj = <>O.<1>__OnRunReportGenerate; if (obj == null) { hook_Generate val = OnRunReportGenerate; <>O.<1>__OnRunReportGenerate = val; obj = (object)val; } RunReport.Generate -= (hook_Generate)obj; object obj2 = <>O.<2>__OnCharacterSelectEnabled; if (obj2 == null) { hook_OnEnable val2 = OnCharacterSelectEnabled; <>O.<2>__OnCharacterSelectEnabled = val2; obj2 = (object)val2; } CharacterSelectController.OnEnable -= (hook_OnEnable)obj2; object obj3 = <>O.<3>__OnCharacterSelectDisabled; if (obj3 == null) { hook_OnDisable val3 = OnCharacterSelectDisabled; <>O.<3>__OnCharacterSelectDisabled = val3; obj3 = (object)val3; } CharacterSelectController.OnDisable -= (hook_OnDisable)obj3; LocalUserManager.onLocalUsersUpdated -= OnLocalUsersUpdated; } private static void OnLocalUsersUpdated() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); UserProfile obj = ((firstLocalUser != null) ? firstLocalUser.userProfile : null); Plugin.Logger.LogInfo((object)("[MetaMarket] Local users updated, profile: " + (obj?.fileName ?? "null") + ", reloading save.")); ProgressionManager.Load(); Plugin.UI?.Refresh(); } private static void OnCharacterSelectEnabled(orig_OnEnable orig, CharacterSelectController self) { orig.Invoke(self); SyncUnlockedItemsFromProfile(); if ((Object)(object)self.currentSurvivorDef != (Object)null) { Plugin.UI?.SetSurvivorFromDef(self.currentSurvivorDef); } InjectLobbyButton(self); } private static void OnCharacterSelectDisabled(orig_OnDisable orig, CharacterSelectController self) { orig.Invoke(self); if ((Object)(object)_lobbyButton != (Object)null) { Object.Destroy((Object)(object)_lobbyButton); _lobbyButton = null; } Plugin.UI?.Close(); } private static void InjectLobbyButton(CharacterSelectController csc) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_017d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown if ((Object)(object)_lobbyButton != (Object)null) { return; } MPButton readyButton = csc.readyButton; GameObject val = ((readyButton != null) ? ((Component)readyButton).gameObject : null); if ((Object)(object)val == (Object)null) { Plugin.Logger.LogWarning((object)"[MetaMarket] Could not find readyButton on CharacterSelectController."); return; } Transform val2 = val.transform.parent; if ((Object)(object)val2 == (Object)null) { val2 = val.transform; } _lobbyButton = new GameObject("MetaMarketLobbyButton"); _lobbyButton.transform.SetParent(val2, false); RectTransform val3 = _lobbyButton.AddComponent<RectTransform>(); RectTransform component = val.GetComponent<RectTransform>(); val3.anchorMin = component.anchorMin; val3.anchorMax = component.anchorMax; val3.pivot = component.pivot; val3.sizeDelta = new Vector2(200f, component.sizeDelta.y); val3.anchoredPosition = component.anchoredPosition + new Vector2(-220f, 0f); Image val4 = _lobbyButton.AddComponent<Image>(); ((Graphic)val4).color = new Color(0.1f, 0.35f, 0.55f, 0.95f); Button val5 = _lobbyButton.AddComponent<Button>(); ColorBlock colors = ((Selectable)val5).colors; ((ColorBlock)(ref colors)).normalColor = new Color(0.1f, 0.35f, 0.55f, 0.95f); ((ColorBlock)(ref colors)).highlightedColor = new Color(0.15f, 0.5f, 0.75f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.05f, 0.25f, 0.4f, 1f); ((Selectable)val5).colors = colors; ButtonClickedEvent onClick = val5.onClick; object obj = <>c.<>9__6_0; if (obj == null) { UnityAction val6 = delegate { Plugin.UI?.Toggle(); }; <>c.<>9__6_0 = val6; obj = (object)val6; } ((UnityEvent)onClick).AddListener((UnityAction)obj); GameObject val7 = new GameObject("Label"); val7.transform.SetParent(_lobbyButton.transform, false); RectTransform val8 = val7.AddComponent<RectTransform>(); val8.anchorMin = Vector2.zero; val8.anchorMax = Vector2.one; Vector2 offsetMin = (val8.offsetMax = Vector2.zero); val8.offsetMin = offsetMin; Text val9 = val7.AddComponent<Text>(); val9.text = "\ud83c\udf92 Meta Loadout"; val9.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val9.fontSize = 18; val9.fontStyle = (FontStyle)1; ((Graphic)val9).color = Color.white; val9.alignment = (TextAnchor)4; _lobbyButton.transform.SetSiblingIndex(val.transform.GetSiblingIndex()); Plugin.Logger.LogInfo((object)"[MetaMarket] Lobby button injected."); } private static void OnRunStart(Run run) { ((MonoBehaviour)run).StartCoroutine(GrantLoadoutItems(run)); } private static IEnumerator GrantLoadoutItems(Run run) { yield return null; LocalUser localUser = LocalUserManager.GetFirstLocalUser(); if (localUser == null) { yield break; } GameObject cachedMasterObject = localUser.cachedMasterObject; CharacterMaster master = ((cachedMasterObject != null) ? cachedMasterObject.GetComponent<CharacterMaster>() : null); if ((Object)(object)master == (Object)null) { yield break; } SurvivorDef survivorDef = SurvivorCatalog.FindSurvivorDefFromBody(master.bodyPrefab); if ((Object)(object)survivorDef == (Object)null) { yield break; } string survivorName = survivorDef.cachedName; CharacterLoadout loadout = ProgressionManager.GetLoadout(survivorName); Inventory inventory = master.inventory; if ((Object)(object)inventory == (Object)null) { yield break; } Plugin.Logger.LogInfo((object)("[MetaMarket] Granting loadout items to " + survivorName)); foreach (KeyValuePair<string, int> kvp in loadout.ItemCounts) { if (kvp.Value <= 0) { continue; } ItemIndex index = ItemCatalog.FindItemIndex(kvp.Key); if ((int)index == -1) { Plugin.Logger.LogWarning((object)("[MetaMarket] Unknown item: " + kvp.Key)); continue; } for (int i = 0; i < kvp.Value; i++) { inventory.GiveItemPermanent(index, 1); } } if (!string.IsNullOrEmpty(loadout.EquipmentName)) { EquipmentIndex eqIdx = EquipmentCatalog.FindEquipmentIndex(loadout.EquipmentName); if ((int)eqIdx != -1) { inventory.SetEquipmentIndex(eqIdx); } else { Plugin.Logger.LogWarning((object)("[MetaMarket] Unknown equipment: " + loadout.EquipmentName)); } } Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cIsUtility>[MetaMarket]</style> Granted loadout items to " + survivorName + "." }); } private static RunReport OnRunReportGenerate(orig_Generate orig, Run run, GameEndingDef gameEndingDef) { //IL_016c: 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_01ac: Expected O, but got Unknown RunReport val = orig.Invoke(run, gameEndingDef); if (val == null) { return val; } long num = 0L; for (int i = 0; i < val.playerInfoCount; i++) { PlayerInfo playerInfo = val.GetPlayerInfo(i); if (playerInfo?.statSheet == null) { continue; } string[] displayedStats = DisplayedStats; foreach (string text in displayedStats) { StatDef val2 = StatDef.Find(text); if (val2 != null) { double num2 = playerInfo.statSheet.GetStatPointValue(val2); double statValueAsDouble = playerInfo.statSheet.GetStatValueAsDouble(val2); Plugin.Logger.LogInfo((object)$"[MetaMarket] Stat {text}: raw={statValueAsDouble} pts={num2}"); num += (long)num2; } } } Plugin.Logger.LogInfo((object)$"[MetaMarket] Run ended. Score: {num}, awarding as XP."); int level = ProgressionManager.Data.Level; ProgressionManager.AddXP(num); int level2 = ProgressionManager.Data.Level; if (level2 > level) { int num3 = level2 - level; int availableTokens = ProgressionManager.Data.AvailableTokens; Plugin.Logger.LogInfo((object)$"[MetaMarket] Gained {num3} level(s). Now level {level2}, tokens: {availableTokens}"); Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage { baseToken = "<style=cIsHealing>[MetaMarket]</style> " + $"Level up! Now <style=cIsHealing>Level {level2}</style>. " + $"You have <style=cIsUtility>{availableTokens} token(s)</style>. " + "Open your loadout to spend them." }); } SyncUnlockedItemsFromProfile(); Plugin.UI?.Refresh(); return val; } public unsafe static void SyncUnlockedItemsFromProfile() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: 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_0188: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); if (((firstLocalUser != null) ? firstLocalUser.userProfile : null) == null) { return; } StatSheet statSheet = firstLocalUser.userProfile.statSheet; if (statSheet == null) { return; } PerItemStatDef totalCollected = PerItemStatDef.totalCollected; if (totalCollected == null) { Plugin.Logger.LogWarning((object)"[MetaMarket] PerItemStatDef.totalCollected is null."); return; } int num = 0; AllItemsEnumerator enumerator = ItemCatalog.allItems.GetEnumerator(); try { while (((AllItemsEnumerator)(ref enumerator)).MoveNext()) { ItemIndex current = ((AllItemsEnumerator)(ref enumerator)).Current; ItemDef itemDef = ItemCatalog.GetItemDef(current); if ((Object)(object)itemDef == (Object)null || ProgressionManager.GetItemCost(itemDef.tier) < 0) { continue; } StatDef val = totalCollected.FindStatDef(current); if (val != null) { ulong statValueULong = statSheet.GetStatValueULong(val); if (statValueULong != 0) { ProgressionManager.UnlockItem(((Object)itemDef).name); num++; } } } } finally { ((IDisposable)(*(AllItemsEnumerator*)(&enumerator))/*cast due to .constrained prefix*/).Dispose(); } Plugin.Logger.LogInfo((object)$"[MetaMarket] SyncUnlockedItems: {num} items unlocked from profile."); PerEquipmentStatDef totalTimeHeld = PerEquipmentStatDef.totalTimeHeld; if (totalTimeHeld == null) { return; } int num2 = 0; AllEquipmentEnumerator enumerator2 = EquipmentCatalog.allEquipment.GetEnumerator(); try { while (((AllEquipmentEnumerator)(ref enumerator2)).MoveNext()) { EquipmentIndex current2 = ((AllEquipmentEnumerator)(ref enumerator2)).Current; EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef(current2); if ((Object)(object)equipmentDef == (Object)null || ProgressionManager.GetEquipmentCost(equipmentDef) < 0) { continue; } StatDef val2 = totalTimeHeld.FindStatDef(current2); if (val2 != null) { double statValueAsDouble = statSheet.GetStatValueAsDouble(val2); if (statValueAsDouble > 0.0) { ProgressionManager.UnlockEquipment(((Object)equipmentDef).name); num2++; } } } } finally { ((IDisposable)(*(AllEquipmentEnumerator*)(&enumerator2))/*cast due to .constrained prefix*/).Dispose(); } Plugin.Logger.LogInfo((object)$"[MetaMarket] SyncUnlockedEquipment: {num2} equipment unlocked from profile."); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "MetaMarket"; public const string PLUGIN_NAME = "MetaMarket"; public const string PLUGIN_VERSION = "1.0.0"; } }