Decompiled source of ModTree v1.2.1

ModTree.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
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 System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ModTree")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ModTree")]
[assembly: AssemblyTitle("ModTree")]
[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 ModTree
{
	internal enum Branch
	{
		Weapons,
		Magic,
		Armor,
		Capes,
		Trinkets,
		Food,
		Potions
	}
	internal sealed class Entry
	{
		public GameObject Prefab;

		public ItemData Item;

		public Branch Branch;

		public string StationKey;

		public int StationLevel;

		public int Amount = 1;

		public List<KeyValuePair<ItemData, int>> Ingredients = new List<KeyValuePair<ItemData, int>>();

		public string Note;

		public float Score;

		public int Tier;

		public string SetName;

		public string Name => Localization.instance.Localize(Item.m_shared.m_name);

		public bool Discovered(Player p)
		{
			if ((Object)(object)p == (Object)null)
			{
				return false;
			}
			if (StationKey == "?")
			{
				return p.IsMaterialKnown(Item.m_shared.m_name);
			}
			foreach (KeyValuePair<ItemData, int> ingredient in Ingredients)
			{
				if (!p.IsMaterialKnown(ingredient.Key.m_shared.m_name))
				{
					return false;
				}
			}
			return true;
		}
	}
	internal sealed class Station
	{
		public string Key;

		public string Name;

		public Sprite Icon;

		public readonly Dictionary<Branch, List<Entry>> Entries = new Dictionary<Branch, List<Entry>>();

		public int Tier;

		public Piece Piece;
	}
	internal static class Catalog
	{
		internal const string HandKey = "";

		internal const string OtherKey = "?";

		internal static readonly Dictionary<string, Station> Stations = new Dictionary<string, Station>();

		private static readonly Dictionary<string, int> TierCache = new Dictionary<string, int>();

		private static readonly Dictionary<string, List<Recipe>> RecipesByItem = new Dictionary<string, List<Recipe>>();

		private static int _builtFor = -1;

		private static readonly Dictionary<string, int> KnownTiers = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
		{
			{ "Wood", 0 },
			{ "Stone", 0 },
			{ "Resin", 0 },
			{ "Flint", 0 },
			{ "LeatherScraps", 0 },
			{ "DeerHide", 0 },
			{ "Feathers", 0 },
			{ "RawMeat", 0 },
			{ "NeckTail", 0 },
			{ "Raspberry", 0 },
			{ "Mushroom", 0 },
			{ "Honey", 0 },
			{ "Dandelion", 0 },
			{ "BoneFragments", 0 },
			{ "HardAntler", 0 },
			{ "TrophyEikthyr", 0 },
			{ "Copper", 1 },
			{ "CopperOre", 1 },
			{ "Tin", 1 },
			{ "TinOre", 1 },
			{ "Bronze", 1 },
			{ "Coal", 1 },
			{ "TrollHide", 1 },
			{ "SurtlingCore", 1 },
			{ "FineWood", 1 },
			{ "RoundLog", 1 },
			{ "GreydwarfEye", 1 },
			{ "Blueberries", 1 },
			{ "Carrot", 1 },
			{ "Thistle", 1 },
			{ "AncientSeed", 1 },
			{ "CryptKey", 1 },
			{ "Iron", 2 },
			{ "IronScrap", 2 },
			{ "IronOre", 2 },
			{ "Chain", 2 },
			{ "ElderBark", 2 },
			{ "Guck", 2 },
			{ "Bloodbag", 2 },
			{ "Entrails", 2 },
			{ "Ooze", 2 },
			{ "WitheredBone", 2 },
			{ "Root", 2 },
			{ "Turnip", 2 },
			{ "Wishbone", 2 },
			{ "SerpentScale", 2 },
			{ "SerpentMeat", 2 },
			{ "Silver", 3 },
			{ "SilverOre", 3 },
			{ "WolfPelt", 3 },
			{ "WolfFang", 3 },
			{ "WolfClaw", 3 },
			{ "Obsidian", 3 },
			{ "FreezeGland", 3 },
			{ "Crystal", 3 },
			{ "DragonTear", 3 },
			{ "Onion", 3 },
			{ "JuteRed", 3 },
			{ "DragonEgg", 3 },
			{ "BlackMetal", 4 },
			{ "BlackMetalScrap", 4 },
			{ "Needle", 4 },
			{ "LoxPelt", 4 },
			{ "LoxMeat", 4 },
			{ "Barley", 4 },
			{ "BarleyFlour", 4 },
			{ "Flax", 4 },
			{ "LinenThread", 4 },
			{ "Tar", 4 },
			{ "GoblinTotem", 4 },
			{ "Cloudberry", 4 },
			{ "YmirRemains", 4 },
			{ "Carapace", 5 },
			{ "Eitr", 5 },
			{ "BlackCore", 5 },
			{ "Sap", 5 },
			{ "MushroomJotunPuffs", 5 },
			{ "MushroomMagecap", 5 },
			{ "YggdrasilWood", 5 },
			{ "ScaleHide", 5 },
			{ "Mandible", 5 },
			{ "RoyalJelly", 5 },
			{ "Softtissue", 5 },
			{ "Wisp", 5 },
			{ "BlackMarble", 5 },
			{ "JuteBlue", 5 },
			{ "DvergrNeedle", 5 },
			{ "BugMeat", 5 },
			{ "HareMeat", 5 },
			{ "GiantBloodSack", 5 },
			{ "Bilebag", 6 },
			{ "Flametal", 6 },
			{ "FlametalNew", 6 },
			{ "FlametalOre", 6 },
			{ "FlametalOreNew", 6 },
			{ "Blackwood", 6 },
			{ "AskHide", 6 },
			{ "AskBladder", 6 },
			{ "MoltenCore", 6 },
			{ "CelestialFeather", 6 },
			{ "Grausten", 6 },
			{ "ProustitePowder", 6 },
			{ "MorgenSinew", 6 },
			{ "MorgenHeart", 6 },
			{ "CharredBone", 6 },
			{ "CharredCogwheel", 6 },
			{ "SulfurStone", 6 },
			{ "GemstoneBlue", 6 },
			{ "GemstoneGreen", 6 },
			{ "GemstoneRed", 6 },
			{ "Vineberry", 6 },
			{ "Fiddleheadfern", 6 },
			{ "MushroomSmokePuff", 6 }
		};

		private static readonly (string part, int tier)[] NameHints = new(string, int)[21]
		{
			("flametal", 6),
			("ashland", 6),
			("charred", 6),
			("eitr", 5),
			("carapace", 5),
			("mistland", 5),
			("dvergr", 5),
			("blackmetal", 4),
			("padded", 4),
			("lox", 4),
			("silver", 3),
			("wolf", 3),
			("frost", 3),
			("iron", 2),
			("swamp", 2),
			("bronze", 1),
			("copper", 1),
			("troll", 1),
			("tin", 1),
			("flint", 0),
			("leather", 0)
		};

		private static readonly string[] AlchemyWords = new string[7] { "bomb", "syringe", "potion", "elixir", "flask", "vial", "hellbroth" };

		internal static string BranchName(Branch b)
		{
			return b switch
			{
				Branch.Weapons => "Weapons", 
				Branch.Magic => "Magic", 
				Branch.Armor => "Armor", 
				Branch.Capes => "Capes", 
				Branch.Trinkets => "Trinkets", 
				Branch.Food => "Food", 
				_ => "Potions", 
			};
		}

		internal static void EnsureBuilt()
		{
			ObjectDB instance = ObjectDB.instance;
			if (!((Object)(object)instance == (Object)null))
			{
				int num = instance.m_recipes.Count * 100003 + instance.m_items.Count;
				if (num != _builtFor || Stations.Count <= 0)
				{
					_builtFor = num;
					Build(instance);
				}
			}
		}

		private static void Build(ObjectDB db)
		{
			Stopwatch stopwatch = Stopwatch.StartNew();
			Stations.Clear();
			TierCache.Clear();
			RecipesByItem.Clear();
			foreach (Recipe recipe in db.m_recipes)
			{
				if (Craftable(recipe))
				{
					string name = ((Object)((Component)recipe.m_item).gameObject).name;
					if (!RecipesByItem.TryGetValue(name, out var value))
					{
						value = (RecipesByItem[name] = new List<Recipe>());
					}
					value.Add(recipe);
				}
			}
			HashSet<string> hashSet = new HashSet<string>();
			HashSet<string> hashSet2 = new HashSet<string>();
			List<Entry> list2 = new List<Entry>();
			foreach (Recipe recipe2 in db.m_recipes)
			{
				if (!Craftable(recipe2))
				{
					continue;
				}
				ItemData itemData = recipe2.m_item.m_itemData;
				Branch? branch = Classify(itemData.m_shared, ((Object)((Component)recipe2.m_item).gameObject).name, null);
				if (!branch.HasValue)
				{
					continue;
				}
				Entry entry = new Entry
				{
					Prefab = ((Component)recipe2.m_item).gameObject,
					Item = itemData,
					Branch = branch.Value,
					StationKey = (((Object)(object)recipe2.m_craftingStation != (Object)null) ? recipe2.m_craftingStation.m_name : ""),
					StationLevel = recipe2.m_minStationLevel,
					Amount = recipe2.m_amount
				};
				Requirement[] resources = recipe2.m_resources;
				foreach (Requirement val in resources)
				{
					if ((Object)(object)val?.m_resItem != (Object)null && val.m_amount > 0 && !val.m_upgraderResource)
					{
						entry.Ingredients.Add(new KeyValuePair<ItemData, int>(val.m_resItem.m_itemData, val.m_amount));
					}
				}
				EnsureStation(entry.StationKey, recipe2.m_craftingStation);
				list2.Add(entry);
				hashSet2.Add(((Object)((Component)recipe2.m_item).gameObject).name);
			}
			ZNetScene instance = ZNetScene.instance;
			if ((Object)(object)instance != (Object)null)
			{
				foreach (GameObject prefab in instance.m_prefabs)
				{
					if ((Object)(object)prefab == (Object)null)
					{
						continue;
					}
					Piece component = prefab.GetComponent<Piece>();
					Fermenter component2 = prefab.GetComponent<Fermenter>();
					if ((Object)(object)component2 != (Object)null)
					{
						foreach (ItemConversion item in component2.m_conversion)
						{
							if (!((Object)(object)item?.m_from == (Object)null) && !((Object)(object)item.m_to == (Object)null))
							{
								hashSet.Add(((Object)((Component)item.m_from).gameObject).name);
								AddConversion(list2, hashSet2, prefab, component, item.m_from, item.m_to, item.m_producedItems, "fermentation");
							}
						}
					}
					CookingStation component3 = prefab.GetComponent<CookingStation>();
					if (!((Object)(object)component3 != (Object)null))
					{
						continue;
					}
					foreach (ItemConversion item2 in component3.m_conversion)
					{
						if ((Object)(object)item2?.m_from != (Object)null && (Object)(object)item2.m_to != (Object)null)
						{
							AddConversion(list2, hashSet2, prefab, component, item2.m_from, item2.m_to, 1, "cooking");
						}
					}
				}
			}
			foreach (Entry item3 in list2)
			{
				if (item3.Branch != Branch.Potions && hashSet.Contains(((Object)item3.Prefab).name))
				{
					item3.Branch = Branch.Potions;
				}
			}
			EnsureStation("?", null);
			HashSet<string> hashSet3 = new HashSet<string>(list2.Select((Entry e) => e.Item.m_shared.m_name));
			foreach (GameObject item4 in db.m_items)
			{
				ItemDrop val2 = (((Object)(object)item4 == (Object)null) ? null : item4.GetComponent<ItemDrop>());
				if ((Object)(object)val2 == (Object)null || hashSet2.Contains(((Object)item4).name))
				{
					continue;
				}
				SharedData shared = val2.m_itemData.m_shared;
				if (LooksObtainable(shared) && hashSet3.Add(shared.m_name))
				{
					Branch? branch2 = Classify(shared, ((Object)item4).name, hashSet);
					if (branch2.HasValue)
					{
						list2.Add(new Entry
						{
							Prefab = item4,
							Item = val2.m_itemData,
							Branch = branch2.Value,
							StationKey = "?",
							Note = "no recipe"
						});
					}
				}
			}
			MoveWeaponsOffMagicStations(list2);
			Dictionary<string, Station> dictionary = new Dictionary<string, Station>(StringComparer.OrdinalIgnoreCase);
			foreach (Station item5 in Stations.Values.ToList())
			{
				if (!dictionary.ContainsKey(item5.Name))
				{
					dictionary[item5.Name] = item5;
				}
			}
			foreach (Entry item6 in list2)
			{
				item6.Tier = ItemTier(((Object)item6.Prefab).name, 0);
				item6.Score = Score(item6);
				item6.SetName = item6.Item.m_shared.m_setName ?? "";
				Station station = dictionary[Stations[item6.StationKey].Name];
				if (!station.Entries.TryGetValue(item6.Branch, out var value2))
				{
					value2 = (station.Entries[item6.Branch] = new List<Entry>());
				}
				value2.Add(item6);
			}
			foreach (Station value3 in Stations.Values)
			{
				foreach (KeyValuePair<Branch, List<Entry>> item7 in value3.Entries.ToList())
				{
					value3.Entries[item7.Key] = Sort(item7.Value);
				}
				value3.Tier = StationTier(value3);
			}
			Plugin.Log.LogInfo((object)$"Drzewko: {Stations.Count} stacji, {list2.Count} pozycji ({stopwatch.ElapsedMilliseconds} ms).");
		}

		private static bool Craftable(Recipe r)
		{
			if ((Object)(object)r == (Object)null || (Object)(object)r.m_item == (Object)null || !r.m_enabled || r.m_noCraftOnlyUpgrade)
			{
				return false;
			}
			if (!((Object)(object)r.m_craftingStation == (Object)null))
			{
				return !r.m_craftingStation.m_upgrader;
			}
			return true;
		}

		private static void MoveWeaponsOffMagicStations(List<Entry> all)
		{
			foreach (IGrouping<string, Entry> item in from e in all
				where e.StationKey != "?" && e.StationKey != ""
				group e by Localization.instance.Localize(e.StationKey))
			{
				List<Entry> list = item.Where((Entry e) => e.Branch == Branch.Weapons).ToList();
				if (list.Count == 0)
				{
					continue;
				}
				int num = item.Count((Entry e) => e.Branch == Branch.Potions);
				int num2 = item.Count((Entry e) => e.Branch == Branch.Magic);
				int num3 = item.Count((Entry e) => e.Branch == Branch.Food);
				bool flag = item.All((Entry e) => e.Branch == Branch.Weapons) && list.All((Entry e) => AlchemyWords.Any((string w) => (((Object)e.Prefab).name + " " + e.Name).ToLowerInvariant().Contains(w)));
				if (num + num2 + num3 <= list.Count && !flag)
				{
					continue;
				}
				Branch branch = ((num2 > num) ? Branch.Magic : Branch.Potions);
				foreach (Entry item2 in list)
				{
					item2.Branch = branch;
				}
			}
		}

		private static void AddConversion(List<Entry> all, HashSet<string> produced, GameObject stationGo, Piece piece, ItemDrop from, ItemDrop to, int amount, string note)
		{
			Branch? branch = Classify(to.m_itemData.m_shared, ((Object)((Component)to).gameObject).name, null);
			if (branch.HasValue)
			{
				string text = (((Object)(object)piece != (Object)null) ? piece.m_name : ((Object)stationGo).name);
				if (!Stations.ContainsKey(text))
				{
					Stations[text] = new Station
					{
						Key = text,
						Name = Localization.instance.Localize(text),
						Icon = (((Object)(object)piece != (Object)null) ? piece.m_icon : null),
						Piece = piece
					};
				}
				Entry entry = new Entry
				{
					Prefab = ((Component)to).gameObject,
					Item = to.m_itemData,
					Branch = branch.Value,
					StationKey = text,
					Amount = Math.Max(1, amount),
					Note = note
				};
				entry.Ingredients.Add(new KeyValuePair<ItemData, int>(from.m_itemData, 1));
				all.Add(entry);
				produced.Add(((Object)((Component)to).gameObject).name);
			}
		}

		private static void EnsureStation(string key, CraftingStation cs)
		{
			if (Stations.ContainsKey(key))
			{
				return;
			}
			Sprite icon = null;
			string name;
			if (key == "")
			{
				name = "Hand crafting";
			}
			else if (key == "?")
			{
				name = "Other sources";
			}
			else
			{
				name = Localization.instance.Localize(key);
				Piece val = (((Object)(object)cs != (Object)null) ? ((Component)cs).GetComponent<Piece>() : null);
				if ((Object)(object)val != (Object)null)
				{
					icon = val.m_icon;
				}
				if ((Object)(object)cs != (Object)null && (Object)(object)cs.m_icon != (Object)null)
				{
					icon = cs.m_icon;
				}
			}
			Stations[key] = new Station
			{
				Key = key,
				Name = name,
				Icon = icon,
				Piece = (((Object)(object)cs != (Object)null) ? ((Component)cs).GetComponent<Piece>() : null)
			};
		}

		private static int StationTier(Station st)
		{
			if ((Object)(object)st.Piece != (Object)null && st.Piece.m_resources != null && st.Piece.m_resources.Length != 0)
			{
				int num = 0;
				Requirement[] resources = st.Piece.m_resources;
				foreach (Requirement val in resources)
				{
					if ((Object)(object)val?.m_resItem != (Object)null)
					{
						num = Math.Max(num, ItemTier(((Object)((Component)val.m_resItem).gameObject).name, 0));
					}
				}
				return num;
			}
			List<int> list = (from e in st.Entries.Values.SelectMany((List<Entry> l) => l)
				select e.Tier into x
				orderby x
				select x).ToList();
			if (list.Count != 0)
			{
				return list[list.Count / 2];
			}
			return 0;
		}

		internal static Branch? Classify(SharedData s, string prefab, HashSet<string> meadBases)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Expected I4, but got Unknown
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Invalid comparison between Unknown and I4
			//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Invalid comparison between Unknown and I4
			ItemType itemType = s.m_itemType;
			switch (itemType - 1)
			{
			case 1:
				if (s.m_food > 0f || s.m_foodStamina > 0f || s.m_foodEitr > 0f)
				{
					return Branch.Food;
				}
				if (!((Object)(object)s.m_consumeStatusEffect != (Object)null))
				{
					return null;
				}
				return Branch.Potions;
			case 2:
			case 3:
			case 8:
			case 13:
			case 21:
				if ((int)s.m_skillType == 9 || (int)s.m_skillType == 10 || (s.m_attack != null && s.m_attack.m_attackEitr > 0f))
				{
					return Branch.Magic;
				}
				return Branch.Weapons;
			case 4:
			case 5:
			case 6:
			case 10:
			case 17:
				return Branch.Armor;
			case 16:
				return IsPauldron(s, prefab) ? Branch.Armor : Branch.Capes;
			case 23:
				return Branch.Trinkets;
			case 0:
				if (meadBases == null || !meadBases.Contains(prefab))
				{
					return null;
				}
				return Branch.Potions;
			default:
				return null;
			}
		}

		private static bool IsPauldron(SharedData s, string prefab)
		{
			if (prefab.IndexOf("cape", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("cloak", StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return false;
			}
			string text = (prefab + " " + Localization.instance.Localize(s.m_name ?? "")).ToLowerInvariant();
			if (!text.Contains("pauldron") && !text.Contains("shoulder"))
			{
				return text.Contains("spaulder");
			}
			return true;
		}

		private static bool LooksObtainable(SharedData s)
		{
			if (s.m_icons == null || s.m_icons.Length == 0 || (Object)(object)s.m_icons[0] == (Object)null)
			{
				return false;
			}
			if (string.IsNullOrEmpty(s.m_name))
			{
				return false;
			}
			string text = Localization.instance.Localize(s.m_name);
			if (string.IsNullOrEmpty(text) || text.Contains("$") || text.StartsWith("["))
			{
				return false;
			}
			return !Regex.IsMatch(text, "(^|[^a-z])test([^a-z]|$)", RegexOptions.IgnoreCase);
		}

		internal static int ItemTier(string prefab, int depth)
		{
			if (TierCache.TryGetValue(prefab, out var value))
			{
				return value;
			}
			if (KnownTiers.TryGetValue(prefab, out value))
			{
				return TierCache[prefab] = value;
			}
			if (depth > 6)
			{
				return 0;
			}
			TierCache[prefab] = 0;
			int num2 = -1;
			if (!prefab.StartsWith("Trophy", StringComparison.OrdinalIgnoreCase) && RecipesByItem.TryGetValue(prefab, out var value2))
			{
				foreach (Recipe item in value2)
				{
					int num3 = 0;
					Requirement[] resources = item.m_resources;
					foreach (Requirement val in resources)
					{
						if ((Object)(object)val?.m_resItem != (Object)null && !val.m_upgraderResource)
						{
							num3 = Math.Max(num3, ItemTier(((Object)((Component)val.m_resItem).gameObject).name, depth + 1));
						}
					}
					num2 = ((num2 < 0) ? num3 : Math.Min(num2, num3));
				}
			}
			if (num2 < 0)
			{
				string text = prefab.ToLowerInvariant();
				(string, int)[] nameHints = NameHints;
				for (int i = 0; i < nameHints.Length; i++)
				{
					var (value3, num4) = nameHints[i];
					if (text.Contains(value3))
					{
						num2 = num4;
						break;
					}
				}
			}
			return TierCache[prefab] = Math.Max(0, num2);
		}

		private static float Score(Entry e)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_006f: Expected I4, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			SharedData shared = e.Item.m_shared;
			ItemType itemType = shared.m_itemType;
			switch (itemType - 2)
			{
			case 4:
			case 5:
			case 9:
			case 15:
				return shared.m_armor;
			case 3:
				return shared.m_blockPower;
			case 0:
				if (e.Branch == Branch.Food)
				{
					return shared.m_food + shared.m_foodStamina + shared.m_foodEitr;
				}
				return (float)e.Tier * 1000f;
			case 1:
			case 2:
			case 7:
			case 12:
			case 20:
			{
				DamageTypes damages = shared.m_damages;
				return damages.m_damage + damages.m_blunt + damages.m_slash + damages.m_pierce + damages.m_fire + damages.m_frost + damages.m_lightning + damages.m_poison + damages.m_spirit;
			}
			default:
				return (float)e.Tier * 1000f;
			}
		}

		private static int SlotOrder(ItemType t)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Invalid comparison between Unknown and I4
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Invalid comparison between Unknown and I4
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Invalid comparison between Unknown and I4
			if ((int)t <= 7)
			{
				if ((int)t == 6)
				{
					return 0;
				}
				if ((int)t == 7)
				{
					return 1;
				}
			}
			else
			{
				if ((int)t == 11)
				{
					return 2;
				}
				if ((int)t == 17)
				{
					return 3;
				}
			}
			return 4;
		}

		private static int KindOrder(Entry e)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected I4, but got Unknown
			ItemType itemType = e.Item.m_shared.m_itemType;
			switch (itemType - 3)
			{
			case 3:
			case 4:
			case 8:
			case 14:
				return 0;
			case 2:
				return 1;
			case 15:
				return 2;
			case 6:
				return 20;
			case 1:
				return 15;
			case 0:
			case 11:
			case 19:
				return 10;
			default:
				return 30;
			}
		}

		private static string GroupKey(Entry e)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			if (!string.IsNullOrEmpty(e.SetName))
			{
				return "set:" + e.SetName;
			}
			if (SlotOrder(e.Item.m_shared.m_itemType) <= 3)
			{
				string text = e.Name.Trim();
				int num = text.IndexOf(' ');
				if (num > 0)
				{
					return "fam:" + text.Substring(0, num).ToLowerInvariant();
				}
			}
			return "\u0001" + ((Object)e.Prefab).name + "|" + e.GetHashCode();
		}

		private static List<Entry> Sort(List<Entry> list)
		{
			List<(int, int, float, string, List<Entry>)> list2 = new List<(int, int, float, string, List<Entry>)>();
			List<List<Entry>> list3 = new List<List<Entry>>();
			foreach (IGrouping<string, Entry> item2 in list.GroupBy(GroupKey))
			{
				if (item2.Key.StartsWith("fam:") && item2.Count() > 5)
				{
					list3.AddRange(from e in item2
						group e by e.Tier into x
						select x.ToList());
				}
				else
				{
					list3.Add(item2.ToList());
				}
			}
			foreach (List<Entry> item3 in list3)
			{
				List<Entry> list4 = (from e in item3
					orderby SlotOrder(e.Item.m_shared.m_itemType), e.Score, e.Name
					select e).ToList();
				List<Entry> list5 = list4.Where((Entry e) => SlotOrder(e.Item.m_shared.m_itemType) <= 2).ToList();
				float item = ((list5.Count > 0) ? list5 : list4).Min((Entry e) => e.Score);
				int key = (from e in list4
					group e by e.Tier into x
					orderby x.Count() descending, x.Key descending
					select x).First().Key;
				list2.Add((key, ((IEnumerable<Entry>)list4).Min((Func<Entry, int>)KindOrder), item, list4[0].Name, list4));
			}
			return (from g in list2
				orderby g.tier, g.kind, g.score
				select g).ThenBy<(int, int, float, string, List<Entry>), string>(((int tier, int kind, float score, string name, List<Entry> items) g) => g.name, StringComparer.CurrentCultureIgnoreCase).SelectMany<(int, int, float, string, List<Entry>), Entry>(((int tier, int kind, float score, string name, List<Entry> items) g) => g.items).ToList();
		}

		internal static List<Station> StationsFor(Branch b)
		{
			List<Entry> value;
			return (from s in Stations.Values
				where s.Entries.TryGetValue(b, out value) && value.Count > 0
				orderby (s.Key == "?") ? 1 : 0, s.Tier
				select s).ThenBy<Station, string>((Station s) => s.Name, StringComparer.CurrentCultureIgnoreCase).ToList();
		}

		internal static string DumpSummary()
		{
			StringBuilder stringBuilder = new StringBuilder("Drzewko (ModTree):\n");
			foreach (Branch value in Enum.GetValues(typeof(Branch)))
			{
				stringBuilder.AppendLine("  [" + BranchName(value) + "]");
				foreach (Station item in StationsFor(value))
				{
					List<Entry> list = item.Entries[value];
					stringBuilder.AppendLine($"    {item.Name} (era {item.Tier}): {list.Count}");
					foreach (Entry item2 in list)
					{
						stringBuilder.AppendLine(string.Format("      t{0} {1} [{2}] s={3:0}{4} <- {5}", item2.Tier, item2.Name, ((Object)item2.Prefab).name, item2.Score, string.IsNullOrEmpty(item2.SetName) ? "" : (" set=" + item2.SetName), string.Join(", ", item2.Ingredients.Select((KeyValuePair<ItemData, int> i) => i.Value + "x " + i.Key.m_shared.m_name))));
					}
				}
			}
			return stringBuilder.ToString();
		}
	}
	[BepInPlugin("local.modtree", "ModTree", "1.2.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		[HarmonyPatch(typeof(InventoryGui), "Awake")]
		private static class InventoryGui_Awake
		{
			[CompilerGenerated]
			private static class <>O
			{
				public static UnityAction <0>__Toggle;
			}

			private static void Postfix(InventoryGui __instance)
			{
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_005e: 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_006e: 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_00a7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Expected O, but got Unknown
				if (!GUIManager.IsHeadless() && !((Object)(object)__instance.m_player == (Object)null))
				{
					GameObject obj = GUIManager.Instance.CreateButton("Progression Tree", (Transform)(object)__instance.m_player, new Vector2(1f, 1f), new Vector2(1f, 1f), Vector2.zero, 170f, 32f);
					RectTransform val = (RectTransform)obj.transform;
					val.pivot = new Vector2(1f, 0f);
					val.anchoredPosition = new Vector2(0f, 6f);
					ButtonClickedEvent onClick = obj.GetComponent<Button>().onClick;
					object obj2 = <>O.<0>__Toggle;
					if (obj2 == null)
					{
						UnityAction val2 = TreeUI.Toggle;
						<>O.<0>__Toggle = val2;
						obj2 = (object)val2;
					}
					((UnityEvent)onClick).AddListener((UnityAction)obj2);
					((Object)obj).name = "ModTreeButton";
				}
			}
		}

		[HarmonyPatch(typeof(InventoryGui), "Update")]
		private static class InventoryGui_Update
		{
			private static bool Prefix()
			{
				if (!TreeUI.IsOpen)
				{
					return true;
				}
				if (Input.GetKeyDown((KeyCode)27) || ZInput.GetButtonDown("Inventory") || ZInput.GetButtonDown("JoyButtonB"))
				{
					TreeUI.Close();
				}
				return false;
			}
		}

		[HarmonyPatch(typeof(ZNetScene), "Awake")]
		private static class ZNetScene_Awake
		{
			private static void Postfix(ZNetScene __instance)
			{
				if (DumpToLog.Value)
				{
					((MonoBehaviour)__instance).StartCoroutine(Dump());
				}
			}

			private static IEnumerator Dump()
			{
				yield return (object)new WaitForSeconds(6f);
				Catalog.EnsureBuilt();
				Log.LogInfo((object)Catalog.DumpSummary());
			}
		}

		public const string GUID = "local.modtree";

		public const string NAME = "ModTree";

		public const string VERSION = "1.2.1";

		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> DumpToLog;

		internal static ConfigEntry<bool> HideWorld;

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			DumpToLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Diagnostyka", "Zrzut drzewka do logu", false, "Po wczytaniu swiata zapisuje do LogOutput.log stacje i przedmioty drzewka.");
			HideWorld = ((BaseUnityPlugin)this).Config.Bind<bool>("Wydajnosc", "Ukryj swiat przy otwartym drzewku", true, "Kamera gry nie rysuje swiata, gdy okno drzewka jest otwarte (i tak jest zasloniety) - duzo wiecej FPS.");
			new Harmony("local.modtree").PatchAll(typeof(Plugin).Assembly);
		}
	}
	internal class TreeUI : MonoBehaviour
	{
		private const float ColW = 250f;

		private const float NodeH = 66f;

		private const float NodeGap = 18f;

		private const float HeaderH = 78f;

		private const float ColGap = 26f;

		private static TreeUI _instance;

		private RectTransform _mapContent;

		private RectTransform _detailsContent;

		private RectTransform _pickerContent;

		private ScrollRect _mapScroll;

		private ScrollRect _detailsScroll;

		private GameObject _picker;

		private Text _title;

		private Text _detailsHeader;

		private readonly Dictionary<(string, Branch), Image> _nodes = new Dictionary<(string, Branch), Image>();

		private readonly Dictionary<(string, Branch), Image> _frames = new Dictionary<(string, Branch), Image>();

		private bool _diagDone;

		private Image _backdrop;

		private Camera _hiddenCam;

		private int _savedMask;

		private readonly Dictionary<(string, Branch), Text> _nodeCounts = new Dictionary<(string, Branch), Text>();

		private Station _selected;

		private Branch _selectedBranch;

		private bool _showDiscovered = true;

		private bool _showHidden = true;

		private Coroutine _pulse;

		private static readonly Color FrameColor = new Color(0.55f, 0.42f, 0.25f, 1f);

		internal static bool IsOpen
		{
			get
			{
				if ((Object)(object)_instance != (Object)null)
				{
					return ((Component)_instance).gameObject.activeSelf;
				}
				return false;
			}
		}

		internal static void Toggle()
		{
			if (IsOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		internal static void Open()
		{
			if (!((Object)(object)GUIManager.CustomGUIFront == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null))
			{
				Catalog.EnsureBuilt();
				if ((Object)(object)_instance == (Object)null)
				{
					Create();
				}
				((Component)_instance).gameObject.SetActive(true);
				((Component)_instance).transform.SetAsLastSibling();
				_instance.Rebuild();
				_instance.HideWorld(Plugin.HideWorld.Value);
				if (!_instance._diagDone)
				{
					_instance._diagDone = true;
					((MonoBehaviour)_instance).StartCoroutine(_instance.Diagnose());
				}
				GUIManager.BlockInput(true);
			}
		}

		internal static void Close()
		{
			if (!((Object)(object)_instance == (Object)null) && ((Component)_instance).gameObject.activeSelf)
			{
				_instance._picker.SetActive(false);
				_instance.HideWorld(hide: false);
				((Component)_instance).gameObject.SetActive(false);
				GUIManager.BlockInput(false);
			}
		}

		private IEnumerator Diagnose()
		{
			yield return (object)new WaitForSecondsRealtime(1.5f);
			try
			{
				ThumbBar[] componentsInChildren = ((Component)this).GetComponentsInChildren<ThumbBar>(true);
				foreach (ThumbBar thumbBar in componentsInChildren)
				{
					Plugin.Log.LogInfo((object)("Diag: " + thumbBar.Describe()));
				}
				Plugin.Log.LogInfo((object)$"Diag: map nodes={_frames.Count} active={_frames.Values.Count((Image f) => ((Component)f).gameObject.activeInHierarchy)} list rows={((Component)_detailsContent).GetComponentsInChildren<HorizontalLayoutGroup>(true).Length}");
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Diag: " + ex));
			}
		}

		private void Update()
		{
			if (!InventoryGui.IsVisible() || (Object)(object)Player.m_localPlayer == (Object)null)
			{
				Close();
			}
		}

		private void OnDestroy()
		{
			HideWorld(hide: false);
			if ((Object)(object)_instance == (Object)(object)this)
			{
				_instance = null;
				GUIManager.BlockInput(false);
			}
		}

		private void HideWorld(bool hide)
		{
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			if (hide && (Object)(object)_hiddenCam == (Object)null)
			{
				Camera val = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).GetComponent<Camera>() : null);
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				_hiddenCam = val;
				_savedMask = val.cullingMask;
				val.cullingMask = 0;
			}
			else if (!hide && (Object)(object)_hiddenCam != (Object)null)
			{
				if (_hiddenCam.cullingMask == 0)
				{
					_hiddenCam.cullingMask = _savedMask;
				}
				_hiddenCam = null;
			}
			if ((Object)(object)_backdrop != (Object)null)
			{
				((Graphic)_backdrop).color = new Color(0.03f, 0.025f, 0.02f, ((Object)(object)_hiddenCam != (Object)null) ? 1f : 0.72f);
			}
		}

		private static void Create()
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = UIKit.Stretch(UIKit.Rect("ModTree", GUIManager.CustomGUIFront.transform));
			Image backdrop = UIKit.Panel(val, new Color(0f, 0f, 0f, 0.72f));
			((Component)val).gameObject.AddComponent<Blocker>();
			_instance = ((Component)val).gameObject.AddComponent<TreeUI>();
			_instance._backdrop = backdrop;
			_instance.BuildWindow(val);
		}

		private void BuildWindow(RectTransform root)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Expected O, but got Unknown
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a6: 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_01c4: 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: Expected O, but got Unknown
			//IL_021b: 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_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: 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_02a8: 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_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0300: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_033c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0351: 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_037b: Unknown result type (might be due to invalid IL or missing references)
			//IL_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0401: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_041f: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = UIKit.Stretch(UIKit.Rect("Window", (Transform)(object)root), 40f, 40f, 40f, 40f);
			UIKit.Panel(val, UIKit.PanelBg);
			try
			{
				GUIManager.Instance.ApplyWoodpanelStyle((Transform)(object)val);
			}
			catch
			{
			}
			UIKit.Stretch(val, 40f, 40f, 40f, 40f);
			RectTransform val2 = UIKit.Rect("Top", (Transform)(object)val);
			val2.anchorMin = new Vector2(0f, 1f);
			val2.anchorMax = new Vector2(1f, 1f);
			val2.pivot = new Vector2(0.5f, 1f);
			val2.offsetMin = new Vector2(24f, -64f);
			val2.offsetMax = new Vector2(-24f, -14f);
			_title = UIKit.Label((Transform)(object)val2, "Progression Tree", 24, UIKit.Orange, (TextAnchor)3);
			UIKit.Stretch(((Graphic)_title).rectTransform, 0f, 0f, 140f);
			UIKit.Place((RectTransform)((Component)UIKit.Button((Transform)(object)val2, "Close", Close)).transform, new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), Vector2.zero, new Vector2(120f, 38f));
			UIKit.Place((RectTransform)((Component)UIKit.Button((Transform)(object)val, "Find station  ^", delegate
			{
				_picker.SetActive(!_picker.activeSelf);
			})).transform, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(24f, 18f), new Vector2(260f, 38f));
			RectTransform val3 = UIKit.Rect("Body", (Transform)(object)val);
			UIKit.Stretch(val3, 20f, 74f, 20f, 66f);
			RectTransform val4 = UIKit.Rect("Map", (Transform)(object)val3);
			val4.anchorMin = new Vector2(0f, 0f);
			val4.anchorMax = new Vector2(0.58f, 1f);
			val4.offsetMin = Vector2.zero;
			val4.offsetMax = new Vector2(-8f, 0f);
			UIKit.Panel(val4, new Color(0f, 0f, 0f, 0.35f));
			_mapScroll = UIKit.Scroll(val4, horizontal: true, vertical: true, out _mapContent, layout: false);
			RectTransform val5 = UIKit.Rect("Details", (Transform)(object)val3);
			val5.anchorMin = new Vector2(0.58f, 0f);
			val5.anchorMax = new Vector2(1f, 1f);
			val5.offsetMin = new Vector2(8f, 0f);
			val5.offsetMax = Vector2.zero;
			UIKit.Panel(val5, new Color(0f, 0f, 0f, 0.35f));
			_detailsHeader = UIKit.Label((Transform)(object)val5, "Pick a station on the map", 20, UIKit.Orange, (TextAnchor)3);
			RectTransform rectTransform = ((Graphic)_detailsHeader).rectTransform;
			rectTransform.anchorMin = new Vector2(0f, 1f);
			rectTransform.anchorMax = new Vector2(1f, 1f);
			rectTransform.pivot = new Vector2(0.5f, 1f);
			rectTransform.offsetMin = new Vector2(12f, -44f);
			rectTransform.offsetMax = new Vector2(-12f, -6f);
			RectTransform val6 = UIKit.Rect("List", (Transform)(object)val5);
			UIKit.Stretch(val6, 0f, 48f);
			_detailsScroll = UIKit.Scroll(val6, horizontal: false, vertical: true, out _detailsContent, layout: true);
			RectTransform val7 = UIKit.Rect("Picker", (Transform)(object)val);
			UIKit.Place(val7, new Vector2(0f, 0f), new Vector2(0f, 0f), new Vector2(24f, 62f), new Vector2(340f, 440f));
			UIKit.Panel(val7, new Color(0.1f, 0.08f, 0.06f, 0.98f));
			RectTransform obj2 = UIKit.Stretch(UIKit.Rect("Frame", (Transform)(object)val7), -2f, -2f, -2f, -2f);
			((Graphic)UIKit.Panel(obj2, UIKit.Orange)).raycastTarget = false;
			((Transform)obj2).SetAsFirstSibling();
			UIKit.Scroll(val7, horizontal: false, vertical: true, out _pickerContent, layout: true);
			_picker = ((Component)val7).gameObject;
			_picker.SetActive(false);
		}

		private void Rebuild()
		{
			//IL_001c: 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_0161: 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_018b: 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_01a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fa: 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_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: 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_028b: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			foreach (Transform item in (Transform)_mapContent)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			_nodes.Clear();
			_frames.Clear();
			_nodeCounts.Clear();
			int num = 0;
			int num2 = 0;
			int num3 = 0;
			Branch[] array = (Branch[])Enum.GetValues(typeof(Branch));
			for (int i = 0; i < array.Length; i++)
			{
				Branch branch = array[i];
				List<Station> list = Catalog.StationsFor(branch);
				num3 = Math.Max(num3, list.Count);
				float num4 = 12f + (float)i * 276f;
				int num5 = 0;
				int num6 = 0;
				foreach (Station item2 in list)
				{
					foreach (Entry item3 in item2.Entries[branch])
					{
						num5++;
						if (item3.Discovered(localPlayer))
						{
							num6++;
						}
					}
				}
				num += num5;
				num2 += num6;
				UIKit.Place(((Graphic)UIKit.Label((Transform)(object)_mapContent, "<b>" + Catalog.BranchName(branch) + "</b>", 21, UIKit.Orange, (TextAnchor)7)).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num4, -6f), new Vector2(250f, 28f));
				UIKit.Place(((Graphic)UIKit.Label((Transform)(object)_mapContent, $"discovered {num6} / {num5}", 13, UIKit.Muted, (TextAnchor)1, outline: false)).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(num4, -35f), new Vector2(250f, 20f));
				if (list.Count > 1)
				{
					RectTransform rt = UIKit.Rect("Trunk", (Transform)(object)_mapContent);
					float num7 = 111f;
					UIKit.Place(size: new Vector2(4f, 78f + (float)(list.Count - 1) * 84f + 33f - num7), rt: rt, anchor: new Vector2(0f, 1f), pivot: new Vector2(0.5f, 1f), pos: new Vector2(num4 + 125f, 0f - num7));
					UIKit.Panel(rt, new Color(0.55f, 0.42f, 0.25f, 0.9f));
				}
				for (int j = 0; j < list.Count; j++)
				{
					MakeNode(list[j], branch, num4, 78f + (float)j * 84f, localPlayer);
				}
			}
			_mapContent.sizeDelta = new Vector2(24f + (float)array.Length * 276f, 78f + (float)num3 * 84f + 20f);
			_title.text = $"Progression Tree   <size=16><color=#bfb39a>discovered {num2} / {num} items</color></size>";
			BuildPicker();
			if (_selected != null && _selected.Entries.ContainsKey(_selectedBranch))
			{
				ShowStation(_selected, _selectedBranch);
			}
		}

		private void MakeNode(Station st, Branch b, float x, float y, Player player)
		{
			//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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: 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_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = UIKit.Rect("Node", (Transform)(object)_mapContent);
			UIKit.Place(val, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, 0f - y), new Vector2(250f, 66f));
			Image val2 = UIKit.Panel(val, FrameColor);
			((Graphic)val2).raycastTarget = false;
			RectTransform val3 = UIKit.Stretch(UIKit.Rect("Body", (Transform)(object)val), 2f, 2f, 2f, 2f);
			List<Entry> list = st.Entries[b];
			int num = list.Count((Entry e) => e.Discovered(player));
			Image value = UIKit.Panel(val3, (num == list.Count) ? UIKit.NodeBgDone : UIKit.NodeBg);
			RectTransform val4 = UIKit.Rect("Icon", (Transform)(object)val3);
			UIKit.Place(val4, new Vector2(0f, 0.5f), new Vector2(0f, 0.5f), new Vector2(8f, 0f), new Vector2(48f, 48f));
			if ((Object)(object)st.Icon != (Object)null)
			{
				Image obj = ((Component)val4).gameObject.AddComponent<Image>();
				obj.sprite = st.Icon;
				obj.preserveAspect = true;
			}
			else
			{
				((Graphic)UIKit.Label((Transform)(object)val4, (st.Key == "?") ? "?" : "*", 30, UIKit.Beige, (TextAnchor)4)).rectTransform.sizeDelta = new Vector2(48f, 48f);
			}
			Text obj2 = UIKit.Label((Transform)(object)val3, st.Name, 16, UIKit.Beige, (TextAnchor)3, outline: false);
			UIKit.Stretch(((Graphic)obj2).rectTransform, 64f, 6f, 6f, 24f);
			obj2.resizeTextForBestFit = true;
			obj2.resizeTextMinSize = 11;
			obj2.resizeTextMaxSize = 16;
			Text val5 = UIKit.Label((Transform)(object)val3, $"{num} / {list.Count}", 13, UIKit.Muted, (TextAnchor)6, outline: false);
			UIKit.Stretch(((Graphic)val5).rectTransform, 64f, 40f, 6f, 4f);
			UIKit.OnClick(((Component)val3).gameObject, delegate
			{
				_picker.SetActive(false);
				ShowStation(st, b);
				Highlight(st.Key, pulse: false);
			});
			_nodes[(st.Key, b)] = value;
			_frames[(st.Key, b)] = val2;
			_nodeCounts[(st.Key, b)] = val5;
		}

		private void BuildPicker()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in (Transform)_pickerContent)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			foreach (Station st in Catalog.Stations.Values.Where((Station s) => s.Entries.Values.Any((List<Entry> l) => l.Count > 0)).OrderBy<Station, string>((Station s) => s.Name, StringComparer.CurrentCultureIgnoreCase))
			{
				UIKit.Layout((Component)(object)UIKit.Button((Transform)(object)_pickerContent, st.Name, delegate
				{
					JumpTo(st);
				}, 15), 34f, 34f);
			}
		}

		private void JumpTo(Station st)
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			_picker.SetActive(false);
			Branch branch = (from kv in st.Entries
				where kv.Value.Count > 0
				select kv.Key into b
				orderby (int)b
				select b).First();
			ShowStation(st, branch);
			if (_nodes.TryGetValue((st.Key, branch), out var value))
			{
				RectTransform val = (RectTransform)((Component)value).transform.parent;
				Rect rect = _mapScroll.viewport.rect;
				Vector2 val2 = default(Vector2);
				((Vector2)(ref val2))..ctor(0f - (val.anchoredPosition.x + 125f - ((Rect)(ref rect)).width / 2f), 0f - (val.anchoredPosition.y - 33f + ((Rect)(ref rect)).height / 2f));
				float num = Mathf.Max(0f, _mapContent.sizeDelta.x - ((Rect)(ref rect)).width);
				float num2 = Mathf.Max(0f, _mapContent.sizeDelta.y - ((Rect)(ref rect)).height);
				_mapScroll.StopMovement();
				_mapContent.anchoredPosition = new Vector2(Mathf.Clamp(val2.x, 0f - num, 0f), Mathf.Clamp(val2.y, 0f, num2));
			}
			Highlight(st.Key, pulse: true);
		}

		private void Highlight(string key, bool pulse)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			foreach (KeyValuePair<(string, Branch), Image> frame in _frames)
			{
				bool flag = frame.Key.Item1 == key;
				((Graphic)frame.Value).color = (flag ? UIKit.Orange : FrameColor);
				int num = (flag ? 4 : 2);
				UIKit.Stretch((RectTransform)((Component)_nodes[frame.Key]).transform, num, num, num, num);
			}
			if (_pulse != null)
			{
				((MonoBehaviour)this).StopCoroutine(_pulse);
			}
			if (pulse)
			{
				_pulse = ((MonoBehaviour)this).StartCoroutine(Pulse(key));
			}
		}

		private IEnumerator Pulse(string key)
		{
			List<Image> imgs = (from kv in _nodes
				where kv.Key.Item1 == key
				select kv.Value).ToList();
			List<Color> baseColors = imgs.Select((Image i) => ((Graphic)i).color).ToList();
			for (float t = 0f; t < 2.4f; t += Time.unscaledDeltaTime)
			{
				float num = 0.5f + 0.5f * Mathf.Sin(t * 8f);
				for (int num2 = 0; num2 < imgs.Count; num2++)
				{
					((Graphic)imgs[num2]).color = Color.Lerp(baseColors[num2], new Color(0.6f, 0.4f, 0.1f, 1f), num);
				}
				yield return null;
			}
			for (int num3 = 0; num3 < imgs.Count; num3++)
			{
				((Graphic)imgs[num3]).color = baseColors[num3];
			}
		}

		private void ShowStation(Station st, Branch b)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			_selected = st;
			_selectedBranch = b;
			foreach (Transform item in (Transform)_detailsContent)
			{
				((Component)item).gameObject.SetActive(false);
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
			Player player = Player.m_localPlayer;
			List<Entry> list = st.Entries[b];
			List<Entry> list2 = list.Where((Entry e) => e.Discovered(player)).ToList();
			List<Entry> list3 = list.Where((Entry e) => !e.Discovered(player)).ToList();
			_detailsHeader.text = $"{st.Name}   <size=14><color=#bfb39a>{Catalog.BranchName(b)} · discovered {list2.Count} / {list.Count}</color></size>";
			Section($"Discovered ({list2.Count})", list2, discovered: true, _showDiscovered, delegate(bool v)
			{
				_showDiscovered = v;
			});
			Section($"Undiscovered ({list3.Count})", list3, discovered: false, _showHidden, delegate(bool v)
			{
				_showHidden = v;
			});
			_detailsContent.anchoredPosition = Vector2.zero;
		}

		private void Section(string title, List<Entry> entries, bool discovered, bool expanded, Action<bool> remember)
		{
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			Button val = UIKit.Button((Transform)(object)_detailsContent, (expanded ? "[-]  " : "[+]  ") + title, delegate
			{
			}, 17);
			UIKit.Layout((Component)(object)val, 36f, 36f);
			Text htext = ((Component)val).GetComponentInChildren<Text>();
			if ((Object)(object)htext != (Object)null)
			{
				htext.alignment = (TextAnchor)4;
			}
			RectTransform box = UIKit.Rect("Group", (Transform)(object)_detailsContent);
			VerticalLayoutGroup obj = ((Component)box).gameObject.AddComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f;
			((Component)box).gameObject.SetActive(expanded);
			bool filled = false;
			if (expanded)
			{
				Fill();
			}
			((UnityEvent)val.onClick).AddListener((UnityAction)delegate
			{
				//IL_009e: 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)
				bool flag = !((Component)box).gameObject.activeSelf;
				if (flag)
				{
					Fill();
				}
				((Component)box).gameObject.SetActive(flag);
				remember(flag);
				if ((Object)(object)htext != (Object)null)
				{
					htext.text = (flag ? "[-]  " : "[+]  ") + title;
				}
				LayoutRebuilder.ForceRebuildLayoutImmediate(_detailsContent);
				_detailsContent.anchoredPosition = WheelScroll.Clamp(_detailsScroll, _detailsContent.anchoredPosition);
			});
			void Fill()
			{
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				if (filled)
				{
					return;
				}
				filled = true;
				if (entries.Count == 0)
				{
					UIKit.Layout((Component)(object)UIKit.Label((Transform)(object)box, "  (none)", 14, UIKit.Muted, (TextAnchor)3, outline: false), 24f, 24f);
				}
				foreach (Entry entry in entries)
				{
					Row((Transform)(object)box, entry, discovered);
				}
			}
		}

		private void Row(Transform parent, Entry e, bool discovered)
		{
			//IL_0045: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Expected O, but got Unknown
			//IL_00e8: 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_03c2: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			RectTransform val = UIKit.Rect("Row", parent);
			UIKit.Panel(val, discovered ? new Color(0.16f, 0.14f, 0.11f, 0.9f) : new Color(0.11f, 0.1f, 0.09f, 0.9f));
			Hover hover = ((Component)val).gameObject.AddComponent<Hover>();
			hover.Tint = true;
			hover.HandCursor = false;
			HorizontalLayoutGroup obj = ((Component)val).gameObject.AddComponent<HorizontalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
			((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)obj).spacing = 10f;
			((LayoutGroup)obj).padding = new RectOffset(8, 8, 8, 8);
			RectTransform val2 = UIKit.Rect("Icon", (Transform)(object)val);
			UIKit.Layout((Component)(object)val2, 56f, 56f, 56f).minWidth = 56f;
			UIKit.Panel(val2, new Color(0f, 0f, 0f, 0.45f));
			if (discovered && (Object)(object)e.Item.GetIcon() != (Object)null)
			{
				Image obj2 = ((Component)UIKit.Stretch(UIKit.Rect("Img", (Transform)(object)val2), 4f, 4f, 4f, 4f)).gameObject.AddComponent<Image>();
				obj2.sprite = e.Item.GetIcon();
				obj2.preserveAspect = true;
			}
			else
			{
				UIKit.Stretch(((Graphic)UIKit.Label((Transform)(object)val2, "?", 34, UIKit.Muted, (TextAnchor)4, outline: false)).rectTransform);
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("<color=#ffa13c><b>").Append(e.Name).Append("</b></color>");
			if (e.Amount > 1)
			{
				stringBuilder.Append($"  <color=#bfb39a>x{e.Amount}</color>");
			}
			if (e.StationLevel > 1)
			{
				stringBuilder.Append($"  <size=13><color=#9a9a9a>· station level {e.StationLevel}</color></size>");
			}
			if (!string.IsNullOrEmpty(e.SetName))
			{
				stringBuilder.Append("  <size=13><color=#8fbf6a>· set</color></size>");
			}
			stringBuilder.Append('\n');
			if (e.StationKey == "?")
			{
				stringBuilder.Append("<size=14><color=#9a9a9a>No recipe - obtained another way (drops, trading, chests).</color></size>");
			}
			else
			{
				stringBuilder.Append("<size=14>");
				if (!string.IsNullOrEmpty(e.Note))
				{
					stringBuilder.Append("<color=#9a9a9a>").Append(char.ToUpper(e.Note[0])).Append(e.Note.Substring(1))
						.Append(": </color>");
				}
				else
				{
					stringBuilder.Append("<color=#9a9a9a>Ingredients: </color>");
				}
				for (int i = 0; i < e.Ingredients.Count; i++)
				{
					KeyValuePair<ItemData, int> keyValuePair = e.Ingredients[i];
					bool flag = (Object)(object)localPlayer != (Object)null && localPlayer.IsMaterialKnown(keyValuePair.Key.m_shared.m_name);
					if (i > 0)
					{
						stringBuilder.Append(", ");
					}
					stringBuilder.Append(flag ? "<color=#e0cfa8>" : "<color=#d9705a>").Append(keyValuePair.Value).Append("× ")
						.Append(Localization.instance.Localize(keyValuePair.Key.m_shared.m_name))
						.Append("</color>");
				}
				if (e.Ingredients.Count == 0)
				{
					stringBuilder.Append("<color=#9a9a9a>none</color>");
				}
				stringBuilder.Append("</size>");
			}
			stringBuilder.Append('\n');
			if (discovered)
			{
				stringBuilder.Append("<size=13><color=#cfc6b4>").Append(Stats(e)).Append("</color></size>");
			}
			else
			{
				stringBuilder.Append("<size=13><i><color=#8a8378>Stats hidden - find every ingredient (shown in red) to reveal them.</color></i></size>");
			}
			UIKit.Layout((Component)(object)UIKit.Label((Transform)(object)val, stringBuilder.ToString(), 16, UIKit.Beige, (TextAnchor)0, outline: false)).flexibleWidth = 1f;
		}

		private static string Stats(Entry e)
		{
			string tooltip;
			try
			{
				tooltip = ItemData.GetTooltip(e.Item, 1, true, (float)Game.m_worldLevel, -1, false);
			}
			catch
			{
				return "";
			}
			tooltip = Localization.instance.Localize(tooltip ?? "");
			tooltip = Regex.Replace(tooltip, "<sprite[^>]*>", "");
			tooltip = UIKit.FixSizes(tooltip, 13);
			tooltip = tooltip.Replace("\n\n", "\n").Trim();
			if (tooltip.Length <= 1200)
			{
				return tooltip;
			}
			return tooltip.Substring(0, 1200) + "…";
		}
	}
	internal static class UIKit
	{
		internal static readonly Color Orange = new Color(1f, 0.631f, 0.235f, 1f);

		internal static readonly Color Beige = new Color(0.853f, 0.725f, 0.533f, 1f);

		internal static readonly Color Muted = new Color(0.62f, 0.6f, 0.56f, 1f);

		internal static readonly Color PanelBg = new Color(0.08f, 0.07f, 0.06f, 0.92f);

		internal static readonly Color NodeBg = new Color(0.18f, 0.15f, 0.12f, 0.95f);

		internal static readonly Color NodeBgDone = new Color(0.2f, 0.24f, 0.13f, 0.95f);

		private static Font _fallback;

		internal const float BarSize = 16f;

		internal static Font Font
		{
			get
			{
				Font averiaSerifBold = GUIManager.Instance.AveriaSerifBold;
				if ((Object)(object)averiaSerifBold != (Object)null)
				{
					return averiaSerifBold;
				}
				if ((Object)(object)_fallback == (Object)null)
				{
					_fallback = Resources.FindObjectsOfTypeAll<Font>().FirstOrDefault();
				}
				return _fallback;
			}
		}

		internal static RectTransform Rect(string name, Transform parent)
		{
			//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_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			return (RectTransform)val.transform;
		}

		internal static RectTransform Stretch(RectTransform rt, float l = 0f, float t = 0f, float r = 0f, float b = 0f)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			rt.offsetMin = new Vector2(l, b);
			rt.offsetMax = new Vector2(0f - r, 0f - t);
			return rt;
		}

		internal static Image Panel(RectTransform rt, Color c)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			Image obj = ((Component)rt).gameObject.AddComponent<Image>();
			((Graphic)obj).color = c;
			return obj;
		}

		internal static Text Label(Transform parent, string text, int size, Color color, TextAnchor align = (TextAnchor)3, bool outline = true)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: 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)
			RectTransform val = Rect("Text", parent);
			Text obj = ((Component)val).gameObject.AddComponent<Text>();
			obj.font = Font;
			obj.fontSize = size;
			((Graphic)obj).color = color;
			obj.alignment = align;
			obj.supportRichText = true;
			obj.horizontalOverflow = (HorizontalWrapMode)0;
			obj.verticalOverflow = (VerticalWrapMode)1;
			obj.text = text;
			((Graphic)obj).raycastTarget = false;
			if (outline)
			{
				Outline obj2 = ((Component)val).gameObject.AddComponent<Outline>();
				((Shadow)obj2).effectColor = new Color(0f, 0f, 0f, 0.8f);
				((Shadow)obj2).effectDistance = new Vector2(1f, -1f);
			}
			return obj;
		}

		internal static Button Button(Transform parent, string text, Action onClick, int size = 16)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			GameObject obj = GUIManager.Instance.CreateButton(text, parent, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 120f, 32f);
			Button component = obj.GetComponent<Button>();
			((UnityEvent)component.onClick).AddListener((UnityAction)delegate
			{
				onClick();
			});
			Text componentInChildren = obj.GetComponentInChildren<Text>();
			if ((Object)(object)componentInChildren != (Object)null)
			{
				componentInChildren.fontSize = size;
				componentInChildren.resizeTextForBestFit = true;
				componentInChildren.resizeTextMinSize = 10;
				componentInChildren.resizeTextMaxSize = size;
			}
			obj.AddComponent<Hover>();
			return component;
		}

		internal static void Place(RectTransform rt, Vector2 anchor, Vector2 pivot, Vector2 pos, Vector2 size)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: 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_0018: 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)
			Vector2 anchorMin = (rt.anchorMax = anchor);
			rt.anchorMin = anchorMin;
			rt.pivot = pivot;
			rt.anchoredPosition = pos;
			rt.sizeDelta = size;
		}

		internal static ScrollRect Scroll(RectTransform area, bool horizontal, bool vertical, out RectTransform content, bool layout)
		{
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Expected O, but got Unknown
			ScrollRect val = ((Component)area).gameObject.AddComponent<ScrollRect>();
			val.horizontal = horizontal;
			val.vertical = vertical;
			val.movementType = (MovementType)2;
			val.inertia = true;
			val.decelerationRate = 0.08f;
			val.scrollSensitivity = 0f;
			RectTransform val2 = Stretch(Rect("Viewport", (Transform)(object)area), 0f, 0f, vertical ? 18f : 0f, horizontal ? 18f : 0f);
			Canvas obj = ((Component)val2).gameObject.AddComponent<Canvas>();
			obj.overridePixelPerfect = true;
			obj.pixelPerfect = false;
			((Component)val2).gameObject.AddComponent<GraphicRaycaster>();
			((Component)val2).gameObject.AddComponent<RectMask2D>();
			((Graphic)((Component)val2).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f);
			((Component)val2).gameObject.AddComponent<WheelScroll>().Target = val;
			content = Rect("Content", (Transform)(object)val2);
			content.anchorMin = new Vector2(0f, 1f);
			content.anchorMax = new Vector2(layout ? 1f : 0f, 1f);
			content.pivot = new Vector2(0f, 1f);
			content.anchoredPosition = Vector2.zero;
			content.sizeDelta = Vector2.zero;
			if (layout)
			{
				VerticalLayoutGroup obj2 = ((Component)content).gameObject.AddComponent<VerticalLayoutGroup>();
				((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true;
				((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false;
				((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true;
				((HorizontalOrVerticalLayoutGroup)obj2).spacing = 4f;
				((LayoutGroup)obj2).padding = new RectOffset(6, 6, 6, 6);
				((Component)content).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2;
			}
			val.viewport = val2;
			val.content = content;
			if (vertical)
			{
				Bar(area, val, horizontal: false, horizontal);
			}
			if (horizontal)
			{
				Bar(area, val, horizontal: true, vertical);
			}
			return val;
		}

		private static void Bar(RectTransform area, ScrollRect sr, bool horizontal, bool both)
		{
			//IL_009c: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0137: Unknown result type (might be due to invalid IL or missing references)
			RectTransform val = Rect(horizontal ? "HBar" : "VBar", (Transform)(object)area);
			float num = (both ? 18f : 0f);
			if (horizontal)
			{
				val.anchorMin = new Vector2(0f, 0f);
				val.anchorMax = new Vector2(1f, 0f);
				val.pivot = new Vector2(0f, 0f);
				val.offsetMin = new Vector2(0f, 0f);
				val.offsetMax = new Vector2(0f - num, 16f);
			}
			else
			{
				val.anchorMin = new Vector2(1f, 0f);
				val.anchorMax = new Vector2(1f, 1f);
				val.pivot = new Vector2(1f, 0f);
				val.offsetMin = new Vector2(-16f, num);
				val.offsetMax = new Vector2(0f, 0f);
			}
			Panel(val, new Color(0.05f, 0.04f, 0.03f, 0.9f));
			RectTransform val2 = Rect("Thumb", (Transform)(object)val);
			Panel(val2, new Color(0.86f, 0.66f, 0.38f, 1f));
			((Component)val2).gameObject.AddComponent<Hover>().Tint = true;
			ThumbBar thumbBar = ((Component)val).gameObject.AddComponent<ThumbBar>();
			thumbBar.Target = sr;
			thumbBar.Horizontal = horizontal;
			thumbBar.Track = val;
			thumbBar.Thumb = val2;
		}

		internal static LayoutElement Layout(Component c, float minH = -1f, float prefH = -1f, float prefW = -1f)
		{
			LayoutElement val = c.gameObject.GetComponent<LayoutElement>() ?? c.gameObject.AddComponent<LayoutElement>();
			if (minH >= 0f)
			{
				val.minHeight = minH;
			}
			if (prefH >= 0f)
			{
				val.preferredHeight = prefH;
			}
			if (prefW >= 0f)
			{
				val.preferredWidth = prefW;
			}
			return val;
		}

		internal static void OnClick(GameObject go, Action a)
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			Button obj = go.GetComponent<Button>() ?? go.AddComponent<Button>();
			((Selectable)obj).transition = (Transition)0;
			((UnityEvent)obj.onClick).AddListener((UnityAction)delegate
			{
				a();
			});
			if ((Object)(object)go.GetComponent<Hover>() == (Object)null)
			{
				go.AddComponent<Hover>().Tint = true;
			}
		}

		internal static string FixSizes(string s, int baseSize)
		{
			return Regex.Replace(s ?? "", "<size=(\\d+(?:\\.\\d+)?)%>", (Match m) => "<size=" + Mathf.Max(6, Mathf.RoundToInt((float)baseSize * float.Parse(m.Groups[1].Value, CultureInfo.InvariantCulture) / 100f)) + ">");
		}
	}
	internal class WheelScroll : MonoBehaviour, IScrollHandler, IEventSystemHandler
	{
		internal ScrollRect Target;

		internal const float Step = 120f;

		private Vector2 _goal;

		private Vector2 _vel;

		private Vector2 _set;

		private bool _moving;

		public void OnScroll(PointerEventData e)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: 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_00db: 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_0134: 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_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Target == (Object)null) && !((Object)(object)Target.content == (Object)null))
			{
				Vector2 scrollDelta = e.scrollDelta;
				float num = ((Mathf.Abs(scrollDelta.y) < 0.0001f) ? 0f : Mathf.Sign(scrollDelta.y));
				float num2 = ((Mathf.Abs(scrollDelta.x) < 0.0001f) ? 0f : Mathf.Sign(scrollDelta.x));
				if ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303) || !Target.vertical) && Target.horizontal)
				{
					num2 = 0f - num;
					num = 0f;
				}
				RectTransform content = Target.content;
				Target.StopMovement();
				Vector2 pos = (_moving ? _goal : content.anchoredPosition);
				if (Target.vertical && num != 0f)
				{
					pos.y -= num * 120f;
				}
				if (Target.horizontal && num2 != 0f)
				{
					pos.x -= num2 * 120f;
				}
				_goal = Clamp(Target, pos);
				if (!_moving)
				{
					_vel = Vector2.zero;
					_set = content.anchoredPosition;
				}
				_moving = true;
			}
		}

		private void Update()
		{
			//IL_0024: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0071: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: 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_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: 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)
			if (!_moving || (Object)(object)Target == (Object)null)
			{
				return;
			}
			RectTransform content = Target.content;
			Vector2 val = content.anchoredPosition - _set;
			if (((Vector2)(ref val)).sqrMagnitude > 1f)
			{
				_moving = false;
				return;
			}
			Vector2 val2 = Vector2.SmoothDamp(content.anchoredPosition, _goal, ref _vel, 0.07f, float.PositiveInfinity, Time.unscaledDeltaTime);
			val = val2 - _goal;
			if (((Vector2)(ref val)).sqrMagnitude < 0.25f)
			{
				val2 = _goal;
				_moving = false;
			}
			val = (content.anchoredPosition = (_set = val2));
		}

		internal static Vector2 Clamp(ScrollRect sr, Vector2 pos)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			RectTransform content = sr.content;
			Rect rect = sr.viewport.rect;
			float y = pos.y;
			Rect rect2 = content.rect;
			pos.y = Mathf.Clamp(y, 0f, Mathf.Max(0f, ((Rect)(ref rect2)).height - ((Rect)(ref rect)).height));
			float x = pos.x;
			rect2 = content.rect;
			pos.x = Mathf.Clamp(x, 0f - Mathf.Max(0f, ((Rect)(ref rect2)).width - ((Rect)(ref rect)).width), 0f);
			return pos;
		}
	}
	internal class ThumbBar : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler, IBeginDragHandler
	{
		internal ScrollRect Target;

		internal bool Horizontal;

		internal RectTransform Track;

		internal RectTransform Thumb;

		private const float MinThumb = 28f;

		private float _grab;

		private float _lastT = -1f;

		private float _lastLen = -1f;

		private const float Inset = 2f;

		private float Axis(Rect r)
		{
			if (!Horizontal)
			{
				return ((Rect)(ref r)).height;
			}
			return ((Rect)(ref r)).width;
		}

		private float Offset(out float max)
		{
			//IL_0014: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			RectTransform content = Target.content;
			max = Mathf.Max(0f, Axis(content.rect) - Axis(Target.viewport.rect));
			if (!Horizontal)
			{
				return content.anchoredPosition.y;
			}
			return 0f - content.anchoredPosition.x;
		}

		private void LateUpdate()
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Target == (Object)null) && !((Object)(object)Target.content == (Object)null) && !((Object)(object)Thumb == (Object)null))
			{
				float num = Mathf.Max(0f, Axis(Track.rect) - 4f);
				float max;
				float num2 = Offset(out max);
				float num3 = Axis(Target.content.rect);
				float num4 = Axis(Target.viewport.rect);
				float num5 = ((num3 <= 0f || num4 >= num3) ? num : Mathf.Clamp(num * num4 / num3, Mathf.Min(28f, num), num));
				float num6 = ((max <= 0f) ? 0f : Mathf.Clamp01(num2 / max));
				if (float.IsNaN(num5) || float.IsNaN(num6))
				{
					num5 = num;
					num6 = 0f;
				}
				_lastT = num6;
				_lastLen = num5;
				float num7 = 2f + num6 * (num - num5);
				if (Horizontal)
				{
					Thumb.anchorMin = new Vector2(0f, 0f);
					Thumb.anchorMax = new Vector2(0f, 1f);
					Thumb.pivot = new Vector2(0f, 0.5f);
					Thumb.anchoredPosition = new Vector2(num7, 0f);
					Thumb.sizeDelta = new Vector2(num5, -4f);
				}
				else
				{
					Thumb.anchorMin = new Vector2(0f, 1f);
					Thumb.anchorMax = new Vector2(1f, 1f);
					Thumb.pivot = new Vector2(0.5f, 1f);
					Thumb.anchoredPosition = new Vector2(0f, 0f - num7);
					Thumb.sizeDelta = new Vector2(-4f, num5);
				}
			}
		}

		internal string Describe()
		{
			//IL_0047: 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_0085: 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_00bb: 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_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			Image val = (((Object)(object)Thumb != (Object)null) ? ((Component)Thumb).GetComponent<Image>() : null);
			return string.Format("{0}bar rect={1} thumb active={2} rect={3} pos={4} ", Horizontal ? "H" : "V", Track.rect, ((Component)Thumb).gameObject.activeInHierarchy, Thumb.rect, Thumb.anchoredPosition) + $"size={Thumb.sizeDelta} amin={Thumb.anchorMin} amax={Thumb.anchorMax} t={_lastT:0.000} len={_lastLen:0.0} " + string.Format("color={0} cull={1} ", ((Object)(object)val != (Object)null) ? ((object)((Graphic)val).color/*cast due to .constrained prefix*/).ToString() : "-", (Object)(object)val != (Object)null && ((Graphic)val).canvasRenderer.cull) + $"viewport={Target.viewport.rect} content={Target.content.rect} at {Target.content.anchoredPosition}";
		}

		private bool Along(PointerEventData e, out float d)
		{
			//IL_000e: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			d = 0f;
			Vector2 val = default(Vector2);
			if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(Track, e.position, e.pressEventCamera, ref val))
			{
				return false;
			}
			Rect rect = Track.rect;
			d = (Horizontal ? (val.x - ((Rect)(ref rect)).xMin) : (((Rect)(ref rect)).yMax - val.y));
			return true;
		}

		public void OnPointerDown(PointerEventData e)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)Target == (Object)null) && Along(e, out var d))
			{
				float num = 2f + Mathf.Max(0f, _lastT) * (Axis(Track.rect) - 4f - _lastLen);
				_grab = ((d >= num && d <= num + _lastLen) ? (d - num) : (_lastLen / 2f));
				MoveTo(d);
			}
		}

		public void OnBeginDrag(PointerEventData e)
		{
		}

		public void OnDrag(PointerEventData e)
		{
			if ((Object)(object)Target != (Object)null && Along(e, out var d))
			{
				MoveTo(d);
			}
		}

		private void MoveTo(float d)
		{
			//IL_0007: 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_0068: 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)
			float num = Axis(Track.rect) - 4f - _lastLen;
			float num2 = ((num <= 0f) ? 0f : Mathf.Clamp01((d - 2f - _grab) / num));
			Offset(out var max);
			Target.StopMovement();
			Vector2 anchoredPosition = Target.content.anchoredPosition;
			if (Horizontal)
			{
				anchoredPosition.x = (0f - num2) * max;
			}
			else
			{
				anchoredPosition.y = num2 * max;
			}
			Target.content.anchoredPosition = anchoredPosition;
		}
	}
	internal class Hover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		internal bool Tint;

		internal bool HandCursor = true;

		private Image _img;

		private Color _base;

		private bool _inside;

		public void OnPointerEnter(PointerEventData e)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			_inside = true;
			if (HandCursor)
			{
				Cursors.Hand();
			}
			if (Tint)
			{
				_img = ((Component)this).GetComponent<Image>();
				if (!((Object)(object)_img == (Object)null))
				{
					_base = ((Graphic)_img).color;
					((Graphic)_img).color = new Color(Mathf.Min(1f, _base.r * 1.45f + 0.06f), Mathf.Min(1f, _base.g * 1.45f + 0.05f), Mathf.Min(1f, _base.b * 1.35f + 0.03f), _base.a);
				}
			}
		}

		public void OnPointerExit(PointerEventData e)
		{
			Leave();
		}

		private void OnDisable()
		{
			if (_inside)
			{
				Leave();
			}
		}

		private void Leave()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			_inside = false;
			if (HandCursor)
			{
				Cursors.Default();
			}
			if (Tint && (Object)(object)_img != (Object)null)
			{
				((Graphic)_img).color = _base;
			}
		}

		internal void Rebase(Color c)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			_base = c;
		}
	}
	internal static class Cursors
	{
		private static Texture2D _hand;

		private static readonly string[] Art = new string[16]
		{
			"......##........", ".....#OO#.......", ".....#OO#.......", ".....#OO#.......", ".....#OO###.....", ".....#OO#OO###..", "..##.#OO#OO#OO#.", ".#OO##OOOOO#OO##", ".#OOO#OOOOOOOO#O#", "..#OO#OOOOOOOOOO#",
			"...#OOOOOOOOOOOO#", "...#OOOOOOOOOOO#.", "....#OOOOOOOOOO#.", ".....#OOOOOOOO#..", "......#OOOOOOO#..", "......#########.."
		};

		internal static void Hand()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				if ((Object)(object)_hand == (Object)null)
				{
					_hand = Build();
				}
				Cursor.SetCursor(_hand, new Vector2(12f, 0f), (CursorMode)0);
			}
			catch
			{
			}
		}

		internal static void Default()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Cursor.SetCursor((Texture2D)null, Vector2.zero, (CursorMode)0);
			}
			catch
			{
			}
		}

		private static Texture2D Build()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Expected O, but got Unknown
			//IL_00a7: 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_00a4: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false)
			{
				filterMode = (FilterMode)0
			};
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0f, 0f, 0f, 0f);
			Color val3 = default(Color);
			((Color)(ref val3))..ctor(0.12f, 0.08f, 0.05f, 1f);
			Color val4 = default(Color);
			((Color)(ref val4))..ctor(0.98f, 0.9f, 0.75f, 1f);
			for (int i = 0; i < 16; i++)
			{
				for (int j = 0; j < 16; j++)
				{
					string text = Art[i];
					Color val5 = (Color)(((j < text.Length) ? text[j] : '.') switch
					{
						'O' => val4, 
						'#' => val3, 
						_ => val2, 
					});
					for (int k = 0; k < 2; k++)
					{
						for (int l = 0; l < 2; l++)
						{
							val.SetPixel(j * 2 + l, (15 - i) * 2 + k, val5);
						}
					}
				}
			}
			val.Apply();
			return val;
		}
	}
	internal class Blocker : MonoBehaviour, IPointerClickHandler, IEventSystemHandler, IScrollHandler
	{
		public void OnPointerClick(PointerEventData e)
		{
		}

		public void OnScroll(PointerEventData e)
		{
		}
	}
}