Decompiled source of CodexValheimInfo v0.2.0

BepInEx/plugins/CodexValheimInfo/CodexValheimInfo.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CodexValheimInfo")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CodexValheimInfo")]
[assembly: AssemblyTitle("CodexValheimInfo")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CodexValheimInfo
{
	[BepInPlugin("codex.valheim.info", "Codex Valheim Info", "0.2.0")]
	public sealed class ValheimInfoPlugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(Menu), "Start")]
		private static class MenuStartPatch
		{
			private static void Postfix(Menu __instance)
			{
				EnsureEscMenuButton(__instance);
			}
		}

		[HarmonyPatch(typeof(Menu), "Show")]
		private static class MenuShowPatch
		{
			private static void Postfix(Menu __instance)
			{
				EnsureEscMenuButton(__instance);
				RebuildNavigation(__instance);
			}
		}

		[HarmonyPatch(typeof(Menu), "UpdateNavigation")]
		private static class MenuNavigationPatch
		{
			private static void Postfix(Menu __instance)
			{
				RebuildNavigation(__instance);
			}
		}

		[HarmonyPatch(typeof(Menu), "Update")]
		private static class MenuUpdatePatch
		{
			private static void Postfix()
			{
				RefreshEscButtonLabel();
			}
		}

		private sealed class RecipeInfo
		{
			public string Key;

			public string DisplayName;

			public string InternalName;

			public int OutputAmount;

			public string StationName;

			public int MinStationLevel;

			public List<ResourceLine> Resources;

			public string SearchText;
		}

		private sealed class ResourceLine
		{
			public string DisplayName;

			public string InternalName;

			public int Amount;
		}

		private sealed class ItemInfo
		{
			public string DisplayName;

			public string PrefabName;

			public string ItemType;

			public int MaxStack;

			public float Weight;

			public string SearchText;
		}

		private sealed class CreatureInfo
		{
			public string DisplayName;

			public string PrefabName;

			public string Kind;

			public string SearchText;
		}

		private sealed class ProgressionGroup
		{
			public string Title { get; }

			public string Biome { get; }

			public string Gate { get; }

			public string WorldKey { get; }

			public string Description { get; }

			public UnlockEntry[] Entries { get; }

			public string SearchText { get; }

			public ProgressionGroup(string title, string biome, string gate, string worldKey, string description, params UnlockEntry[] entries)
			{
				Title = title;
				Biome = biome;
				Gate = gate;
				WorldKey = worldKey;
				Description = description;
				Entries = entries;
				SearchText = string.Join(" ", title, biome, gate, description, string.Join(" ", entries.Select((UnlockEntry e) => e.SearchText).ToArray()));
			}
		}

		private sealed class UnlockEntry
		{
			public string Name { get; }

			public string Where { get; }

			public string Unlocks { get; }

			public string Notes { get; }

			public string SearchText { get; }

			public UnlockEntry(string name, string where, string unlocks, string notes)
			{
				Name = name;
				Where = where;
				Unlocks = unlocks;
				Notes = notes;
				SearchText = string.Join(" ", name, where, unlocks, notes);
			}
		}

		private sealed class BossInfo
		{
			public string Name { get; }

			public string Biome { get; }

			public string Summon { get; }

			public string Drop { get; }

			public string Unlocks { get; }

			public string Notes { get; }

			public BossInfo(string name, string biome, string summon, string drop, string unlocks, string notes)
			{
				Name = name;
				Biome = biome;
				Summon = summon;
				Drop = drop;
				Unlocks = unlocks;
				Notes = notes;
			}
		}

		private sealed class CharacterInfo
		{
			public string Name { get; }

			public string Where { get; }

			public string Notes { get; }

			public CharacterInfo(string name, string where, string notes)
			{
				Name = name;
				Where = where;
				Notes = notes;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static UnityAction <0>__OpenFromEscMenu;
		}

		public const string PluginGuid = "codex.valheim.info";

		public const string PluginName = "Codex Valheim Info";

		public const string PluginVersion = "0.2.0";

		private static readonly string[] TabNames = new string[6] { "Resources", "Unlocks", "Bosses", "Characters", "Items", "About" };

		private static ValheimInfoPlugin Instance;

		private static Button InfoButton;

		private static GameObject InfoButtonObject;

		private static readonly FieldInfo ButtonOnClickField = typeof(Button).GetField("m_OnClick", BindingFlags.Instance | BindingFlags.NonPublic);

		private Harmony _harmony;

		private Rect _windowRect = new Rect(120f, 70f, 860f, 760f);

		private bool _showWindow;

		private int _selectedTab;

		private int _selectedUnlockGroup;

		private int _selectedBoss;

		private Vector2 _windowScroll;

		private Vector2 _resourceListScroll;

		private Vector2 _resourceDetailScroll;

		private Vector2 _unlockListScroll;

		private Vector2 _unlockDetailScroll;

		private Vector2 _bossListScroll;

		private Vector2 _bossDetailScroll;

		private Vector2 _characterScroll;

		private Vector2 _creatureScroll;

		private Vector2 _itemScroll;

		private string _recipeFilter = "";

		private string _recipeQuantityText = "1";

		private string _selectedRecipeKey = "";

		private string _unlockFilter = "";

		private string _characterFilter = "";

		private string _itemFilter = "";

		private string _status = "Open from the ESC menu.";

		private GUIStyle _wrapLabel;

		private GUIStyle _headerLabel;

		private GUIStyle _mutedLabel;

		private GUIStyle _windowStyle;

		private GUIStyle _buttonStyle;

		private GUIStyle _selectedButtonStyle;

		private GUIStyle _closeButtonStyle;

		private GUIStyle _textFieldStyle;

		private GUIStyle _panelStyle;

		private GUISkin _themeSkin;

		private Texture2D _windowTexture;

		private Texture2D _panelTexture;

		private Texture2D _buttonTexture;

		private Texture2D _buttonHoverTexture;

		private Texture2D _buttonActiveTexture;

		private Texture2D _selectedButtonTexture;

		private Texture2D _fieldTexture;

		private static readonly Color ParchmentText = new Color(0.93f, 0.86f, 0.68f, 1f);

		private static readonly Color MutedText = new Color(0.73f, 0.67f, 0.52f, 1f);

		private static readonly Color AmberText = new Color(1f, 0.62f, 0.22f, 1f);

		private static readonly Color DarkIron = new Color(0.045f, 0.055f, 0.045f, 0.98f);

		private static readonly Color DarkWood = new Color(0.12f, 0.09f, 0.055f, 0.96f);

		private static readonly Color ButtonWood = new Color(0.22f, 0.16f, 0.095f, 1f);

		private static readonly Color ButtonWoodHover = new Color(0.34f, 0.24f, 0.12f, 1f);

		private static readonly Color ButtonWoodActive = new Color(0.46f, 0.29f, 0.11f, 1f);

		private static readonly Color SelectedAmber = new Color(0.48f, 0.27f, 0.07f, 1f);

		private static readonly Color FieldBlack = new Color(0.035f, 0.04f, 0.035f, 1f);

		private static readonly ProgressionGroup[] ProgressionGroups = new ProgressionGroup[9]
		{
			new ProgressionGroup("Meadows start", "Meadows", "New character / no boss defeated", "", "The opening stage is about food, shelter, basic tools, leather scraps, flint, and your first workbench upgrades.", new UnlockEntry("Workbench and wood tools", "Meadows wood, stone, and basic shelter", "Hammer, workbench pieces, club, stone axe, building basics", "The workbench is the first crafting anchor and unlocks many starter pieces once covered."), new UnlockEntry("Flint and leather gear", "Meadows shorelines and boar/deer hunting", "Flint axe, flint spear, flint knife, crude bow, leather armor", "Flint is usually found near water. Deer and boar parts carry the first real weapon and armor upgrades."), new UnlockEntry("Eikthyr preparation", "Meadows deer trophies and starter gear", "Access to the first boss fight", "Bring deer trophies to Eikthyr's altar after you have food, a shield, and a decent weapon.")),
			new ProgressionGroup("After Eikthyr", "Meadows -> Black Forest", "Defeat Eikthyr in the Meadows", "defeated_eikthyr", "Eikthyr opens pickaxe progression. That moves you into copper, tin, bronze, and Black Forest dungeons.", new UnlockEntry("Hard antler", "Eikthyr boss drop", "Antler pickaxe", "The antler pickaxe lets you mine copper, tin, and other early deposits."), new UnlockEntry("Copper and tin", "Black Forest ore deposits and shorelines", "Bronze bars, forge, cauldron, bronze tools and weapons", "Copper plus tin creates bronze. The forge becomes the core crafting station for metal gear."), new UnlockEntry("Surtling cores", "Burial Chambers in the Black Forest", "Charcoal kiln, smelter, portals", "Cores are the main dungeon gate for smelting and fast travel."), new UnlockEntry("The Elder preparation", "Black Forest progression", "Access to the second boss fight", "Ancient seeds from greydwarf spawners and brutes are used to summon The Elder.")),
			new ProgressionGroup("After The Elder", "Black Forest -> Swamp", "Defeat The Elder in the Black Forest", "defeated_gdking", "The Elder grants the Swamp key. This is the big jump from bronze into iron.", new UnlockEntry("Swamp key / Crypt key", "The Elder boss drop in the Black Forest", "Sunken Crypts in the Swamp", "This is the example gate: The Elder is found in the Black Forest, and the key unlocks crypts in the Swamp."), new UnlockEntry("Scrap iron", "Sunken Crypts in the Swamp", "Iron bars, stonecutter, iron tools, iron weapons, iron armor", "Mine muddy scrap piles inside crypts and smelt scrap iron into bars."), new UnlockEntry("Turnip seeds and Swamp food", "Swamp biome", "Turnip stew and stronger food loops", "Swamp foods become important for poison-heavy fights."), new UnlockEntry("Bonemass preparation", "Swamp crypts and withered bones", "Access to the third boss fight", "Withered bones from crypts are used to summon Bonemass.")),
			new ProgressionGroup("After Bonemass", "Swamp -> Mountain", "Defeat Bonemass in the Swamp", "defeated_bonemass", "Bonemass unlocks silver finding through the wishbone and marks the Mountain jump.", new UnlockEntry("Wishbone", "Bonemass boss drop", "Hidden silver veins and buried treasure detection", "Equip the wishbone in the Mountains to pulse near buried silver."), new UnlockEntry("Silver", "Mountain biome", "Wolf armor, silver weapons, drake helmet, lox cape alternatives", "Silver gear is the main Mountain-era upgrade path."), new UnlockEntry("Dragon eggs", "Mountain nests", "Moder summoning", "Dragon eggs are heavy and used at Moder's altar."), new UnlockEntry("Moder preparation", "Mountain silver and frost-resistant gear", "Access to the fourth boss fight", "Bring frost resistance and strong ranged options for the Mountain boss.")),
			new ProgressionGroup("After Moder", "Mountain -> Plains", "Defeat Moder in the Mountains", "defeated_dragon", "Moder grants the artisan-table chain, which unlocks Plains processing machines.", new UnlockEntry("Dragon tear", "Moder boss drop", "Artisan table", "The artisan table unlocks key Plains-era processors."), new UnlockEntry("Blast furnace", "Artisan table construction", "Black metal smelting", "Black metal scraps from fulings become usable after the blast furnace."), new UnlockEntry("Windmill and spinning wheel", "Artisan table construction", "Barley flour and linen thread", "These convert Plains crops into high-tier food and gear resources."), new UnlockEntry("Yagluth preparation", "Plains fuling camps and totems", "Access to the fifth boss fight", "Fuling totems from villages are used to summon Yagluth.")),
			new ProgressionGroup("After Yagluth", "Plains -> Mistlands", "Defeat Yagluth in the Plains", "defeated_goblinking", "Yagluth opens the Mistlands visibility chain and the jump into black marble, eitr, and carapace gear.", new UnlockEntry("Torn spirit", "Yagluth boss drop", "Wisp fountain and wisps", "Wisps are used for mist-clearing utility such as the wisplight."), new UnlockEntry("Black cores", "Infested Mines in the Mistlands", "Black forge and Galdr table", "Black cores are the station gate for Mistlands crafting."), new UnlockEntry("Sap, soft tissue, and refined eitr", "Mistlands roots and skulls", "Eitr refinery, magic gear, advanced foods", "Mistlands progression adds magic and eitr-driven crafting."), new UnlockEntry("Sealbreaker", "Infested Mines fragments", "The Queen's sealed lair", "Fragments from mines assemble into the Sealbreaker used to enter The Queen's arena.")),
			new ProgressionGroup("After The Queen", "Mistlands -> Ashlands", "Defeat The Queen in the Mistlands", "defeated_queen", "The Queen's drop points you toward Ashlands progression, where flametal, siege pressure, and fortress raids take over.", new UnlockEntry("Majestic carapace", "The Queen boss drop", "Ashlands progression", "Used as the major bridge from Mistlands toward Ashlands-era crafting and access."), new UnlockEntry("Flametal", "Ashlands lava fields and deposits", "Ashlands weapons, armor, and high-tier crafting", "Ashlands resources are dangerous to harvest and usually require dedicated preparation."), new UnlockEntry("Bell fragments and siege materials", "Charred Fortresses in the Ashlands", "Fader summoning bells", "Fortress raiding supplies the pieces needed for the Ashlands boss gate."), new UnlockEntry("Fader preparation", "Ashlands fortresses and high-tier food", "Access to the seventh boss fight", "Fire protection and Ashlands-grade equipment matter heavily here.")),
			new ProgressionGroup("After Fader", "Ashlands -> Deep North", "Defeat Fader in the Ashlands", "defeated_fader", "Fader is the Ashlands boss gate and leads into the Deep North endgame added with Valheim 1.0.", new UnlockEntry("Deep North route", "Ashlands completion", "Deep North exploration and endgame resources", "The Deep North is the final biome route in Valheim 1.0-era progression."), new UnlockEntry("Deep North resources", "Deep North surface, caves, tunnels, and endgame encounters", "Late-game weapons, armor, tools, and utility", "Use the Items and Resources tabs after loading a world to inspect exact current prefabs and recipes from this install."), new UnlockEntry("Kall Fimbulbringer preparation", "Deep North progression", "Current final boss route", "The final biome introduces new keys, summon items, and cold-region hazards.")),
			new ProgressionGroup("After Kall Fimbulbringer", "Deep North / endgame", "Defeat the Deep North final boss", "defeated_kall", "This is the current full-run endgame milestone. Exact post-boss unlocks can change with hotfixes and installed mods.", new UnlockEntry("Endgame completion", "Deep North final boss", "Final progression milestone", "Use this group as a completion bucket for the current final boss and any post-game items added by updates or mods."), new UnlockEntry("Completion cleanup", "All biomes", "Remaining recipes, trophies, decorative pieces, achievements, and collection goals", "Search the Items tab for any loaded prefab or recipe name you still want to chase."))
		};

		private static readonly BossInfo[] Bosses = new BossInfo[8]
		{
			new BossInfo("Eikthyr", "Meadows", "2 Deer Trophies at Eikthyr's altar", "Hard antler", "Antler pickaxe and mining progression", "The first boss teaches stamina control and opens the route to copper and tin in the Black Forest."),
			new BossInfo("The Elder", "Black Forest", "3 Ancient Seeds at The Elder altar", "Swamp key / Crypt key", "Sunken Crypts in the Swamp", "The Elder is the second boss. Its key is the main gate into iron progression."),
			new BossInfo("Bonemass", "Swamp", "10 Withered Bones at Bonemass' altar", "Wishbone", "Silver detection in the Mountains", "Bonemass heavily rewards poison resistance and blunt damage."),
			new BossInfo("Moder", "Mountain", "3 Dragon Eggs at Moder's altar", "Dragon tear", "Artisan table, blast furnace, windmill, spinning wheel", "Moder bridges Mountain progression into Plains processing."),
			new BossInfo("Yagluth", "Plains", "5 Fuling Totems at Yagluth's altar", "Torn spirit", "Wisp fountain and Mistlands visibility tools", "Yagluth is the Plains gate into Mistlands exploration."),
			new BossInfo("The Queen", "Mistlands", "Sealbreaker at The Queen's sealed citadel", "Majestic carapace", "Ashlands progression bridge", "The Queen closes the Mistlands arc and points toward Ashlands content."),
			new BossInfo("Fader", "Ashlands", "Bells assembled from Ashlands fortress progression", "Fader trophy and Ashlands boss reward", "Deep North route", "Fader is the Ashlands boss and the gate toward the final 1.0 biome route."),
			new BossInfo("Kall Fimbulbringer", "Deep North", "Deep North final-boss summon chain", "Deep North final boss reward", "Current endgame completion", "Kall Fimbulbringer is included as the 1.0-era Deep North final boss. Runtime item/recipe tabs can show exact loaded objects after a world is loaded.")
		};

		private static readonly CharacterInfo[] Characters = new CharacterInfo[9]
		{
			new CharacterInfo("Hugin", "Early-game tutorials and world guidance", "Hugin introduces core mechanics and nudges the player through early progression."),
			new CharacterInfo("Munin", "Additional tutorials and lore guidance", "Munin appears for selected lore and mechanic hints."),
			new CharacterInfo("Haldor", "Black Forest trader", "Sells utility items and is a major exploration reward once found."),
			new CharacterInfo("Hildir", "Meadows trader camp", "Offers clothing, cosmetic items, and the Hildir questline."),
			new CharacterInfo("The Bog Witch", "Swamp trader hut", "Provides swamp-themed utility, cooking, and crafting progression depending on the current game version."),
			new CharacterInfo("Dvergr", "Mistlands", "A neutral Mistlands faction tied to extractors, soft tissue, and late-game exploration."),
			new CharacterInfo("Odin", "Rare world apparition", "A distant observer who may appear briefly and vanish when approached."),
			new CharacterInfo("Thor", "Storm sky event", "A rare sky sighting during storms."),
			new CharacterInfo("Valkyrie", "Intro and progression cinematics", "A lore figure connected to arriving in Valheim and major journey beats.")
		};

		private void Awake()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Expected O, but got Unknown
			Instance = this;
			_harmony = new Harmony("codex.valheim.info");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Codex Valheim Info 0.2.0 loaded. Open ESC and click Valheim Info.");
		}

		private void OnDestroy()
		{
			Harmony harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
			if ((Object)(object)Instance == (Object)(object)this)
			{
				Instance = null;
			}
		}

		private void Update()
		{
			if (_showWindow && ((Object)(object)Menu.instance == (Object)null || !Menu.IsVisible()))
			{
				_showWindow = false;
			}
			if (_showWindow)
			{
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
			}
			RefreshEscButtonLabel();
		}

		private void OnGUI()
		{
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			if (!_showWindow)
			{
				return;
			}
			EnsureStyles();
			GUISkin skin = GUI.skin;
			Color color = GUI.color;
			Color contentColor = GUI.contentColor;
			Color backgroundColor = GUI.backgroundColor;
			try
			{
				GUI.skin = _themeSkin;
				GUI.color = Color.white;
				GUI.contentColor = ParchmentText;
				GUI.backgroundColor = Color.white;
				GUI.depth = -20;
				_windowRect = GUILayout.Window(((Object)this).GetInstanceID(), _windowRect, new WindowFunction(DrawWindow), "VALHEIM INFO", _windowStyle, Array.Empty<GUILayoutOption>());
			}
			finally
			{
				GUI.skin = skin;
				GUI.color = color;
				GUI.contentColor = contentColor;
				GUI.backgroundColor = backgroundColor;
			}
		}

		private void DrawWindow(int id)
		{
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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)
			bool flag = false;
			try
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label("Valheim Info Helper", _headerLabel, Array.Empty<GUILayoutOption>());
				GUILayout.FlexibleSpace();
				if (GUILayout.Button("Close", _closeButtonStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Width(90f),
					GUILayout.Height(28f)
				}))
				{
					_showWindow = false;
				}
				GUILayout.EndHorizontal();
				GUILayout.Space(4f);
				DrawTabs();
				GUILayout.Space(8f);
				GUILayout.BeginVertical(_panelStyle, Array.Empty<GUILayoutOption>());
				_windowScroll = GUILayout.BeginScrollView(_windowScroll, Array.Empty<GUILayoutOption>());
				flag = true;
				DrawSelectedTab();
				GUILayout.EndScrollView();
				flag = false;
				GUILayout.EndVertical();
				GUILayout.Space(8f);
				GUILayout.Label(_status, _mutedLabel, Array.Empty<GUILayoutOption>());
			}
			catch (Exception ex)
			{
				if (flag)
				{
					GUILayout.EndScrollView();
				}
				_status = "Info menu error: " + ex.GetBaseException().Message;
				((BaseUnityPlugin)this).Logger.LogError((object)ex);
				GUILayout.Label(_status, _wrapLabel, Array.Empty<GUILayoutOption>());
			}
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f));
		}

		private void DrawTabs()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < TabNames.Length; i++)
			{
				GUIStyle val = ((_selectedTab == i) ? _selectedButtonStyle : _buttonStyle);
				if (GUILayout.Button(TabNames[i], val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
				{
					_selectedTab = i;
					_windowScroll = Vector2.zero;
				}
			}
			GUILayout.EndHorizontal();
		}

		private void DrawSelectedTab()
		{
			switch (_selectedTab)
			{
			case 0:
				DrawResourceCalculator();
				break;
			case 1:
				DrawUnlocks();
				break;
			case 2:
				DrawBosses();
				break;
			case 3:
				DrawCharacters();
				break;
			case 4:
				DrawItems();
				break;
			default:
				DrawAbout();
				break;
			}
		}

		private void DrawResourceCalculator()
		{
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Resource Calculator", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Select a loaded recipe, enter the desired output count, and this will total the base resources needed at quality 1.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) });
			_recipeFilter = GUILayout.TextField(_recipeFilter ?? "", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(180f) });
			GUILayout.Label("Need", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) });
			_recipeQuantityText = GUILayout.TextField(_recipeQuantityText ?? "1", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(82f) });
			if (GUILayout.Button("1", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(34f) }))
			{
				_recipeQuantityText = "1";
			}
			if (GUILayout.Button("10", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }))
			{
				_recipeQuantityText = "10";
			}
			if (GUILayout.Button("100", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(52f) }))
			{
				_recipeQuantityText = "100";
			}
			GUILayout.EndHorizontal();
			List<RecipeInfo> list = GetRecipeInfos();
			string filter = (_recipeFilter ?? "").Trim();
			if (!string.IsNullOrEmpty(filter))
			{
				list = list.Where((RecipeInfo recipe) => recipe.SearchText.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(_panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(360f) });
			GUILayout.Label($"Recipes: {list.Count}", _mutedLabel, Array.Empty<GUILayoutOption>());
			_resourceListScroll = GUILayout.BeginScrollView(_resourceListScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(455f) });
			if (list.Count == 0)
			{
				GUILayout.Label(((Object)(object)ObjectDB.instance == (Object)null) ? "Load into a world so Valheim can populate ObjectDB recipes." : "No matching recipes.", Array.Empty<GUILayoutOption>());
			}
			foreach (RecipeInfo item in list.Take(180))
			{
				GUIStyle val = ((_selectedRecipeKey == item.Key) ? _selectedButtonStyle : _buttonStyle);
				if (GUILayout.Button(item.DisplayName, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) }))
				{
					_selectedRecipeKey = item.Key;
					_status = "Selected recipe: " + item.DisplayName;
				}
			}
			if (list.Count > 180)
			{
				GUILayout.Label($"Showing 180 of {list.Count}. Type more of the recipe name to narrow it.", _mutedLabel, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			RecipeInfo recipeInfo = list.FirstOrDefault((RecipeInfo r) => r.Key == _selectedRecipeKey) ?? list.FirstOrDefault();
			if (recipeInfo != null)
			{
				if (string.IsNullOrEmpty(_selectedRecipeKey))
				{
					_selectedRecipeKey = recipeInfo.Key;
				}
				DrawSelectedRecipe(recipeInfo, ParsePositiveInt(_recipeQuantityText, 1));
			}
			else
			{
				GUILayout.Label("Pick a recipe to calculate its resources.", _wrapLabel, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void DrawSelectedRecipe(RecipeInfo recipe, int desiredCount)
		{
			//IL_00cd: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			int num = Math.Max(1, recipe.OutputAmount);
			int num2 = Math.Max(1, (desiredCount + num - 1) / num);
			int num3 = num2 * num;
			GUILayout.Label(recipe.DisplayName, _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Internal: " + recipe.InternalName, _mutedLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Crafting station: {recipe.StationName}   Minimum station level: {recipe.MinStationLevel}", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label($"Output per craft: {num}   Crafts needed: {num2}   Produced: {num3}", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label("Total Resources", _headerLabel, Array.Empty<GUILayoutOption>());
			_resourceDetailScroll = GUILayout.BeginScrollView(_resourceDetailScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(365f) });
			if (recipe.Resources.Count == 0)
			{
				GUILayout.Label("This recipe has no listed resource requirements in ObjectDB.", _wrapLabel, Array.Empty<GUILayoutOption>());
			}
			foreach (ResourceLine resource in recipe.Resources)
			{
				int num4 = resource.Amount * num2;
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(resource.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(210f) });
				GUILayout.Label(resource.InternalName, _mutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(180f) });
				GUILayout.FlexibleSpace();
				GUILayout.Label($"{resource.Amount} x {num2} = {num4}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}

		private void DrawUnlocks()
		{
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Unlocks / Progression", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Progression notes are grouped by main biome and boss gate. Recipe and item tabs read loaded game data; this tab explains when the major gates open.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) });
			_unlockFilter = GUILayout.TextField(_unlockFilter ?? "", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(220f) });
			GUILayout.EndHorizontal();
			List<ProgressionGroup> list = ProgressionGroups.ToList();
			string filter = (_unlockFilter ?? "").Trim();
			if (!string.IsNullOrEmpty(filter))
			{
				list = list.Where((ProgressionGroup group) => group.SearchText.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
			}
			if (_selectedUnlockGroup >= list.Count)
			{
				_selectedUnlockGroup = 0;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(_panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(315f) });
			_unlockListScroll = GUILayout.BeginScrollView(_unlockListScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(495f) });
			for (int num = 0; num < list.Count; num++)
			{
				ProgressionGroup progressionGroup = list[num];
				string worldKeyStatus = GetWorldKeyStatus(progressionGroup.WorldKey);
				string text = progressionGroup.Title;
				if (!string.IsNullOrEmpty(worldKeyStatus))
				{
					text = text + " - " + worldKeyStatus;
				}
				GUIStyle val = ((num == _selectedUnlockGroup) ? _selectedButtonStyle : _buttonStyle);
				if (GUILayout.Button(text, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }))
				{
					_selectedUnlockGroup = num;
				}
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			if (list.Count == 0)
			{
				GUILayout.Label("No progression groups match that search.", _wrapLabel, Array.Empty<GUILayoutOption>());
			}
			else
			{
				DrawProgressionGroup(list[_selectedUnlockGroup]);
			}
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void DrawProgressionGroup(ProgressionGroup group)
		{
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label(group.Title, _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Biome/area: " + group.Biome, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Gate: " + group.Gate, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label(group.Description, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			_unlockDetailScroll = GUILayout.BeginScrollView(_unlockDetailScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(420f) });
			UnlockEntry[] entries = group.Entries;
			foreach (UnlockEntry unlockEntry in entries)
			{
				GUILayout.Label(unlockEntry.Name, _headerLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Where: " + unlockEntry.Where, _wrapLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Unlocks: " + unlockEntry.Unlocks, _wrapLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Label(unlockEntry.Notes, _mutedLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Space(8f);
			}
			GUILayout.EndScrollView();
		}

		private void DrawBosses()
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Bosses", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Bosses are listed in normal progression order.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			if (_selectedBoss >= Bosses.Length)
			{
				_selectedBoss = 0;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(_panelStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(250f) });
			_bossListScroll = GUILayout.BeginScrollView(_bossListScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(500f) });
			for (int i = 0; i < Bosses.Length; i++)
			{
				BossInfo obj = Bosses[i];
				GUIStyle val = ((_selectedBoss == i) ? _selectedButtonStyle : _buttonStyle);
				if (GUILayout.Button(obj.Name, val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }))
				{
					_selectedBoss = i;
				}
			}
			GUILayout.EndScrollView();
			GUILayout.EndVertical();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			DrawBoss(Bosses[_selectedBoss]);
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void DrawBoss(BossInfo boss)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			_bossDetailScroll = GUILayout.BeginScrollView(_bossDetailScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(500f) });
			GUILayout.Label(boss.Name, _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Biome: " + boss.Biome, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Summon: " + boss.Summon, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Primary drop: " + boss.Drop, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Unlocks: " + boss.Unlocks, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label("Notes", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label(boss.Notes, _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.EndScrollView();
		}

		private void DrawCharacters()
		{
			//IL_0051: 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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: 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_01dd: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Characters / NPCs", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("This tab includes named NPCs and notable figures, plus loaded creature prefabs from the current ObjectDB/ZNetScene when available.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label("Notable Characters", _headerLabel, Array.Empty<GUILayoutOption>());
			_characterScroll = GUILayout.BeginScrollView(_characterScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(175f) });
			CharacterInfo[] characters = Characters;
			foreach (CharacterInfo characterInfo in characters)
			{
				GUILayout.Label(characterInfo.Name, _headerLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Label("Where: " + characterInfo.Where, _wrapLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Label(characterInfo.Notes, _wrapLabel, Array.Empty<GUILayoutOption>());
				GUILayout.Space(6f);
			}
			GUILayout.EndScrollView();
			GUILayout.Space(8f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Loaded creature search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
			_characterFilter = GUILayout.TextField(_characterFilter ?? "", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(200f) });
			GUILayout.EndHorizontal();
			List<CreatureInfo> list = GetCreatureInfos();
			string filter = (_characterFilter ?? "").Trim();
			if (!string.IsNullOrEmpty(filter))
			{
				list = list.Where((CreatureInfo creature) => creature.SearchText.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
			}
			GUILayout.Label($"Loaded creatures: {list.Count}", _mutedLabel, Array.Empty<GUILayoutOption>());
			_creatureScroll = GUILayout.BeginScrollView(_creatureScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(230f) });
			if (list.Count == 0)
			{
				GUILayout.Label(((Object)(object)ZNetScene.instance == (Object)null) ? "Load into a world so Valheim can populate creature prefabs." : "No matching loaded creature prefabs.", Array.Empty<GUILayoutOption>());
			}
			foreach (CreatureInfo item in list.Take(160))
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(item.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(220f) });
				GUILayout.Label(item.PrefabName, _mutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(210f) });
				GUILayout.Label(item.Kind, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
				GUILayout.EndHorizontal();
			}
			GUILayout.EndScrollView();
		}

		private void DrawItems()
		{
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Loaded Items", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("Items are read from ObjectDB, so vanilla and modded prefabs can appear here after a world is loaded.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) });
			_itemFilter = GUILayout.TextField(_itemFilter ?? "", _textFieldStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(220f) });
			GUILayout.EndHorizontal();
			List<ItemInfo> list = GetItemInfos();
			string filter = (_itemFilter ?? "").Trim();
			if (!string.IsNullOrEmpty(filter))
			{
				list = list.Where((ItemInfo item) => item.SearchText.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
			}
			GUILayout.Label($"Loaded items: {list.Count}", _mutedLabel, Array.Empty<GUILayoutOption>());
			_itemScroll = GUILayout.BeginScrollView(_itemScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(515f) });
			if (list.Count == 0)
			{
				GUILayout.Label(((Object)(object)ObjectDB.instance == (Object)null) ? "Load into a world so Valheim can populate item prefabs." : "No matching loaded item prefabs.", Array.Empty<GUILayoutOption>());
			}
			foreach (ItemInfo item in list.Take(260))
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				GUILayout.Label(item.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(230f) });
				GUILayout.Label(item.PrefabName, _mutedLabel, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(215f) });
				GUILayout.Label(item.ItemType, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(145f) });
				GUILayout.Label($"Stack {item.MaxStack}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) });
				GUILayout.Label($"Weight {item.Weight:0.##}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
				GUILayout.EndHorizontal();
			}
			if (list.Count > 260)
			{
				GUILayout.Label($"Showing 260 of {list.Count}. Type more of the item name to narrow it.", _mutedLabel, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndScrollView();
		}

		private void DrawAbout()
		{
			GUILayout.Label("About", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("This helper is added to Valheim's ESC menu by a BepInEx plugin. It does not patch Valheim's own managed DLLs.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label("Runtime Data", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("The Resources and Items tabs read ObjectDB after you load into a world. The Characters tab also reads loaded character prefabs when ZNetScene is available.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label("Progression Data", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("The Unlocks and Bosses tabs are curated progression notes for vanilla Valheim 1.0-era content, grouped so you can search an item, material, boss, or biome and see the major gate it belongs to.", _wrapLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label("Installed Plugin", _headerLabel, Array.Empty<GUILayoutOption>());
			GUILayout.Label("CodexValheimInfo.dll in the active r2modman Valheim profile.", _wrapLabel, Array.Empty<GUILayoutOption>());
		}

		private void EnsureStyles()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Expected O, but got Unknown
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Expected O, but got Unknown
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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)
			//IL_01fe: 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_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0251: 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)
			//IL_0269: 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: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Expected O, but got Unknown
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0299: Expected O, but got Unknown
			//IL_029e: Expected O, but got Unknown
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e2: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f1: Expected O, but got Unknown
			//IL_02f6: Expected O, but got Unknown
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_0306: Unknown result type (might be due to invalid IL or missing references)
			//IL_0317: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: 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_0359: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0380: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d7: Expected O, but got Unknown
			//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Expected O, but got Unknown
			//IL_03eb: Expected O, but got Unknown
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: 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_040e: 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_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_045a: Unknown result type (might be due to invalid IL or missing references)
			//IL_046b: 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_0480: Expected O, but got Unknown
			//IL_0487: Unknown result type (might be due to invalid IL or missing references)
			//IL_048c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049d: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04be: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04df: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Expected O, but got Unknown
			//IL_04ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0504: Unknown result type (might be due to invalid IL or missing references)
			//IL_0515: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0525: Unknown result type (might be due to invalid IL or missing references)
			//IL_0536: Unknown result type (might be due to invalid IL or missing references)
			//IL_053c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0546: Unknown result type (might be due to invalid IL or missing references)
			//IL_0557: Unknown result type (might be due to invalid IL or missing references)
			//IL_055d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0567: Unknown result type (might be due to invalid IL or missing references)
			//IL_0578: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0588: Unknown result type (might be due to invalid IL or missing references)
			//IL_0590: Unknown result type (might be due to invalid IL or missing references)
			//IL_0595: Unknown result type (might be due to invalid IL or missing references)
			//IL_059f: Expected O, but got Unknown
			//IL_059f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ae: Expected O, but got Unknown
			//IL_05b3: Expected O, but got Unknown
			if (_wrapLabel == null)
			{
				_windowTexture = CreateTexture(DarkIron);
				_panelTexture = CreateTexture(DarkWood);
				_buttonTexture = CreateTexture(ButtonWood);
				_buttonHoverTexture = CreateTexture(ButtonWoodHover);
				_buttonActiveTexture = CreateTexture(ButtonWoodActive);
				_selectedButtonTexture = CreateTexture(SelectedAmber);
				_fieldTexture = CreateTexture(FieldBlack);
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					wordWrap = true,
					fontSize = 14
				};
				val.normal.textColor = ParchmentText;
				val.hover.textColor = ParchmentText;
				val.active.textColor = ParchmentText;
				val.focused.textColor = ParchmentText;
				_wrapLabel = val;
				GUIStyle val2 = new GUIStyle(GUI.skin.label)
				{
					fontStyle = (FontStyle)1,
					wordWrap = true,
					fontSize = 15
				};
				val2.normal.textColor = AmberText;
				val2.hover.textColor = AmberText;
				val2.active.textColor = AmberText;
				val2.focused.textColor = AmberText;
				_headerLabel = val2;
				GUIStyle val3 = new GUIStyle(GUI.skin.label)
				{
					wordWrap = true,
					fontSize = 13
				};
				val3.normal.textColor = MutedText;
				val3.hover.textColor = MutedText;
				val3.active.textColor = MutedText;
				val3.focused.textColor = MutedText;
				_mutedLabel = val3;
				GUIStyle val4 = new GUIStyle(GUI.skin.window);
				val4.normal.background = _windowTexture;
				val4.normal.textColor = AmberText;
				val4.onNormal.background = _windowTexture;
				val4.onNormal.textColor = AmberText;
				val4.hover.background = _windowTexture;
				val4.hover.textColor = AmberText;
				val4.focused.background = _windowTexture;
				val4.focused.textColor = AmberText;
				val4.active.background = _windowTexture;
				val4.active.textColor = AmberText;
				val4.fontSize = 14;
				val4.fontStyle = (FontStyle)1;
				val4.alignment = (TextAnchor)1;
				val4.padding = new RectOffset(12, 12, 28, 12);
				val4.margin = new RectOffset(6, 6, 6, 6);
				_windowStyle = val4;
				GUIStyle val5 = new GUIStyle(GUI.skin.box);
				val5.normal.background = _panelTexture;
				val5.normal.textColor = ParchmentText;
				val5.padding = new RectOffset(10, 10, 10, 10);
				val5.margin = new RectOffset(2, 2, 2, 2);
				_panelStyle = val5;
				GUIStyle val6 = new GUIStyle(GUI.skin.button);
				val6.normal.background = _buttonTexture;
				val6.normal.textColor = ParchmentText;
				val6.hover.background = _buttonHoverTexture;
				val6.hover.textColor = Color.white;
				val6.active.background = _buttonActiveTexture;
				val6.active.textColor = Color.white;
				val6.focused.background = _buttonHoverTexture;
				val6.focused.textColor = Color.white;
				val6.onNormal.background = _selectedButtonTexture;
				val6.onNormal.textColor = Color.white;
				val6.alignment = (TextAnchor)4;
				val6.fontSize = 13;
				val6.fontStyle = (FontStyle)1;
				val6.wordWrap = false;
				val6.padding = new RectOffset(8, 8, 5, 5);
				val6.margin = new RectOffset(2, 2, 2, 2);
				_buttonStyle = val6;
				GUIStyle val7 = new GUIStyle(_buttonStyle);
				val7.normal.background = _selectedButtonTexture;
				val7.normal.textColor = Color.white;
				val7.hover.background = _buttonActiveTexture;
				val7.hover.textColor = Color.white;
				val7.active.background = _buttonActiveTexture;
				val7.active.textColor = Color.white;
				val7.focused.background = _buttonActiveTexture;
				val7.focused.textColor = Color.white;
				_selectedButtonStyle = val7;
				GUIStyle val8 = new GUIStyle(_buttonStyle);
				val8.normal.background = _buttonTexture;
				val8.normal.textColor = ParchmentText;
				val8.hover.background = _buttonHoverTexture;
				val8.hover.textColor = Color.white;
				val8.active.background = _buttonActiveTexture;
				val8.active.textColor = Color.white;
				_closeButtonStyle = val8;
				GUIStyle val9 = new GUIStyle(GUI.skin.textField);
				val9.normal.background = _fieldTexture;
				val9.normal.textColor = ParchmentText;
				val9.hover.background = _fieldTexture;
				val9.hover.textColor = Color.white;
				val9.focused.background = _fieldTexture;
				val9.focused.textColor = Color.white;
				val9.active.background = _fieldTexture;
				val9.active.textColor = Color.white;
				val9.fontSize = 14;
				val9.padding = new RectOffset(8, 8, 5, 5);
				val9.margin = new RectOffset(3, 3, 3, 3);
				_textFieldStyle = val9;
				_themeSkin = Object.Instantiate<GUISkin>(GUI.skin);
				_themeSkin.label = _wrapLabel;
				_themeSkin.button = _buttonStyle;
				_themeSkin.textField = _textFieldStyle;
				_themeSkin.window = _windowStyle;
				_themeSkin.box = _panelStyle;
			}
		}

		private static Texture2D CreateTexture(Color color)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected O, but got Unknown
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61
			};
			val.SetPixel(0, 0, color);
			val.Apply();
			return val;
		}

		private static void OpenFromEscMenu()
		{
			if (!((Object)(object)Instance == (Object)null))
			{
				Instance._showWindow = true;
				Instance._selectedTab = 0;
				Instance._status = "Opened from the ESC menu.";
			}
		}

		private static void EnsureEscMenuButton(Menu menu)
		{
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Expected O, but got Unknown
			if ((Object)(object)menu == (Object)null || (Object)(object)Instance == (Object)null)
			{
				return;
			}
			if ((Object)(object)InfoButton != (Object)null && (Object)(object)InfoButtonObject != (Object)null)
			{
				RefreshEscButtonLabel();
				return;
			}
			Button val = (((Object)(object)menu.m_settingsButton != (Object)null) ? menu.m_settingsButton : (((Object)(object)menu.m_logoutButton != (Object)null) ? menu.m_logoutButton : menu.m_continueButton));
			if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).transform == (Object)null) && !((Object)(object)((Component)val).transform.parent == (Object)null))
			{
				InfoButtonObject = Object.Instantiate<GameObject>(((Component)val).gameObject, ((Component)val).transform.parent);
				((Object)InfoButtonObject).name = "CodexValheimInfoButton";
				InfoButton = InfoButtonObject.GetComponent<Button>();
				if ((Object)(object)InfoButton == (Object)null)
				{
					InfoButton = InfoButtonObject.AddComponent<Button>();
				}
				ReplaceButtonClickEvent(InfoButton);
				ButtonClickedEvent onClick = InfoButton.onClick;
				object obj = <>O.<0>__OpenFromEscMenu;
				if (obj == null)
				{
					UnityAction val2 = OpenFromEscMenu;
					<>O.<0>__OpenFromEscMenu = val2;
					obj = (object)val2;
				}
				((UnityEvent)onClick).AddListener((UnityAction)obj);
				((Selectable)InfoButton).interactable = true;
				RefreshEscButtonLabel();
				if ((Object)(object)menu.m_settingsButton != (Object)null)
				{
					InfoButtonObject.transform.SetSiblingIndex(((Component)menu.m_settingsButton).transform.GetSiblingIndex());
				}
				InfoButtonObject.SetActive(((Component)val).gameObject.activeSelf);
				if ((Object)(object)menu.menuEntriesParent != (Object)null)
				{
					LayoutRebuilder.ForceRebuildLayoutImmediate(menu.menuEntriesParent);
				}
			}
		}

		private static void ReplaceButtonClickEvent(Button button)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			if (!((Object)(object)button == (Object)null))
			{
				ButtonClickedEvent value = new ButtonClickedEvent();
				if (ButtonOnClickField != null)
				{
					ButtonOnClickField.SetValue(button, value);
				}
				else
				{
					((UnityEventBase)button.onClick).RemoveAllListeners();
				}
			}
		}

		private static void RefreshEscButtonLabel()
		{
			if (!((Object)(object)InfoButtonObject == (Object)null))
			{
				TMP_Text componentInChildren = InfoButtonObject.GetComponentInChildren<TMP_Text>(true);
				if ((Object)(object)componentInChildren != (Object)null)
				{
					componentInChildren.text = "Valheim Info";
				}
				Text componentInChildren2 = InfoButtonObject.GetComponentInChildren<Text>(true);
				if ((Object)(object)componentInChildren2 != (Object)null)
				{
					componentInChildren2.text = "Valheim Info";
				}
			}
		}

		private static void RebuildNavigation(Menu menu)
		{
			//IL_00c8: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)menu == (Object)null)
			{
				return;
			}
			EnsureEscMenuButton(menu);
			List<Button> list = new List<Button>();
			AddNavigationButton(list, menu.m_continueButton, allowNonInteractable: true);
			AddNavigationButton(list, menu.m_skipButton, allowNonInteractable: true);
			AddNavigationButton(list, menu.m_saveButton, allowNonInteractable: false);
			AddNavigationButton(list, menu.m_playerListButton, allowNonInteractable: true);
			AddNavigationButton(list, menu.m_inviteButton, allowNonInteractable: true);
			AddNavigationButton(list, InfoButton, allowNonInteractable: true);
			AddNavigationButton(list, menu.m_settingsButton, allowNonInteractable: true);
			AddNavigationButton(list, menu.m_logoutButton, allowNonInteractable: true);
			AddNavigationButton(list, menu.m_quitButton, allowNonInteractable: true);
			if (list.Count != 0)
			{
				for (int i = 0; i < list.Count; i++)
				{
					Button obj = list[i];
					Button selectOnUp = list[(i - 1 + list.Count) % list.Count];
					Button selectOnDown = list[(i + 1) % list.Count];
					Navigation navigation = ((Selectable)obj).navigation;
					((Navigation)(ref navigation)).mode = (Mode)4;
					((Navigation)(ref navigation)).selectOnUp = (Selectable)(object)selectOnUp;
					((Navigation)(ref navigation)).selectOnDown = (Selectable)(object)selectOnDown;
					((Selectable)obj).navigation = navigation;
				}
			}
		}

		private static void AddNavigationButton(List<Button> buttons, Button button, bool allowNonInteractable)
		{
			if (!((Object)(object)button == (Object)null) && !((Object)(object)((Component)button).gameObject == (Object)null) && ((Component)button).gameObject.activeSelf && (allowNonInteractable || ((Selectable)button).interactable))
			{
				buttons.Add(button);
			}
		}

		private List<RecipeInfo> GetRecipeInfos()
		{
			ObjectDB instance = ObjectDB.instance;
			if ((Object)(object)instance == (Object)null || instance.m_recipes == null)
			{
				return new List<RecipeInfo>();
			}
			List<RecipeInfo> list = new List<RecipeInfo>();
			foreach (Recipe recipe in instance.m_recipes)
			{
				if ((Object)(object)recipe == (Object)null || !recipe.m_enabled || (Object)(object)recipe.m_item == (Object)null || recipe.m_item.m_itemData == null || recipe.m_item.m_itemData.m_shared == null)
				{
					continue;
				}
				string displayName = DisplayName(recipe.m_item.m_itemData.m_shared.m_name);
				string name = ((Object)recipe.m_item).name;
				RecipeInfo recipeInfo = new RecipeInfo
				{
					Key = name + "|" + recipe.m_minStationLevel.ToString(CultureInfo.InvariantCulture),
					DisplayName = displayName,
					InternalName = name,
					OutputAmount = Math.Max(1, recipe.m_amount),
					StationName = (((Object)(object)recipe.m_craftingStation != (Object)null) ? DisplayName(recipe.m_craftingStation.m_name) : "None / hand craft"),
					MinStationLevel = Math.Max(1, recipe.m_minStationLevel),
					Resources = new List<ResourceLine>()
				};
				if (recipe.m_resources != null)
				{
					Requirement[] resources = recipe.m_resources;
					foreach (Requirement val in resources)
					{
						if (val != null && !((Object)(object)val.m_resItem == (Object)null) && val.m_resItem.m_itemData != null && val.m_resItem.m_itemData.m_shared != null)
						{
							int num = Math.Max(0, val.GetAmount(1));
							if (num > 0)
							{
								recipeInfo.Resources.Add(new ResourceLine
								{
									DisplayName = DisplayName(val.m_resItem.m_itemData.m_shared.m_name),
									InternalName = ((Object)val.m_resItem).name,
									Amount = num
								});
							}
						}
					}
				}
				recipeInfo.SearchText = string.Join(" ", recipeInfo.DisplayName, recipeInfo.InternalName, recipeInfo.StationName, string.Join(" ", recipeInfo.Resources.Select((ResourceLine r) => r.DisplayName + " " + r.InternalName).ToArray()));
				list.Add(recipeInfo);
			}
			return list.OrderBy<RecipeInfo, string>((RecipeInfo recipe) => recipe.DisplayName, StringComparer.OrdinalIgnoreCase).ThenBy<RecipeInfo, string>((RecipeInfo recipe) => recipe.InternalName, StringComparer.OrdinalIgnoreCase).ToList();
		}

		private List<ItemInfo> GetItemInfos()
		{
			ObjectDB instance = ObjectDB.instance;
			if ((Object)(object)instance == (Object)null || instance.m_items == null)
			{
				return new List<ItemInfo>();
			}
			List<ItemInfo> list = new List<ItemInfo>();
			foreach (GameObject item in instance.m_items)
			{
				if (!((Object)(object)item == (Object)null))
				{
					ItemDrop component = item.GetComponent<ItemDrop>();
					if (!((Object)(object)component == (Object)null) && component.m_itemData != null && component.m_itemData.m_shared != null)
					{
						SharedData shared = component.m_itemData.m_shared;
						ItemInfo itemInfo = new ItemInfo
						{
							DisplayName = DisplayName(shared.m_name),
							PrefabName = ((Object)item).name,
							ItemType = ((object)Unsafe.As<ItemType, ItemType>(ref shared.m_itemType)/*cast due to .constrained prefix*/).ToString(),
							MaxStack = Math.Max(1, shared.m_maxStackSize),
							Weight = shared.m_weight
						};
						itemInfo.SearchText = string.Join(" ", itemInfo.DisplayName, itemInfo.PrefabName, itemInfo.ItemType);
						list.Add(itemInfo);
					}
				}
			}
			return list.OrderBy<ItemInfo, string>((ItemInfo item) => item.DisplayName, StringComparer.OrdinalIgnoreCase).ThenBy<ItemInfo, string>((ItemInfo item) => item.PrefabName, StringComparer.OrdinalIgnoreCase).ToList();
		}

		private List<CreatureInfo> GetCreatureInfos()
		{
			ZNetScene instance = ZNetScene.instance;
			if ((Object)(object)instance == (Object)null || instance.m_prefabs == null)
			{
				return new List<CreatureInfo>();
			}
			List<CreatureInfo> list = new List<CreatureInfo>();
			foreach (GameObject prefab in instance.m_prefabs)
			{
				if (!((Object)(object)prefab == (Object)null))
				{
					Character component = prefab.GetComponent<Character>();
					if (!((Object)(object)component == (Object)null))
					{
						CreatureInfo creatureInfo = new CreatureInfo
						{
							DisplayName = DisplayName(component.m_name),
							PrefabName = ((Object)prefab).name,
							Kind = (component.m_boss ? "Boss" : "Creature")
						};
						creatureInfo.SearchText = string.Join(" ", creatureInfo.DisplayName, creatureInfo.PrefabName, creatureInfo.Kind);
						list.Add(creatureInfo);
					}
				}
			}
			return list.OrderByDescending((CreatureInfo creature) => creature.Kind == "Boss").ThenBy<CreatureInfo, string>((CreatureInfo creature) => creature.DisplayName, StringComparer.OrdinalIgnoreCase).ThenBy<CreatureInfo, string>((CreatureInfo creature) => creature.PrefabName, StringComparer.OrdinalIgnoreCase)
				.ToList();
		}

		private static string GetWorldKeyStatus(string worldKey)
		{
			if (string.IsNullOrEmpty(worldKey) || (Object)(object)ZoneSystem.instance == (Object)null)
			{
				return "";
			}
			try
			{
				return ZoneSystem.instance.GetGlobalKey(worldKey) ? "done" : "not done";
			}
			catch
			{
				return "";
			}
		}

		private static int ParsePositiveInt(string text, int fallback)
		{
			if (!int.TryParse((text ?? "").Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result))
			{
				return fallback;
			}
			if (result < 1)
			{
				return 1;
			}
			if (result > 99999)
			{
				return 99999;
			}
			return result;
		}

		private static string DisplayName(string token)
		{
			if (string.IsNullOrWhiteSpace(token))
			{
				return "Unknown";
			}
			try
			{
				if (token.StartsWith("$", StringComparison.Ordinal) && Localization.instance != null)
				{
					string text = Localization.instance.Localize(token);
					if (!string.IsNullOrWhiteSpace(text) && !string.Equals(text, token, StringComparison.Ordinal))
					{
						return text.Trim();
					}
				}
			}
			catch
			{
			}
			string text2 = token.Trim().TrimStart(new char[1] { '$' });
			string[] array = new string[7] { "item_", "piece_", "enemy_", "npc_", "se_", "material_", "location_" };
			foreach (string text3 in array)
			{
				if (text2.StartsWith(text3, StringComparison.OrdinalIgnoreCase))
				{
					text2 = text2.Substring(text3.Length);
					break;
				}
			}
			text2 = text2.Replace('_', ' ').Trim();
			if (text2.Length == 0)
			{
				return token;
			}
			return CultureInfo.CurrentCulture.TextInfo.ToTitleCase(text2);
		}
	}
}