Please disclose if your mod was created primarily 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 HaldorOverhaul v1.0.19
HaldorOverhaul.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Haldor Overhaul")] [assembly: AssemblyDescription("Custom buy/sell trading for Haldor")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HaldorOverhaul")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("b7e4f347-ccbb-4fa9-9a20-b39679b6d0f7")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace HaldorOverhaul { public static class ConfigLoader { private static string BuyFile => Path.Combine(Paths.ConfigPath, "HaldorOverhaul.haldor.buy.json"); private static string SellFile => Path.Combine(Paths.ConfigPath, "HaldorOverhaul.haldor.sell.json"); public static List<TradeEntry> BuyEntries { get; private set; } = new List<TradeEntry>(); public static List<TradeEntry> SellEntries { get; private set; } = new List<TradeEntry>(); public static void Initialize() { EnsureConfigFilesExist(); LoadBuyConfig(); LoadSellConfig(); ValidateAndLogStats(); } private static void ValidateAndLogStats() { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (TradeEntry item in BuyEntries.ToList()) { if (!ValidateEntry(item, "BUY")) { BuyEntries.Remove(item); num2++; } else { num++; } } foreach (TradeEntry item2 in SellEntries.ToList()) { if (!ValidateEntry(item2, "SELL")) { SellEntries.Remove(item2); num4++; } else { num3++; } } if (num2 > 0 || num4 > 0) { HaldorOverhaul.Log.LogWarning((object)$"[ConfigLoader] Removed {num2} invalid BUY entries and {num4} invalid SELL entries."); } HaldorOverhaul.Log.LogInfo((object)string.Format("{0} Config validated: {1} BUY entries, {2} SELL entries.", "[ConfigLoader]", num, num3)); } private static bool ValidateEntry(TradeEntry entry, string type) { if (entry == null) { HaldorOverhaul.Log.LogWarning((object)("[ConfigLoader] " + type + " entry is null, skipping.")); return false; } if (string.IsNullOrWhiteSpace(entry.prefab)) { HaldorOverhaul.Log.LogWarning((object)("[ConfigLoader] " + type + " entry has empty prefab name, skipping.")); return false; } if (entry.price < 0) { HaldorOverhaul.Log.LogWarning((object)string.Format("{0} {1} entry '{2}' has negative price ({3}), setting to 0.", "[ConfigLoader]", type, entry.prefab, entry.price)); entry.price = 0; } if (entry.stack <= 0) { HaldorOverhaul.Log.LogWarning((object)string.Format("{0} {1} entry '{2}' has invalid stack ({3}), setting to 1.", "[ConfigLoader]", type, entry.prefab, entry.stack)); entry.stack = 1; } return true; } private static void EnsureConfigFilesExist() { if (!File.Exists(BuyFile)) { File.WriteAllText(BuyFile, DefaultBuyJson()); HaldorOverhaul.Log.LogInfo((object)"[ConfigLoader] Created default BUY config."); } if (!File.Exists(SellFile)) { File.WriteAllText(SellFile, DefaultSellJson()); HaldorOverhaul.Log.LogInfo((object)"[ConfigLoader] Created default SELL config."); } } private static void LoadBuyConfig() { try { BuyEntries = JsonConvert.DeserializeObject<List<TradeEntry>>(File.ReadAllText(BuyFile)) ?? new List<TradeEntry>(); HaldorOverhaul.Log.LogInfo((object)$"[ConfigLoader] Loaded {BuyEntries.Count} BUY entries."); } catch (Exception arg) { HaldorOverhaul.Log.LogError((object)$"[ConfigLoader] Error loading BUY config: {arg}"); BuyEntries = new List<TradeEntry>(); } } private static void LoadSellConfig() { try { SellEntries = JsonConvert.DeserializeObject<List<TradeEntry>>(File.ReadAllText(SellFile)) ?? new List<TradeEntry>(); HaldorOverhaul.Log.LogInfo((object)$"[ConfigLoader] Loaded {SellEntries.Count} SELL entries."); } catch (Exception arg) { HaldorOverhaul.Log.LogError((object)$"[ConfigLoader] Error loading SELL config: {arg}"); SellEntries = new List<TradeEntry>(); } } private static string DefaultBuyJson() { return JsonConvert.SerializeObject((object)new List<TradeEntry> { new TradeEntry { prefab = "Wood", stack = 50, price = 25, requiredGlobalKey = "defeated_eikthyr" } }, (Formatting)1); } private static string DefaultSellJson() { return JsonConvert.SerializeObject((object)new List<TradeEntry> { new TradeEntry { prefab = "Wood", stack = 1, price = 1 } }, (Formatting)1); } } public class TradeEntry { [JsonProperty("item_prefab")] public string prefab = ""; [JsonProperty("item_quantity")] public int stack = 1; [JsonProperty("item_price")] public int price = 1; [JsonProperty("must_defeated_boss")] public string requiredGlobalKey = ""; } internal static class BankBalanceStore { private const string SharedKey = "TraderSharedBank_Balance"; private const string LegacyHaldorKey = "HaldorBank_Balance"; private const string LegacyHildirKey = "HildirBank_Balance"; private const string LegacyBogWitchKey = "BogWitchBank_Balance"; internal static int Read(Player player) { if ((Object)(object)player == (Object)null) { return 0; } if (TryRead(player, "TraderSharedBank_Balance", out var value)) { return value; } int value2; bool num = TryRead(player, "HaldorBank_Balance", out value2); int value3; bool flag = TryRead(player, "HildirBank_Balance", out value3); int value4; bool flag2 = TryRead(player, "BogWitchBank_Balance", out value4); int num2 = 0; if (num) { num2 = Mathf.Max(num2, value2); } if (flag) { num2 = Mathf.Max(num2, value3); } if (flag2) { num2 = Mathf.Max(num2, value4); } Write(player, num2); return num2; } internal static void Write(Player player, int value) { if (!((Object)(object)player == (Object)null)) { value = Mathf.Max(0, value); string value2 = value.ToString(); player.m_customData["TraderSharedBank_Balance"] = value2; player.m_customData["HaldorBank_Balance"] = value2; player.m_customData["HildirBank_Balance"] = value2; player.m_customData["BogWitchBank_Balance"] = value2; } } private static bool TryRead(Player player, string key, out int value) { value = 0; if (player.m_customData.TryGetValue(key, out var value2)) { return int.TryParse(value2, out value); } return false; } } [BepInPlugin("com.haldor.overhaul", "Haldor Overhaul", "1.0.19")] public class HaldorOverhaul : BaseUnityPlugin { public const string PluginGUID = "com.haldor.overhaul"; public const string PluginName = "Haldor Overhaul"; public const string PluginVersion = "1.0.19"; private static Harmony _harmony; internal static ManualLogSource Log; private void Awake() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)"Haldor Overhaul v1.0.19 loading..."); ConfigLoader.Initialize(); TraderPatches.SetTraderUI(((Component)this).gameObject.AddComponent<TraderUI>()); TraderPatches.SetBankUI(((Component)this).gameObject.AddComponent<BankUI>()); _harmony = new Harmony("com.haldor.overhaul"); _harmony.PatchAll(typeof(TraderPatches)); Log.LogInfo((object)"Haldor Overhaul loaded successfully!"); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } Log.LogInfo((object)"Haldor Overhaul unloaded."); } } public static class TraderPatches { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__12_0; internal void <Terminal_InitTerminal_Postfix>b__12_0(ConsoleEventArgs args) { string s = null; if (args.Length >= 3 && args[1] == "=") { s = args[2]; } else if (args.Length >= 2 && args[1] != "=") { s = args[1]; } if (!int.TryParse(s, out var result) || result < 0) { args.Context.AddString("Usage: setbankbalance <amount>"); return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("No player found."); return; } int num = BankBalanceStore.Read(localPlayer); BankBalanceStore.Write(localPlayer, result); GetTraderUI()?.ReloadBankBalance(); ((Character)localPlayer).Message((MessageType)2, $"Bank balance set to {result:N0}", 0, (Sprite)null); args.Context.AddString($"Bank balance set to {result:N0} (was {num:N0})"); } } private static TraderUI _traderUI; private static BankUI _bankUI; internal static void SetTraderUI(TraderUI ui) { _traderUI = ui; } internal static void SetBankUI(BankUI ui) { _bankUI = ui; } internal static TraderUI GetTraderUI() { return _traderUI; } private static bool IsHaldor(Trader trader) { if ((Object)(object)trader == (Object)null) { return false; } return string.Equals(Utils.GetPrefabName(((Component)trader).gameObject), "Haldor", StringComparison.OrdinalIgnoreCase); } [HarmonyPatch(typeof(StoreGui), "Show")] [HarmonyPrefix] private static bool StoreGui_Show_Prefix(StoreGui __instance, Trader trader) { if ((Object)(object)_traderUI == (Object)null) { return true; } if (!IsHaldor(trader)) { return true; } _traderUI.Show(trader, __instance); return false; } [HarmonyPatch(typeof(StoreGui), "Hide")] [HarmonyPostfix] private static void StoreGui_Hide_Postfix() { if ((Object)(object)_traderUI != (Object)null && _traderUI.IsVisible) { _traderUI.Hide(); } } [HarmonyPatch(typeof(StoreGui), "IsVisible")] [HarmonyPostfix] private static void StoreGui_IsVisible_Postfix(ref bool __result) { if ((Object)(object)_traderUI != (Object)null && _traderUI.IsVisible) { __result = true; } if ((Object)(object)_bankUI != (Object)null && _bankUI.IsVisible) { __result = true; } } [HarmonyPatch(typeof(Chat), "SetNpcText")] [HarmonyPrefix] private static bool Chat_SetNpcText_Prefix() { if ((Object)(object)_traderUI != (Object)null && _traderUI.IsVisible) { return false; } return true; } [HarmonyPatch(typeof(Chat), "HasFocus")] [HarmonyPostfix] private static void Chat_HasFocus_Postfix(ref bool __result) { if (!__result && (Object)(object)_traderUI != (Object)null && _traderUI.IsSearchFocused) { __result = true; } } [HarmonyPatch(typeof(Player), "TakeInput")] [HarmonyPrefix] private static bool Player_TakeInput_Prefix(ref bool __result) { if (((Object)(object)_traderUI != (Object)null && _traderUI.IsVisible) || ((Object)(object)_bankUI != (Object)null && _bankUI.IsVisible)) { __result = false; return false; } return true; } [HarmonyPatch(typeof(Terminal), "InitTerminal")] [HarmonyPostfix] private static void Terminal_InitTerminal_Postfix() { //IL_0032: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown object obj = <>c.<>9__12_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { string s = null; if (args.Length >= 3 && args[1] == "=") { s = args[2]; } else if (args.Length >= 2 && args[1] != "=") { s = args[1]; } if (!int.TryParse(s, out var result) || result < 0) { args.Context.AddString("Usage: setbankbalance <amount>"); } else { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { args.Context.AddString("No player found."); } else { int num = BankBalanceStore.Read(localPlayer); BankBalanceStore.Write(localPlayer, result); GetTraderUI()?.ReloadBankBalance(); ((Character)localPlayer).Message((MessageType)2, $"Bank balance set to {result:N0}", 0, (Sprite)null); args.Context.AddString($"Bank balance set to {result:N0} (was {num:N0})"); } } }; <>c.<>9__12_0 = val; obj = (object)val; } new ConsoleCommand("setbankbalance", "Set Haldor's bank balance. Usage: setbankbalance <amount> or setbankbalance = <amount>", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } public static class TextureLoader { private static readonly Dictionary<string, Texture2D> Cache = new Dictionary<string, Texture2D>(); private static readonly Assembly ModAssembly = Assembly.GetExecutingAssembly(); private static readonly MethodInfo LoadImageMethod = ResolveLoadImage(); private static MethodInfo ResolveLoadImage() { return Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule")?.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); } public static Texture2D LoadUITexture(string name) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown if (string.IsNullOrEmpty(name)) { return null; } string key = "UI_" + name; if (Cache.TryGetValue(key, out var value)) { return value; } if (LoadImageMethod == null) { HaldorOverhaul.Log.LogWarning((object)"TextureLoader: ImageConversion.LoadImage not found via reflection."); return null; } string text = "HaldorOverhaul.Resources.Textures.UI." + name + ".png"; using Stream stream = ModAssembly.GetManifestResourceStream(text); if (stream == null) { HaldorOverhaul.Log.LogWarning((object)("TextureLoader: UI resource '" + text + "' not found.")); return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if ((bool)LoadImageMethod.Invoke(null, new object[2] { val, array })) { ((Object)val).name = name; Cache[key] = val; return val; } Object.Destroy((Object)(object)val); return null; } } public class BankUI : MonoBehaviour { private bool _isVisible; private bool _uiBuilt; private int _bankBalance; private GameObject _canvasGO; private GameObject _mainPanel; private TMP_Text _titleText; private TMP_Text _bankBalanceText; private TMP_Text _inventoryCoinsText; private TMP_Text _totalWealthText; private TMP_Text _statusText; private Button _depositButton; private TMP_Text _depositLabel; private GameObject _depositSelected; private Button _withdrawButton; private TMP_Text _withdrawLabel; private GameObject _withdrawSelected; private Sprite _bgSprite; private TMP_FontAsset _valheimFont; private GameObject _buttonTemplate; private float _btnHeight = 36f; private int _focusedButton; private static readonly Color ColOverlay = new Color(0f, 0f, 0f, 0.65f); private static readonly Color GoldTextColor = new Color(0.83f, 0.52f, 0.18f, 1f); private static readonly Color PanelBgColor = new Color(0.22f, 0.1f, 0.04f, 0.65f); private static readonly Color SelectedColor = new Color(1f, 0.82f, 0.24f, 0.25f); private const float PanelWidth = 420f; private const float PanelHeight = 320f; public bool IsVisible => _isVisible; public void Show() { if (!_uiBuilt) { BuildUI(); } if (_uiBuilt) { LoadBalance(); _canvasGO.SetActive(true); _isVisible = true; _focusedButton = 0; RefreshDisplay(); UpdateControllerHighlight(); } } public void Hide() { _isVisible = false; if ((Object)(object)_canvasGO != (Object)null) { _canvasGO.SetActive(false); } } private void Update() { if (_isVisible) { if (Input.GetKeyDown((KeyCode)27)) { Hide(); return; } UpdateGamepadInput(); RefreshDisplay(); } } private void LateUpdate() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (!_isVisible) { return; } if (!ZInput.IsGamepadActive()) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Cursor.visible = false; } Hud instance = Hud.instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)instance.m_crosshair != (Object)null) { ((Graphic)instance.m_crosshair).color = Color.clear; } if ((Object)(object)instance.m_hoverName != (Object)null) { ((TMP_Text)instance.m_hoverName).text = ""; } } if (ZInput.IsGamepadActive() && (Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject((GameObject)null); } } private void UpdateGamepadInput() { if (ZInput.GetButtonDown("JoyButtonB")) { Hide(); return; } if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyDPadLeft") || ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp")) { _focusedButton = 0; UpdateControllerHighlight(); } if (ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyDPadRight") || ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown")) { _focusedButton = 1; UpdateControllerHighlight(); } if (ZInput.GetButtonDown("JoyButtonA")) { if (_focusedButton == 0 && (Object)(object)_depositButton != (Object)null && ((Selectable)_depositButton).interactable) { OnDeposit(); } else if (_focusedButton == 1 && (Object)(object)_withdrawButton != (Object)null && ((Selectable)_withdrawButton).interactable) { OnWithdraw(); } } } private void UpdateControllerHighlight() { bool flag = ZInput.IsGamepadActive(); if ((Object)(object)_depositSelected != (Object)null) { _depositSelected.SetActive(flag && _focusedButton == 0); } if ((Object)(object)_withdrawSelected != (Object)null) { _withdrawSelected.SetActive(flag && _focusedButton == 1); } } private void BuildUI() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0074: 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_00b1: 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_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_016a: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_031f: 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_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03af: 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_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: 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_0442: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04ea: Unknown result type (might be due to invalid IL or missing references) //IL_04ff: 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_0529: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0574: Unknown result type (might be due to invalid IL or missing references) //IL_059e: 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_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) //IL_05f8: Unknown result type (might be due to invalid IL or missing references) //IL_0640: Unknown result type (might be due to invalid IL or missing references) //IL_0656: Expected O, but got Unknown //IL_0678: Unknown result type (might be due to invalid IL or missing references) //IL_068e: Expected O, but got Unknown if (!ExtractAssets()) { HaldorOverhaul.Log.LogError((object)"[BankUI] Failed to extract Valheim assets."); return; } _canvasGO = new GameObject("HaldorBank_Canvas"); _canvasGO.transform.SetParent(((Component)this).transform); Canvas obj = _canvasGO.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 101; CanvasScaler obj2 = _canvasGO.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 0.5f; _canvasGO.AddComponent<GraphicRaycaster>(); GameObject val = new GameObject("Overlay", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_canvasGO.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)val.AddComponent<Image>()).color = ColOverlay; _mainPanel = new GameObject("BankPanel", new Type[2] { typeof(RectTransform), typeof(Image) }); _mainPanel.transform.SetParent(_canvasGO.transform, false); RectTransform component2 = _mainPanel.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.sizeDelta = new Vector2(420f, 320f); component2.anchoredPosition = Vector2.zero; Image component3 = _mainPanel.GetComponent<Image>(); if ((Object)(object)_bgSprite != (Object)null) { component3.sprite = _bgSprite; component3.type = (Type)0; component3.preserveAspect = false; ((Graphic)component3).color = Color.white; } else { ((Graphic)component3).color = new Color(0.18f, 0.14f, 0.09f, 0.92f); } GameObject val2 = new GameObject("InnerPanel", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(_mainPanel.transform, false); RectTransform component4 = val2.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = new Vector2(14f, 14f); component4.offsetMax = new Vector2(-14f, -14f); ((Graphic)val2.GetComponent<Image>()).color = PanelBgColor; Transform transform = val2.transform; _titleText = CreateText(transform, "Title", "Haldor's Bank", 26f, GoldTextColor, (TextAlignmentOptions)514); RectTransform component5 = ((Component)_titleText).GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 1f); component5.anchorMax = new Vector2(1f, 1f); component5.pivot = new Vector2(0.5f, 1f); component5.sizeDelta = new Vector2(0f, 36f); component5.anchoredPosition = new Vector2(0f, -8f); CreateSeparator(transform, -48f); _bankBalanceText = CreateText(transform, "BankBalance", "Bank Balance: 0", 26f, GoldTextColor, (TextAlignmentOptions)514); RectTransform component6 = ((Component)_bankBalanceText).GetComponent<RectTransform>(); component6.anchorMin = new Vector2(0f, 1f); component6.anchorMax = new Vector2(1f, 1f); component6.pivot = new Vector2(0.5f, 1f); component6.sizeDelta = new Vector2(0f, 36f); component6.anchoredPosition = new Vector2(0f, -64f); _inventoryCoinsText = CreateText(transform, "InventoryCoins", "Inventory Coins: 0", 20f, new Color(0.85f, 0.85f, 0.85f), (TextAlignmentOptions)514); RectTransform component7 = ((Component)_inventoryCoinsText).GetComponent<RectTransform>(); component7.anchorMin = new Vector2(0f, 1f); component7.anchorMax = new Vector2(1f, 1f); component7.pivot = new Vector2(0.5f, 1f); component7.sizeDelta = new Vector2(0f, 28f); component7.anchoredPosition = new Vector2(0f, -104f); _totalWealthText = CreateText(transform, "TotalWealth", "Total Wealth: 0", 16f, new Color(0.58f, 0.58f, 0.58f), (TextAlignmentOptions)514); RectTransform component8 = ((Component)_totalWealthText).GetComponent<RectTransform>(); component8.anchorMin = new Vector2(0f, 1f); component8.anchorMax = new Vector2(1f, 1f); component8.pivot = new Vector2(0.5f, 1f); component8.sizeDelta = new Vector2(0f, 22f); component8.anchoredPosition = new Vector2(0f, -136f); CreateSeparator(transform, -164f); _statusText = CreateText(transform, "Status", "", 16f, new Color(0.7f, 0.7f, 0.7f), (TextAlignmentOptions)514); RectTransform component9 = ((Component)_statusText).GetComponent<RectTransform>(); component9.anchorMin = new Vector2(0f, 0f); component9.anchorMax = new Vector2(1f, 0f); component9.pivot = new Vector2(0.5f, 0f); component9.sizeDelta = new Vector2(0f, 24f); component9.anchoredPosition = new Vector2(0f, _btnHeight + 20f); float num = 160f; float num2 = 16f; float num3 = (0f - (num * 2f + num2)) / 2f; float y = 10f; _depositButton = CreateActionButton(transform, "DepositButton", "Deposit All", num3, y, num, new UnityAction(OnDeposit), out _depositLabel, out _depositSelected); _withdrawButton = CreateActionButton(transform, "WithdrawButton", "Withdraw All", num3 + num + num2, y, num, new UnityAction(OnWithdraw), out _withdrawLabel, out _withdrawSelected); _canvasGO.SetActive(false); _uiBuilt = true; } private Button CreateActionButton(Transform parent, string name, string label, float x, float y, float width, UnityAction onClick, out TMP_Text outLabel, out GameObject outSelected) { //IL_005e: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00f5: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) outLabel = null; outSelected = null; if ((Object)(object)_buttonTemplate == (Object)null) { return null; } GameObject val = Object.Instantiate<GameObject>(_buttonTemplate, parent); ((Object)val).name = name; val.SetActive(true); Button component = val.GetComponent<Button>(); if ((Object)(object)component != (Object)null) { ((UnityEventBase)component.onClick).RemoveAllListeners(); ((UnityEvent)component.onClick).AddListener(onClick); Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component).navigation = navigation; } outLabel = val.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)outLabel != (Object)null) { ((Component)outLabel).gameObject.SetActive(true); outLabel.text = label; } StripButtonHints(val, outLabel); RectTransform component2 = val.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0f); component2.anchorMax = new Vector2(0.5f, 0f); component2.pivot = new Vector2(0f, 0f); component2.sizeDelta = new Vector2(width, _btnHeight); component2.anchoredPosition = new Vector2(x, y); GameObject val2 = new GameObject("selected", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(val.transform, false); val2.transform.SetAsFirstSibling(); RectTransform component3 = val2.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = new Vector2(-4f, -4f); component3.offsetMax = new Vector2(4f, 4f); ((Graphic)val2.GetComponent<Image>()).color = SelectedColor; val2.SetActive(false); outSelected = val2; return component; } private void CreateSeparator(Transform parent, float yPos) { //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_0037: 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_005d: 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_0087: 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_00c9: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Separator", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.05f, 1f); component.anchorMax = new Vector2(0.95f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(0f, 2f); component.anchoredPosition = new Vector2(0f, yPos); ((Graphic)val.GetComponent<Image>()).color = new Color(GoldTextColor.r, GoldTextColor.g, GoldTextColor.b, 0.3f); } private void OnDeposit() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (inventory == null) { return; } string coinName = GetCoinName(); if (!string.IsNullOrEmpty(coinName)) { int num = inventory.CountItems(coinName, -1, true); if (num <= 0) { SetStatus("No coins to deposit!"); return; } inventory.RemoveItem(coinName, num, -1, true); _bankBalance += num; SaveBalance(); RefreshDisplay(); SetStatus($"Deposited {num:N0} coins"); ((Character)localPlayer).Message((MessageType)2, $"Deposited {num:N0} coins", 0, (Sprite)null); } } private void OnWithdraw() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); if (inventory == null) { return; } if (_bankBalance <= 0) { SetStatus("Bank is empty!"); return; } ObjectDB instance = ObjectDB.instance; GameObject obj = ((instance != null) ? instance.GetItemPrefab("Coins") : null); ItemDrop val = ((obj != null) ? obj.GetComponent<ItemDrop>() : null); if (!((Object)(object)val == (Object)null)) { int bankBalance = _bankBalance; if (inventory.AddItem("Coins", bankBalance, val.m_itemData.m_quality, val.m_itemData.m_variant, 0L, "", false) == null) { SetStatus("Inventory full!"); return; } _bankBalance = 0; SaveBalance(); RefreshDisplay(); SetStatus($"Withdrew {bankBalance:N0} coins"); ((Character)localPlayer).Message((MessageType)2, $"Withdrew {bankBalance:N0} coins", 0, (Sprite)null); } } private void RefreshDisplay() { int inventoryCoins = GetInventoryCoins(); if ((Object)(object)_bankBalanceText != (Object)null) { _bankBalanceText.text = $"Bank Balance: {_bankBalance:N0}"; } if ((Object)(object)_inventoryCoinsText != (Object)null) { _inventoryCoinsText.text = $"Inventory Coins: {inventoryCoins:N0}"; } if ((Object)(object)_totalWealthText != (Object)null) { _totalWealthText.text = $"Total Wealth: {_bankBalance + inventoryCoins:N0}"; } if ((Object)(object)_depositButton != (Object)null) { ((Selectable)_depositButton).interactable = inventoryCoins > 0; } if ((Object)(object)_withdrawButton != (Object)null) { ((Selectable)_withdrawButton).interactable = _bankBalance > 0; } UpdateControllerHighlight(); } private void SetStatus(string msg) { if ((Object)(object)_statusText != (Object)null) { _statusText.text = msg; } } private void LoadBalance() { _bankBalance = BankBalanceStore.Read(Player.m_localPlayer); } private void SaveBalance() { BankBalanceStore.Write(Player.m_localPlayer, _bankBalance); } private int GetInventoryCoins() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return 0; } Inventory inventory = ((Humanoid)localPlayer).GetInventory(); string coinName = GetCoinName(); if (inventory == null || string.IsNullOrEmpty(coinName)) { return 0; } return inventory.CountItems(coinName, -1, true); } private string GetCoinName() { ObjectDB instance = ObjectDB.instance; GameObject obj = ((instance != null) ? instance.GetItemPrefab("Coins") : null); return ((obj != null) ? obj.GetComponent<ItemDrop>() : null)?.m_itemData?.m_shared?.m_name; } private bool ExtractAssets() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null) { return false; } Texture2D val = TextureLoader.LoadUITexture("PanelBackground"); if ((Object)(object)val != (Object)null) { _bgSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } if ((Object)(object)instance.m_craftButton != (Object)null) { RectTransform component = ((Component)instance.m_craftButton).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { Rect rect = component.rect; _btnHeight = Mathf.Max(((Rect)(ref rect)).height, 36f); } _buttonTemplate = Object.Instantiate<GameObject>(((Component)instance.m_craftButton).gameObject); ((Object)_buttonTemplate).name = "BankButtonTemplate"; _buttonTemplate.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_buttonTemplate); } _valheimFont = FindValheimFont(); return (Object)(object)_buttonTemplate != (Object)null; } private TMP_Text CreateText(Transform parent, string name, string text, float fontSize, Color color, TextAlignmentOptions alignment) { //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) //IL_004f: 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) GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_valheimFont != (Object)null) { ((TMP_Text)val2).font = _valheimFont; } ((TMP_Text)val2).fontSize = fontSize; ((Graphic)val2).color = color; ((TMP_Text)val2).alignment = alignment; ((TMP_Text)val2).text = text; ((TMP_Text)val2).overflowMode = (TextOverflowModes)1; return (TMP_Text)(object)val2; } private TMP_FontAsset FindValheimFont() { InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)instance.m_recipeName != (Object)null && (Object)(object)instance.m_recipeName.font != (Object)null) { return instance.m_recipeName.font; } if ((Object)(object)instance.m_recipeDecription != (Object)null && (Object)(object)instance.m_recipeDecription.font != (Object)null) { return instance.m_recipeDecription.font; } } TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>(); foreach (TMP_FontAsset val in array) { if (((Object)val).name.Contains("Valheim") || ((Object)val).name.Contains("Averia")) { return val; } } return null; } private static void StripButtonHints(GameObject buttonGO, TMP_Text labelText) { for (int num = buttonGO.transform.childCount - 1; num >= 0; num--) { Transform child = buttonGO.transform.GetChild(num); if (!((Object)(object)labelText != (Object)null) || (!((Object)(object)((Component)child).gameObject == (Object)(object)((Component)labelText).gameObject) && !labelText.transform.IsChildOf(child))) { Object.DestroyImmediate((Object)(object)((Component)child).gameObject); } } } private void OnDestroy() { if ((Object)(object)_buttonTemplate != (Object)null) { Object.Destroy((Object)(object)_buttonTemplate); } } } public class TraderUI : MonoBehaviour { private class BuyEntry { public string PrefabName; public string Name; public string Description; public int Price; public int Stack; public string Category; public Sprite Icon; } private class SellEntry { public ItemData Item; public string PrefabName; public string Name; public int Price; public int ConfigStack; public string Category; public Sprite Icon; } private bool _isVisible; private Trader _currentTrader; private StoreGui _currentStoreGui; private int _activeTab; private static readonly string[] TabNames = new string[3] { "Buy", "Sell", "Bank" }; private int _selectedBuyIndex = -1; private int _selectedSellIndex = -1; private readonly Dictionary<string, bool> _buyCategoryCollapsed = new Dictionary<string, bool>(); private readonly Dictionary<string, bool> _sellCategoryCollapsed = new Dictionary<string, bool>(); private static readonly string[] CategoryBuckets = new string[9] { "Weapons", "Armor", "Shields", "Ammo", "Consumables", "Materials", "Utility", "Trophies", "Misc" }; private string _searchFilter = ""; private TMP_InputField _searchInput; private string _activeCategoryFilter; private readonly List<Button> _categoryFilterButtons = new List<Button>(); private readonly List<string> _categoryFilterKeys = new List<string>(); private int _joyCategoryFocusIndex = -1; private GameObject _canvasGO; private bool _uiBuilt; private Sprite _bgSprite; private Sprite _textFieldSprite; private Sprite _catBtnSprite; private GameObject _recipeElementPrefab; private GameObject _buttonTemplate; private float _scrollSensitivity = 40f; private TMP_FontAsset _valheimFont; private GameObject _mainPanel; private RectTransform _leftColumn; private RectTransform _middleColumn; private RectTransform _rightColumn; private GameObject _tabBuy; private GameObject _tabSell; private GameObject _tabBank; private int _bankBalance; private int _bankFocusedButton; private GameObject _bankContentPanel; private TMP_Text _bankBalanceText; private TMP_Text _bankInvCoinsText; private TMP_Text _bankTotalText; private TMP_Text _bankStatusText; private Button _bankDepositButton; private Button _bankWithdrawButton; private GameObject _bankDepositSelected; private GameObject _bankWithdrawSelected; private RectTransform _listRoot; private ScrollRect _listScrollRect; private TMP_Text _itemNameText; private TMP_Text _itemDescText; private ScrollRect _descScrollRect; private int _descScrollResetFrames; private Button _actionButton; private TMP_Text _actionButtonLabel; private TMP_Text _coinDisplayText; private RenderTexture _playerPreviewRT; private GameObject _playerCamGO; private Camera _playerCam; private GameObject _playerClone; private GameObject _playerLightRig; private RawImage _playerPreviewImg; private static readonly Vector3 PlayerSpawnPos = new Vector3(10000f, 5000f, 10000f); private RenderTexture _haldorPreviewRT; private GameObject _haldorCamGO; private Camera _haldorCam; private GameObject _haldorClone; private GameObject _haldorLightRig; private RawImage _haldorPreviewImg; private static readonly Vector3 HaldorSpawnPos = new Vector3(10000f, 5000f, 10020f); private Color _savedAmbientColor; private float _savedAmbientIntensity; private AmbientMode _savedAmbientMode; private float _previewRotation; private const float AutoRotateSpeed = 12f; private bool _isDraggingPlayerPreview; private float _lastMouseX; private const float MouseDragSensitivity = 0.5f; private const float ColGap = 4f; private const float TabTopGap = 6f; private const float ExtraMiddleWidth = 80f; private const float OuterPad = 6f; private const float SearchBoxHeight = 32f; private const float FilterRowHeight = 38f; private static readonly Color ColOverlay = new Color(0f, 0f, 0f, 0f); private static readonly Color GoldColor = new Color(0.83f, 0.64f, 0.31f, 1f); private static readonly Color GoldTextColor = new Color(0.83f, 0.52f, 0.18f, 1f); private static readonly Color CategoryHeaderBg = new Color(0.3f, 0.25f, 0.15f, 0.85f); private static readonly Color CategoryHeaderText = new Color(1f, 0.9f, 0.5f, 1f); private float _panelWidth; private float _panelHeight; private float _leftColWidth; private float _midColWidth; private float _rightColWidth; private float _leftPad; private float _bottomPad; private float _colTopInset; private float _tabBtnHeight; private float _craftBtnHeight; private readonly List<BuyEntry> _allBuyEntries = new List<BuyEntry>(); private readonly List<SellEntry> _allSellEntries = new List<SellEntry>(); private readonly List<(GameObject go, int dataIndex)> _listElements = new List<(GameObject, int)>(); private readonly List<GameObject> _categoryHeaders = new List<GameObject>(); private int _lastInventoryHash; private int _lastCoinDisplayCount = -1; private int _lastBankBalanceDisplay = -1; private int _lastBankInvCoinsDisplay = -1; private Dictionary<string, string> _savedEquipSlots; public bool IsVisible => _isVisible; public bool IsSearchFocused { get { if ((Object)(object)_searchInput != (Object)null) { return _searchInput.isFocused; } return false; } } public void Show(Trader trader, StoreGui storeGui) { _currentTrader = trader; _currentStoreGui = storeGui; if (!_uiBuilt) { BuildUI(); } if (_uiBuilt) { _canvasGO.SetActive(true); _isVisible = true; _activeTab = 0; _selectedBuyIndex = -1; _selectedSellIndex = -1; _searchFilter = ""; if ((Object)(object)_searchInput != (Object)null) { _searchInput.text = ""; } _activeCategoryFilter = null; _joyCategoryFocusIndex = -1; _lastInventoryHash = 0; _lastCoinDisplayCount = -1; _lastBankBalanceDisplay = -1; _lastBankInvCoinsDisplay = -1; SetupPlayerPreview(); SetupHaldorPreview(); _previewRotation = 0f; EnablePreviewCameras(); LoadBankBalance(); BuildBuyEntries(); BuildSellEntries(); RefreshTabHighlights(); RefreshTabPanels(); UpdateCoinDisplay(); } } public void Hide() { _isVisible = false; DisablePreviewCameras(); ClearPlayerPreview(); ClearHaldorPreview(); if ((Object)(object)_canvasGO != (Object)null) { _canvasGO.SetActive(false); } _currentTrader = null; _currentStoreGui = null; } private void Update() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) if (!_isVisible) { return; } if ((Object)(object)_currentTrader != (Object)null && (Object)(object)Player.m_localPlayer != (Object)null && Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)_currentTrader).transform.position) > 15f) { Hide(); return; } if (!ZInput.IsGamepadActive()) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } else { Cursor.visible = false; } if (Input.GetKeyDown((KeyCode)27)) { Hide(); return; } if (!IsSearchFocused) { if (Input.GetKeyDown((KeyCode)113)) { SwitchTab(Mathf.Max(0, _activeTab - 1)); } if (Input.GetKeyDown((KeyCode)101)) { SwitchTab(Mathf.Min(2, _activeTab + 1)); } } UpdatePlayerPreviewRotation(); UpdatePlayerCamera(); RefreshSellListIfChanged(); UpdateCoinDisplay(); if (_activeTab == 2) { RefreshBankDisplay(); } UpdateGamepadInput(); } private void LateUpdate() { //IL_002c: 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) if (!_isVisible) { return; } Hud instance = Hud.instance; if ((Object)(object)instance != (Object)null) { if ((Object)(object)instance.m_crosshair != (Object)null) { ((Graphic)instance.m_crosshair).color = Color.clear; } if ((Object)(object)instance.m_hoverName != (Object)null) { ((TMP_Text)instance.m_hoverName).text = ""; } } if (_descScrollResetFrames > 0 && (Object)(object)_descScrollRect != (Object)null) { _descScrollRect.verticalNormalizedPosition = 1f; _descScrollRect.velocity = Vector2.zero; _descScrollResetFrames--; } if ((Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)null && ((Object)(object)_searchInput == (Object)null || (Object)(object)EventSystem.current.currentSelectedGameObject != (Object)(object)((Component)_searchInput).gameObject)) { EventSystem.current.SetSelectedGameObject((GameObject)null); } SaveAmbient(); try { SetPreviewAmbient(); if (_activeTab == 0 && (Object)(object)_playerCam != (Object)null) { _playerCam.Render(); } else if (_activeTab == 1 && (Object)(object)_haldorCam != (Object)null) { _haldorCam.Render(); } } finally { RestoreAmbient(); } } private void OnDestroy() { ClearPlayerPreview(); ClearHaldorPreview(); if ((Object)(object)_playerCamGO != (Object)null) { Object.Destroy((Object)(object)_playerCamGO); } if ((Object)(object)_haldorCamGO != (Object)null) { Object.Destroy((Object)(object)_haldorCamGO); } if ((Object)(object)_playerPreviewRT != (Object)null) { _playerPreviewRT.Release(); Object.Destroy((Object)(object)_playerPreviewRT); } if ((Object)(object)_haldorPreviewRT != (Object)null) { _haldorPreviewRT.Release(); Object.Destroy((Object)(object)_haldorPreviewRT); } if ((Object)(object)_buttonTemplate != (Object)null) { Object.Destroy((Object)(object)_buttonTemplate); } if ((Object)(object)_canvasGO != (Object)null) { Object.Destroy((Object)(object)_canvasGO); } } private void UpdateGamepadInput() { if (ZInput.GetButtonDown("JoyTabLeft")) { SwitchTab(Mathf.Max(0, _activeTab - 1)); } if (ZInput.GetButtonDown("JoyTabRight")) { SwitchTab(Mathf.Min(2, _activeTab + 1)); } if (ZInput.GetButtonDown("JoyButtonB")) { Hide(); return; } if (ZInput.GetButtonDown("JoyLStickDown") || ZInput.GetButtonDown("JoyDPadDown")) { _joyCategoryFocusIndex = -1; UpdateCategoryFilterVisuals(); MoveSelection(1); if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject((GameObject)null); } } if (ZInput.GetButtonDown("JoyLStickUp") || ZInput.GetButtonDown("JoyDPadUp")) { _joyCategoryFocusIndex = -1; UpdateCategoryFilterVisuals(); MoveSelection(-1); if ((Object)(object)EventSystem.current != (Object)null) { EventSystem.current.SetSelectedGameObject((GameObject)null); } } if (ZInput.GetButtonDown("JoyLStickLeft") || ZInput.GetButtonDown("JoyDPadLeft")) { if (_activeTab == 2) { _bankFocusedButton = 0; UpdateBankHighlight(); } else { NavigateCategoryButtons(-1); } } if (ZInput.GetButtonDown("JoyLStickRight") || ZInput.GetButtonDown("JoyDPadRight")) { if (_activeTab == 2) { _bankFocusedButton = 1; UpdateBankHighlight(); } else { NavigateCategoryButtons(1); } } if (ZInput.GetButtonDown("JoyButtonA")) { if (_joyCategoryFocusIndex >= 0 && _joyCategoryFocusIndex < _categoryFilterKeys.Count) { OnCategoryFilterClicked(_categoryFilterKeys[_joyCategoryFocusIndex]); _joyCategoryFocusIndex = -1; UpdateCategoryFilterVisuals(); } else if (_activeTab == 2) { if (_bankFocusedButton == 0) { OnBankDeposit(); } else { OnBankWithdraw(); } } else if ((Object)(object)_actionButton != (Object)null && ((Selectable)_actionButton).interactable) { OnActionButtonClicked(); } } if (ZInput.GetButtonDown("JoyButtonX")) { ToggleFocusedCategory(); } if ((Object)(object)_descScrollRect != (Object)null) { float num = 2f; if (ZInput.GetButton("JoyRStickDown")) { ScrollRect descScrollRect = _descScrollRect; descScrollRect.verticalNormalizedPosition -= num * Time.deltaTime; _descScrollRect.verticalNormalizedPosition = Mathf.Clamp01(_descScrollRect.verticalNormalizedPosition); } if (ZInput.GetButton("JoyRStickUp")) { ScrollRect descScrollRect2 = _descScrollRect; descScrollRect2.verticalNormalizedPosition += num * Time.deltaTime; _descScrollRect.verticalNormalizedPosition = Mathf.Clamp01(_descScrollRect.verticalNormalizedPosition); } } } private void NavigateCategoryButtons(int dir) { if (_categoryFilterButtons.Count != 0) { if (_joyCategoryFocusIndex < 0) { _joyCategoryFocusIndex = ((dir <= 0) ? (_categoryFilterButtons.Count - 1) : 0); } else { _joyCategoryFocusIndex = Mathf.Clamp(_joyCategoryFocusIndex + dir, 0, _categoryFilterButtons.Count - 1); } UpdateCategoryFilterVisuals(); } } private void MoveSelection(int direction) { if (_activeTab == 0) { int visibleBuyCount = GetVisibleBuyCount(); if (visibleBuyCount != 0) { int num = _selectedBuyIndex + direction; num = Mathf.Clamp(num, 0, visibleBuyCount - 1); SelectBuyItem(num); EnsureItemVisible(num); } } else if (_activeTab == 1) { int visibleSellCount = GetVisibleSellCount(); if (visibleSellCount != 0) { int num2 = _selectedSellIndex + direction; num2 = Mathf.Clamp(num2, 0, visibleSellCount - 1); SelectSellItem(num2); EnsureItemVisible(num2); } } else if (_activeTab == 2) { _bankFocusedButton = ((direction > 0) ? 1 : 0); UpdateBankHighlight(); } } private void ToggleFocusedCategory() { if (_activeTab == 0 && _selectedBuyIndex >= 0) { List<BuyEntry> filteredBuyEntries = GetFilteredBuyEntries(); if (_selectedBuyIndex < filteredBuyEntries.Count) { string category = filteredBuyEntries[_selectedBuyIndex].Category; _buyCategoryCollapsed[category] = !(_buyCategoryCollapsed.TryGetValue(category, out var value) && value); PopulateCurrentList(); } } else if (_activeTab == 1 && _selectedSellIndex >= 0) { List<SellEntry> filteredSellEntries = GetFilteredSellEntries(); if (_selectedSellIndex < filteredSellEntries.Count) { string category2 = filteredSellEntries[_selectedSellIndex].Category; _sellCategoryCollapsed[category2] = !(_sellCategoryCollapsed.TryGetValue(category2, out var value2) && value2); PopulateCurrentList(); } } } private void BuildUI() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0074: 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_00b1: 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_00cf: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown //IL_016a: 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_0194: 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_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) if (!ExtractAssets()) { HaldorOverhaul.Log.LogError((object)"[TraderUI] Failed to extract Valheim assets."); return; } _canvasGO = new GameObject("HaldorOverhaul_Canvas"); _canvasGO.transform.SetParent(((Component)this).transform); Canvas obj = _canvasGO.AddComponent<Canvas>(); obj.renderMode = (RenderMode)0; obj.sortingOrder = 100; CanvasScaler obj2 = _canvasGO.AddComponent<CanvasScaler>(); obj2.uiScaleMode = (ScaleMode)1; obj2.referenceResolution = new Vector2(1920f, 1080f); obj2.matchWidthOrHeight = 0.5f; _canvasGO.AddComponent<GraphicRaycaster>(); GameObject val = new GameObject("Overlay", new Type[1] { typeof(RectTransform) }); val.transform.SetParent(_canvasGO.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; ((Graphic)val.AddComponent<Image>()).color = ColOverlay; _mainPanel = new GameObject("MainPanel", new Type[2] { typeof(RectTransform), typeof(Image) }); _mainPanel.transform.SetParent(_canvasGO.transform, false); RectTransform component2 = _mainPanel.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.pivot = new Vector2(0.5f, 0.5f); component2.sizeDelta = new Vector2(_panelWidth, _panelHeight); component2.anchoredPosition = Vector2.zero; Image component3 = _mainPanel.GetComponent<Image>(); if ((Object)(object)_bgSprite != (Object)null) { component3.sprite = _bgSprite; component3.type = (Type)0; component3.preserveAspect = false; ((Graphic)component3).color = Color.white; } else { ((Graphic)component3).color = new Color(0.18f, 0.14f, 0.09f, 0.92f); } float num = _leftPad + _leftColWidth + 4f; float num2 = num + _midColWidth + 4f; _leftColumn = CreateColumn("LeftColumn", _leftPad, _leftPad + _leftColWidth); _middleColumn = CreateColumn("MiddleColumn", num, num + _midColWidth); _rightColumn = CreateColumn("RightColumn", num2, num2 + _rightColWidth); BuildItemListArea(); BuildDescriptionColumn(); BuildPreviewColumn(); _tabBuy = CreateTabButton("Buy", 0, _leftPad + _leftColWidth / 2f, _leftColWidth, 6f); _tabSell = CreateTabButton("Sell", 1, num + _midColWidth / 2f, _midColWidth, 6f); _tabBank = CreateTabButton("Bank", 2, num2 + _rightColWidth / 2f, _rightColWidth, 6f); BuildBankPanel(); _canvasGO.SetActive(false); _uiBuilt = true; } private bool ExtractAssets() { //IL_004d: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0110: 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) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_crafting == (Object)null) { return false; } Texture2D val = TextureLoader.LoadUITexture("PanelBackground"); if ((Object)(object)val != (Object)null) { _bgSprite = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } _recipeElementPrefab = instance.m_recipeElementPrefab; if ((Object)(object)_recipeElementPrefab == (Object)null) { return false; } Texture2D val2 = TextureLoader.LoadUITexture("SearchBarBackground"); if ((Object)(object)val2 != (Object)null) { _textFieldSprite = Sprite.Create(val2, new Rect(0f, 0f, (float)((Texture)val2).width, (float)((Texture)val2).height), new Vector2(0.5f, 0.5f)); } Texture2D val3 = TextureLoader.LoadUITexture("CategoryBackground"); if ((Object)(object)val3 != (Object)null) { _catBtnSprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f)); } _craftBtnHeight = 30f; Rect rect; if ((Object)(object)instance.m_craftButton != (Object)null) { RectTransform component = ((Component)instance.m_craftButton).GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { rect = component.rect; _craftBtnHeight = Mathf.Max(((Rect)(ref rect)).height, 30f); } _buttonTemplate = Object.Instantiate<GameObject>(((Component)instance.m_craftButton).gameObject); ((Object)_buttonTemplate).name = "ButtonTemplate"; _buttonTemplate.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_buttonTemplate); } if ((Object)(object)instance.m_recipeListRoot != (Object)null) { ScrollRect componentInParent = ((Component)instance.m_recipeListRoot).GetComponentInParent<ScrollRect>(); if ((Object)(object)componentInParent != (Object)null) { _scrollSensitivity = componentInParent.scrollSensitivity; } } _valheimFont = FindValheimFont(); RectTransform component2 = ((Component)instance.m_crafting).GetComponent<RectTransform>(); rect = component2.rect; float width = ((Rect)(ref rect)).width; rect = component2.rect; float num = ((Rect)(ref rect)).height; if (width <= 10f) { width = 567f; } if (num <= 10f) { num = 480f; } float num2 = 260f; Transform val4 = ((Component)instance.m_crafting).transform.Find("Decription"); if ((Object)(object)val4 != (Object)null) { RectTransform val5 = (RectTransform)(object)((val4 is RectTransform) ? val4 : null); if ((Object)(object)val5 != (Object)null) { rect = val5.rect; float width2 = ((Rect)(ref rect)).width; if (width2 > 10f) { num2 = width2; } } } _leftColWidth = num2; _midColWidth = num2 + 80f; _rightColWidth = num2; _leftPad = 6f; float num3 = _leftColWidth + 4f + _midColWidth + 4f + _rightColWidth; _panelWidth = num3 + 12f; _panelHeight = num * 0.9f; _bottomPad = 6f; _tabBtnHeight = Mathf.Max(_craftBtnHeight, 30f); _colTopInset = 6f + _tabBtnHeight + 6f; return true; } private RectTransform CreateColumn(string name, float xLeft, float xRight) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name, new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent(_mainPanel.transform, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(0f, 1f); component.pivot = new Vector2(0f, 0.5f); component.offsetMin = new Vector2(xLeft, _bottomPad); component.offsetMax = new Vector2(xRight, 0f - _colTopInset); ApplyPanelStyle(val.GetComponent<Image>()); return component; } private void BuildItemListArea() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_005e: 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_007e: 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_00b7: 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_00eb: Expected O, but got Unknown //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_016d: Unknown result type (might be due to invalid IL or missing references) BuildSearchBox(); BuildCategoryFilterRow(); GameObject val = new GameObject("ItemListScroll", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Mask) }); val.transform.SetParent((Transform)(object)_leftColumn, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = new Vector2(2f, 2f); component.offsetMax = new Vector2(-2f, -80f); ((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f); val.GetComponent<Mask>().showMaskGraphic = false; GameObject val2 = new GameObject("Content", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent(val.transform, false); _listRoot = val2.GetComponent<RectTransform>(); _listRoot.anchorMin = new Vector2(0f, 1f); _listRoot.anchorMax = new Vector2(1f, 1f); _listRoot.pivot = new Vector2(0.5f, 1f); _listRoot.anchoredPosition = Vector2.zero; _listRoot.sizeDelta = Vector2.zero; Scrollbar verticalScrollbar = CreateHiddenScrollbar((Transform)(object)_leftColumn); _listScrollRect = val.AddComponent<ScrollRect>(); _listScrollRect.content = _listRoot; _listScrollRect.viewport = component; _listScrollRect.vertical = true; _listScrollRect.horizontal = false; _listScrollRect.movementType = (MovementType)2; _listScrollRect.scrollSensitivity = _scrollSensitivity * 4f; _listScrollRect.verticalScrollbar = verticalScrollbar; _listScrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)0; } private void BuildSearchBox() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0179: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0247: 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_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("SearchField", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent((Transform)(object)_leftColumn, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(0f, 32f); component.anchoredPosition = new Vector2(0f, -2f); Image component2 = val.GetComponent<Image>(); if ((Object)(object)_textFieldSprite != (Object)null) { component2.sprite = _textFieldSprite; component2.type = (Type)1; ((Graphic)component2).color = Color.white; } else { ((Graphic)component2).color = new Color(0.12f, 0.08f, 0.04f, 0.9f); } GameObject val2 = new GameObject("TextArea", new Type[2] { typeof(RectTransform), typeof(RectMask2D) }); val2.transform.SetParent(val.transform, false); RectTransform component3 = val2.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = new Vector2(8f, 2f); component3.offsetMax = new Vector2(-8f, -2f); GameObject val3 = new GameObject("Placeholder", new Type[1] { typeof(RectTransform) }); val3.SetActive(false); val3.transform.SetParent(val2.transform, false); TextMeshProUGUI val4 = val3.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_valheimFont != (Object)null) { ((TMP_Text)val4).font = _valheimFont; } ((TMP_Text)val4).text = "Search..."; ((TMP_Text)val4).fontSize = 16f; ((Graphic)val4).color = new Color(0.6f, 0.55f, 0.45f, 0.7f); ((TMP_Text)val4).alignment = (TextAlignmentOptions)4097; RectTransform component4 = val3.GetComponent<RectTransform>(); component4.anchorMin = Vector2.zero; component4.anchorMax = Vector2.one; component4.offsetMin = Vector2.zero; component4.offsetMax = Vector2.zero; val3.SetActive(true); GameObject val5 = new GameObject("Text", new Type[1] { typeof(RectTransform) }); val5.SetActive(false); val5.transform.SetParent(val2.transform, false); TextMeshProUGUI val6 = val5.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_valheimFont != (Object)null) { ((TMP_Text)val6).font = _valheimFont; } ((TMP_Text)val6).fontSize = 16f; ((Graphic)val6).color = Color.white; ((TMP_Text)val6).alignment = (TextAlignmentOptions)4097; RectTransform component5 = val5.GetComponent<RectTransform>(); component5.anchorMin = Vector2.zero; component5.anchorMax = Vector2.one; component5.offsetMin = Vector2.zero; component5.offsetMax = Vector2.zero; val5.SetActive(true); _searchInput = val.AddComponent<TMP_InputField>(); _searchInput.textViewport = component3; _searchInput.textComponent = (TMP_Text)(object)val6; _searchInput.placeholder = (Graphic)(object)val4; if ((Object)(object)_valheimFont != (Object)null) { _searchInput.fontAsset = _valheimFont; } _searchInput.pointSize = 16f; _searchInput.characterLimit = 50; ((UnityEvent<string>)(object)_searchInput.onValueChanged).AddListener((UnityAction<string>)OnSearchChanged); } private void BuildCategoryFilterRow() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown GameObject val = new GameObject("CategoryFilterRow", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent((Transform)(object)_leftColumn, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(-4f, 38f); component.anchoredPosition = new Vector2(0f, -38f); ((Graphic)val.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0f); HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 2f; ((LayoutGroup)obj).padding = new RectOffset(2, 2, 2, 2); ((LayoutGroup)obj).childAlignment = (TextAnchor)4; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; _categoryFilterButtons.Clear(); _categoryFilterKeys.Clear(); Dictionary<string, string> dictionary = new Dictionary<string, string> { { "Weapons", "AxeBronze" }, { "Armor", "HelmetTrollLeather" }, { "Shields", "ShieldWood" }, { "Ammo", "ArrowObsidian" }, { "Consumables", "MeadStaminaMinor" }, { "Materials", "Bronze" }, { "Utility", "BeltStrength" }, { "Trophies", "TrophySkeleton" }, { "Misc", "Coins" } }; string[] categoryBuckets = CategoryBuckets; foreach (string text in categoryBuckets) { string value; string text2 = (dictionary.TryGetValue(text, out value) ? value : null); Sprite icon = ((text2 != null) ? GetItemIcon(text2) : null); Button val2 = CreateCategoryFilterButton(val.transform, text, icon); if ((Object)(object)val2 != (Object)null) { _categoryFilterButtons.Add(val2); _categoryFilterKeys.Add(text); } } UpdateCategoryFilterVisuals(); } private Button CreateCategoryFilterButton(Transform parent, string category, Sprite icon) { //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Expected O, but got Unknown //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: 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_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0257: 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) if ((Object)(object)_buttonTemplate == (Object)null) { return null; } GameObject val = Object.Instantiate<GameObject>(_buttonTemplate, parent); ((Object)val).name = "CatBtn_" + category; val.SetActive(true); for (int num = val.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val.transform.GetChild(num)).gameObject); } Animator component = val.GetComponent<Animator>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } ContentSizeFitter component2 = val.GetComponent<ContentSizeFitter>(); if ((Object)(object)component2 != (Object)null) { Object.DestroyImmediate((Object)(object)component2); } LayoutElement component3 = val.GetComponent<LayoutElement>(); if ((Object)(object)component3 != (Object)null) { Object.DestroyImmediate((Object)(object)component3); } Image component4 = val.GetComponent<Image>(); if ((Object)(object)component4 != (Object)null) { if ((Object)(object)_catBtnSprite != (Object)null) { component4.sprite = _catBtnSprite; component4.type = (Type)1; } ((Graphic)component4).color = Color.white; } Button component5 = val.GetComponent<Button>(); if ((Object)(object)component5 != (Object)null) { ((UnityEventBase)component5.onClick).RemoveAllListeners(); ((Selectable)component5).transition = (Transition)1; string cat = category; ((UnityEvent)component5.onClick).AddListener((UnityAction)delegate { OnCategoryFilterClicked(cat); }); Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)component5).navigation = navigation; ColorBlock colors = ((Selectable)component5).colors; ((ColorBlock)(ref colors)).normalColor = Color.white; ((ColorBlock)(ref colors)).highlightedColor = new Color(0.85f, 0.85f, 0.85f, 1f); ((ColorBlock)(ref colors)).pressedColor = new Color(0.65f, 0.65f, 0.65f, 1f); ((ColorBlock)(ref colors)).selectedColor = Color.white; ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)component5).colors = colors; } if ((Object)(object)icon != (Object)null) { GameObject val2 = new GameObject("Icon", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(val.transform, false); RectTransform component6 = val2.GetComponent<RectTransform>(); component6.anchorMin = new Vector2(0.15f, 0.15f); component6.anchorMax = new Vector2(0.85f, 0.85f); component6.offsetMin = Vector2.zero; component6.offsetMax = Vector2.zero; Image component7 = val2.GetComponent<Image>(); component7.sprite = icon; component7.preserveAspect = true; ((Graphic)component7).raycastTarget = false; } return component5; } private void OnCategoryFilterClicked(string category) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) _activeCategoryFilter = ((_activeCategoryFilter == category) ? null : category); _selectedBuyIndex = -1; _selectedSellIndex = -1; UpdateCategoryFilterVisuals(); if ((Object)(object)_listScrollRect != (Object)null) { _listScrollRect.verticalNormalizedPosition = 1f; _listScrollRect.velocity = Vector2.zero; } PopulateCurrentList(); } private void UpdateCategoryFilterVisuals() { //IL_008f: 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_0059: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _categoryFilterButtons.Count; i++) { Button val = _categoryFilterButtons[i]; if (!((Object)(object)val == (Object)null)) { bool flag = _activeCategoryFilter == _categoryFilterKeys[i]; bool flag2 = _joyCategoryFocusIndex == i; Image component = ((Component)val).GetComponent<Image>(); if ((Object)(object)component != (Object)null) { ((Graphic)component).color = (Color)(flag ? new Color(1f, 0.75f, 0.3f, 1f) : (flag2 ? new Color(0.85f, 0.75f, 0.6f, 1f) : Color.white)); } } } } private static Sprite GetItemIcon(string prefabName) { if ((Object)(object)ObjectDB.instance == (Object)null) { return null; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(prefabName); ItemDrop obj = ((itemPrefab != null) ? itemPrefab.GetComponent<ItemDrop>() : null); if (obj == null) { return null; } ItemData itemData = obj.m_itemData; if (itemData == null) { return null; } return itemData.GetIcon(); } private static Sprite FindSpriteByName(string spriteName) { Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>(); foreach (Sprite val in array) { if ((Object)(object)val != (Object)null && ((Object)val).name.Equals(spriteName, StringComparison.OrdinalIgnoreCase)) { return val; } } return null; } private void BuildDescriptionColumn() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: 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_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Expected O, but got Unknown //IL_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04b4: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04ef: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Unknown result type (might be due to invalid IL or missing references) //IL_0525: Expected O, but got Unknown //IL_0583: Unknown result type (might be due to invalid IL or missing references) //IL_05e6: Unknown result type (might be due to invalid IL or missing references) //IL_05fc: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0353: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) float craftBtnHeight = _craftBtnHeight; GameObject val = new GameObject("ItemName", new Type[1] { typeof(RectTransform) }); val.SetActive(false); val.transform.SetParent((Transform)(object)_middleColumn, false); _itemNameText = (TMP_Text)(object)val.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_valheimFont != (Object)null) { _itemNameText.font = _valheimFont; } _itemNameText.fontSize = 24f; ((Graphic)_itemNameText).color = Color.white; _itemNameText.alignment = (TextAlignmentOptions)514; _itemNameText.text = ""; val.SetActive(true); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0f, 1f); component.anchorMax = new Vector2(1f, 1f); component.pivot = new Vector2(0.5f, 1f); component.sizeDelta = new Vector2(-20f, 32f); component.anchoredPosition = new Vector2(0f, -4f); GameObject val2 = new GameObject("CoinDisplay", new Type[1] { typeof(RectTransform) }); val2.SetActive(false); val2.transform.SetParent((Transform)(object)_middleColumn, false); _coinDisplayText = (TMP_Text)(object)val2.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_valheimFont != (Object)null) { _coinDisplayText.font = _valheimFont; } _coinDisplayText.fontSize = 24f; ((Graphic)_coinDisplayText).color = GoldTextColor; _coinDisplayText.alignment = (TextAlignmentOptions)514; _coinDisplayText.text = "Coins: 0"; val2.SetActive(true); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(1f, 0f); component2.pivot = new Vector2(0.5f, 0f); component2.sizeDelta = new Vector2(-24f, 24f); component2.anchoredPosition = new Vector2(0f, craftBtnHeight + 14f); if ((Object)(object)_buttonTemplate != (Object)null) { GameObject val3 = Object.Instantiate<GameObject>(_buttonTemplate, (Transform)(object)_middleColumn); ((Object)val3).name = "ActionButton"; val3.SetActive(true); _actionButton = val3.GetComponent<Button>(); if ((Object)(object)_actionButton != (Object)null) { ((UnityEventBase)_actionButton.onClick).RemoveAllListeners(); ((UnityEvent)_actionButton.onClick).AddListener(new UnityAction(OnActionButtonClicked)); ((Selectable)_actionButton).interactable = false; Button actionButton = _actionButton; Navigation navigation = default(Navigation); ((Navigation)(ref navigation)).mode = (Mode)0; ((Selectable)actionButton).navigation = navigation; } _actionButtonLabel = val3.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)_actionButtonLabel != (Object)null) { ((Component)_actionButtonLabel).gameObject.SetActive(true); _actionButtonLabel.text = "Select an item"; } StripButtonHints(val3, _actionButtonLabel); GameObject val4 = new GameObject("Tint", new Type[2] { typeof(RectTransform), typeof(Image) }); val4.transform.SetParent(val3.transform, false); val4.transform.SetAsFirstSibling(); RectTransform component3 = val4.GetComponent<RectTransform>(); component3.anchorMin = Vector2.zero; component3.anchorMax = Vector2.one; component3.offsetMin = Vector2.zero; component3.offsetMax = Vector2.zero; Image component4 = val4.GetComponent<Image>(); ((Graphic)component4).color = new Color(0f, 0f, 0f, 0.75f); ((Graphic)component4).raycastTarget = false; RectTransform component5 = val3.GetComponent<RectTransform>(); component5.anchorMin = new Vector2(0f, 0f); component5.anchorMax = new Vector2(1f, 0f); component5.pivot = new Vector2(0.5f, 0f); component5.sizeDelta = new Vector2(-24f, craftBtnHeight); component5.anchoredPosition = new Vector2(0f, 8f); } float num = craftBtnHeight + 44f; GameObject val5 = new GameObject("DescScrollArea", new Type[3] { typeof(RectTransform), typeof(Image), typeof(Mask) }); val5.transform.SetParent((Transform)(object)_middleColumn, false); RectTransform component6 = val5.GetComponent<RectTransform>(); component6.anchorMin = Vector2.zero; component6.anchorMax = Vector2.one; component6.offsetMin = new Vector2(8f, num); component6.offsetMax = new Vector2(-14f, -38f); ((Graphic)val5.GetComponent<Image>()).color = new Color(1f, 1f, 1f, 0.003f); val5.GetComponent<Mask>().showMaskGraphic = false; GameObject val6 = new GameObject("DescText", new Type[1] { typeof(RectTransform) }); val6.SetActive(false); val6.transform.SetParent(val5.transform, false); _itemDescText = (TMP_Text)(object)val6.AddComponent<TextMeshProUGUI>(); if ((Object)(object)_valheimFont != (Object)null) { _itemDescText.font = _valheimFont; } _itemDescText.fontSize = 18f; ((Graphic)_itemDescText).color = Color.white; _itemDescText.alignment = (TextAlignmentOptions)257; _itemDescText.textWrappingMode = (TextWrappingModes)1; _itemDescText.overflowMode = (TextOverflowModes)0; _itemDescText.richText = true; _itemDescText.text = ""; RectTransform component7 = val6.GetComponent<RectTransform>(); component7.anchorMin = new Vector2(0f, 1f); component7.anchorMax = new Vector2(1f, 1f); component7.pivot = new Vector2(0.5f, 1f); component7.anchoredPosition = Vector2.zero; component7.sizeDelta = Vector2.zero; val6.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; val6.SetActive(true); Scrollbar verticalScrollbar = CreateHiddenScrollbar((Transform)(object)_middleColumn); _descScrollRect = val5.AddComponent<ScrollRect>(); _descScrollRect.content = component7; _descScrollRect.viewport = component6; _descScrollRect.vertical = true; _descScrollRect.horizontal = false; _descScrollRect.movementType = (MovementType)2; _descScrollRect.scrollSensitivity = _scrollSensitivity * 8f; _descScrollRect.verticalScrollbar = verticalScrollbar; _descScrollRect.verticalScrollbarVisibility = (ScrollbarVisibility)0; } private void BuildPreviewColumn() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: 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_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected O, but got Unknown //IL_0330: 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_0346: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) float rightColWidth = _rightColWidth; float num = _panelHeight - _colTopInset - _bottomPad; int num2 = 4; int num3 = Mathf.Max(64, Mathf.RoundToInt(rightColWidth) * num2); int num4 = Mathf.Max(64, Mathf.RoundToInt(num) * num2); _playerPreviewRT = new RenderTexture(num3, num4, 24, (RenderTextureFormat)0); _playerPreviewRT.antiAliasing = 4; ((Texture)_playerPreviewRT).filterMode = (FilterMode)2; _playerCamGO = new GameObject("TraderUI_PlayerCam"); Object.DontDestroyOnLoad((Object)(object)_playerCamGO); _playerCam = _playerCamGO.AddComponent<Camera>(); _playerCam.targetTexture = _playerPreviewRT; _playerCam.clearFlags = (CameraClearFlags)2; _playerCam.backgroundColor = new Color(0f, 0f, 0f, 0f); _playerCam.fieldOfView = 30f; _playerCam.nearClipPlane = 0.1f; _playerCam.farClipPlane = 10f; _playerCam.depth = -2f; ((Behaviour)_playerCam).enabled = false; int num5 = LayerMask.NameToLayer("character"); if (num5 < 0) { num5 = 9; } int num6 = LayerMask.NameToLayer("character_net"); int num7 = 1 << num5; if (num6 >= 0) { num7 |= 1 << num6; } _playerCam.cullingMask = num7; _haldorPreviewRT = new RenderTexture(num3, num4, 24, (RenderTextureFormat)0); _haldorPreviewRT.antiAliasing = 4; ((Texture)_haldorPreviewRT).filterMode = (FilterMode)2; _haldorCamGO = new GameObject("TraderUI_HaldorCam"); Object.DontDestroyOnLoad((Object)(object)_haldorCamGO); _haldorCam = _haldorCamGO.AddComponent<Camera>(); _haldorCam.targetTexture = _haldorPreviewRT; _haldorCam.clearFlags = (CameraClearFlags)2; _haldorCam.backgroundColor = new Color(0f, 0f, 0f, 0f); _haldorCam.fieldOfView = 30f; _haldorCam.nearClipPlane = 0.1f; _haldorCam.farClipPlane = 10f; _haldorCam.depth = -2f; ((Behaviour)_haldorCam).enabled = false; _haldorCam.cullingMask = num7; GameObject val = new GameObject("PlayerPreview", new Type[1] { typeof(RectTransform) }); val.transform.SetParent((Transform)(object)_rightColumn, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = Vector2.zero; component.anchorMax = Vector2.one; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; _playerPreviewImg = val.AddComponent<RawImage>(); _playerPreviewImg.texture = (Texture)(object)_playerPreviewRT; ((Graphic)_playerPreviewImg).color = Color.white; ((Graphic)_playerPreviewImg).raycastTarget = false; GameObject val2 = new GameObject("HaldorPreview", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent((Transform)(object)_rightColumn, false); RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = Vector2.zero; component2.anchorMax = Vector2.one; component2.offsetMin = Vector2.zero; component2.offsetMax = Vector2.zero; _haldorPreviewImg = val2.AddComponent<RawImage>(); _haldorPreviewImg.texture = (Texture)(object)_haldorPreviewRT; ((Graphic)_haldorPreviewImg).color = Color.white; ((Graphic)_haldorPreviewImg).raycastTarget = false; } private void ApplyPanelStyle(Image img) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)img == (Object)null)) { img.sprite = null; ((Graphic)img).color = new Color(0f, 0f, 0f, 0.75f); } } private Scrollbar CreateHiddenScrollbar(Transform parent) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0042: 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_006c: 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_008f: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be d