Decompiled source of Carturs Map Pins v2.4.0

plugins/CarturMapPins.dll

Decompiled a day ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Splatform;
using TMPro;
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(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("CarturMapPins")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2fcb15bc001568a9ba80462f54eb8634450ff908")]
[assembly: AssemblyProduct("CarturMapPins")]
[assembly: AssemblyTitle("CarturMapPins")]
[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 CarturMapPins
{
	internal class CellHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		private const float HoverScale = 1.14f;

		private const float Speed = 24f;

		private Image _border;

		private float _target = 1f;

		private bool _animating;

		private int _yieldFrames;

		public void Bind(Image border)
		{
			_border = border;
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			//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_003d: Unknown result type (might be due to invalid IL or missing references)
			_target = 1.14f;
			_animating = true;
			if ((Object)(object)_border != (Object)null && ((Graphic)_border).color != IconGrid.Selected)
			{
				((Graphic)_border).color = IconGrid.Hovered;
			}
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			//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_003d: Unknown result type (might be due to invalid IL or missing references)
			_target = 1f;
			_animating = true;
			if ((Object)(object)_border != (Object)null && ((Graphic)_border).color != IconGrid.Selected)
			{
				((Graphic)_border).color = IconGrid.Resting;
			}
		}

		private void OnEnable()
		{
			_yieldFrames = 12;
		}

		private void Update()
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			if (_yieldFrames > 0)
			{
				_yieldFrames--;
				IconGrid.YieldHover(((Component)this).gameObject);
			}
			if (_animating)
			{
				float num = Mathf.Lerp(((Component)this).transform.localScale.x, _target, Time.unscaledDeltaTime * 24f);
				if (Mathf.Abs(num - _target) < 0.005f)
				{
					num = _target;
					_animating = false;
				}
				((Component)this).transform.localScale = new Vector3(num, num, 1f);
			}
		}
	}
	internal static class ChestRegistry
	{
		private static readonly List<Container> Live = new List<Container>();

		private static readonly HashSet<Container> Seen = new HashSet<Container>();

		public static void Add(Container container)
		{
			if (!((Object)(object)container == (Object)null) && Seen.Add(container))
			{
				Live.Add(container);
			}
		}

		public static void Clear()
		{
			Live.Clear();
			Seen.Clear();
		}

		public static IEnumerable<Container> Alive()
		{
			for (int i = Live.Count - 1; i >= 0; i--)
			{
				if ((Object)(object)Live[i] == (Object)null)
				{
					Seen.Remove(Live[i]);
					Live.RemoveAt(i);
				}
				else
				{
					yield return Live[i];
				}
			}
		}
	}
	internal static class ClusterInspector
	{
		private sealed class Entry
		{
			public PinData Pin;

			public string Name;

			public string Category;

			public int Weight;
		}

		private sealed class Row
		{
			public GameObject Go;

			public RectTransform Rect;

			public Image Icon;

			public Image Back;

			public TextMeshProUGUI Name;

			public TextMeshProUGUI Meta;

			public int Index = -1;
		}

		private const float Width = 340f;

		private const float RowH = 26f;

		private const float HeaderH = 30f;

		private const float SearchH = 30f;

		private const float Visible = 12f;

		private const float Pad = 8f;

		private const int Pool = 14;

		private static GameObject _panel;

		private static RectTransform _rect;

		private static RectTransform _content;

		private static ScrollRect _scroll;

		private static TMP_InputField _search;

		private static TextMeshProUGUI _title;

		private static Camera _camera;

		private static Minimap _map;

		private static readonly List<Entry> All = new List<Entry>();

		private static readonly List<Entry> Shown = new List<Entry>();

		private static readonly Row[] Rows = new Row[14];

		private static int _firstRow = -1;

		private static float _refreshAt;

		private static readonly Color Text = new Color(0.95f, 0.92f, 0.82f, 1f);

		public static bool IsOpen
		{
			get
			{
				if ((Object)(object)_panel != (Object)null)
				{
					return _panel.activeSelf;
				}
				return false;
			}
		}

		public static bool PointerOver()
		{
			if (IsOpen)
			{
				return IconGrid.PointerOver(_panel, _rect, _camera);
			}
			return false;
		}

		public static void Open(Minimap map, PinData leader)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: 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_0193: Unknown result type (might be due to invalid IL or missing references)
			IReadOnlyList<PinData> readOnlyList = Clusters.GroupOf(leader);
			if (readOnlyList == null || readOnlyList.Count == 0)
			{
				return;
			}
			_map = map;
			if ((Object)(object)_panel == (Object)null)
			{
				Build(map);
			}
			if ((Object)(object)_panel == (Object)null)
			{
				return;
			}
			Vector3 me = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).transform.position : leader.m_pos);
			All.Clear();
			foreach (PinData item in readOnlyList)
			{
				string text = PinRecord.KeyOfIndexed(item);
				int num = text?.IndexOf(':') ?? (-1);
				All.Add(new Entry
				{
					Pin = item,
					Name = Labels.Localize(string.IsNullOrEmpty(item.m_name) ? "Pin" : item.m_name),
					Category = ((num > 0) ? text.Substring(0, num) : "Pin"),
					Weight = Crowding.MergedCount(item)
				});
			}
			All.Sort((Entry a, Entry b) => Utils.DistanceXZ(me, a.Pin.m_pos).CompareTo(Utils.DistanceXZ(me, b.Pin.m_pos)));
			((TMP_Text)_title).text = $"<color=#C79452>{Clusters.CountOf(leader)} pins</color>{Breakdown(leader)}";
			_search.text = string.Empty;
			Refilter();
			_panel.SetActive(true);
			((Transform)_rect).position = LabelCrowding.Pointer + new Vector3(24f, 0f, 0f);
			Clamp();
			_panel.transform.SetAsLastSibling();
			ClusterPopup.Hide();
		}

		private static string Breakdown(PinData leader)
		{
			if (!Clusters.IsMixed(leader))
			{
				return string.Empty;
			}
			Dictionary<string, int> dictionary = new Dictionary<string, int>();
			foreach (Entry item in All)
			{
				dictionary.TryGetValue(item.Category, out var value);
				dictionary[item.Category] = value + 1;
			}
			List<string> list = new List<string>();
			foreach (KeyValuePair<string, int> item2 in dictionary)
			{
				list.Add($"{item2.Key} {item2.Value}");
			}
			return "  <size=12><alpha=#99>" + string.Join(", ", list);
		}

		public static void Close()
		{
			if ((Object)(object)_panel != (Object)null && _panel.activeSelf)
			{
				_panel.SetActive(false);
			}
			All.Clear();
			Shown.Clear();
		}

		public static void Tick()
		{
			if (IsOpen)
			{
				if (ZInput.GetMouseButtonDown(0) && !PointerOver())
				{
					Close();
				}
				else if (Time.unscaledTime >= _refreshAt)
				{
					_refreshAt = Time.unscaledTime + 0.5f;
					Layout(force: true);
				}
			}
		}

		private static void Refilter()
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			Shown.Clear();
			string text = (((Object)(object)_search != (Object)null) ? _search.text : string.Empty);
			foreach (Entry item in All)
			{
				if (text.Length == 0 || item.Name.IndexOf(text, StringComparison.OrdinalIgnoreCase) >= 0)
				{
					Shown.Add(item);
				}
			}
			_content.sizeDelta = new Vector2(0f, (float)Shown.Count * 26f);
			_rect.sizeDelta = new Vector2(340f, 60f + (float)Mathf.Max(1, Mathf.Min(Shown.Count, 12)) * 26f + 8f);
			_content.anchoredPosition = Vector2.zero;
			Layout(force: true);
		}

		private static void Layout(bool force)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: 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)
			int num = Mathf.Max(0, Mathf.FloorToInt(_content.anchoredPosition.y / 26f));
			if (!force && num == _firstRow)
			{
				return;
			}
			_firstRow = num;
			Vector3 val = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).transform.position : Vector3.zero);
			for (int i = 0; i < 14; i++)
			{
				Row row = Rows[i];
				int num2 = num + i;
				if (num2 >= Shown.Count)
				{
					if (row.Go.activeSelf)
					{
						row.Go.SetActive(false);
					}
					row.Index = -1;
					continue;
				}
				Entry entry = Shown[num2];
				row.Index = num2;
				row.Rect.anchoredPosition = new Vector2(0f, (float)(-num2) * 26f);
				Sprite val2 = (((Object)(object)entry.Pin.m_iconElement != (Object)null) ? entry.Pin.m_iconElement.sprite : entry.Pin.m_icon);
				row.Icon.sprite = val2;
				((Behaviour)row.Icon).enabled = (Object)(object)val2 != (Object)null;
				((TMP_Text)row.Name).text = ((entry.Weight > 1) ? $"{entry.Name}  <color=#C79452>x{entry.Weight}</color>" : entry.Name);
				((TMP_Text)row.Meta).text = $"<alpha=#99>{entry.Category}  <alpha=#FF><color=#C79452>{Mathf.RoundToInt(Utils.DistanceXZ(val, entry.Pin.m_pos))} m";
				if (!row.Go.activeSelf)
				{
					row.Go.SetActive(true);
				}
			}
		}

		private static void Pick(Row row)
		{
			if (row.Index >= 0 && row.Index < Shown.Count && !((Object)(object)_map == (Object)null))
			{
				PinData pin = Shown[row.Index].Pin;
				List<PinData> list = AllPins();
				Close();
				FocusSeparated(_map, pin, list);
			}
		}

		private static List<PinData> AllPins()
		{
			List<PinData> list = new List<PinData>();
			foreach (Entry item in All)
			{
				list.Add(item.Pin);
			}
			return list;
		}

		public static void FocusSeparated(Minimap map, PinData pin, IReadOnlyList<PinData> group)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			float num = float.MaxValue;
			foreach (PinData item in group)
			{
				if (item != pin)
				{
					num = Mathf.Min(num, Utils.DistanceXZ(pin.m_pos, item.m_pos));
				}
			}
			float num2 = Crowding.IconMetres(map);
			float num3 = map.LargeZoom;
			if (num < float.MaxValue && num2 > 0f)
			{
				num3 = Mathf.Min(num3, num3 * (num / 2.6f) / num2);
			}
			SmoothZoom.FocusOn(map, pin.m_pos, num3);
		}

		private static void Clamp()
		{
			//IL_00c1: 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_00d2: Unknown result type (might be due to invalid IL or missing references)
			Vector3[] array = (Vector3[])(object)new Vector3[4];
			_rect.GetWorldCorners(array);
			float num = 0f;
			float num2 = 0f;
			if (array[2].x > (float)Screen.width)
			{
				num -= array[2].x - (float)Screen.width;
			}
			if (array[0].x + num < 0f)
			{
				num = 0f - array[0].x;
			}
			if (array[0].y < 0f)
			{
				num2 -= array[0].y;
			}
			if (array[2].y + num2 > (float)Screen.height)
			{
				num2 -= array[2].y + num2 - (float)Screen.height;
			}
			RectTransform rect = _rect;
			((Transform)rect).position = ((Transform)rect).position + new Vector3(num, num2, 0f);
		}

		private static void Build(Minimap map)
		{
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Expected O, but got Unknown
			//IL_007d: 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_0083: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: 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_0211: 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_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_023a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Expected O, but got Unknown
			//IL_0262: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0435: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Expected O, but got Unknown
			//IL_0457: Unknown result type (might be due to invalid IL or missing references)
			//IL_045d: Expected O, but got Unknown
			//IL_045e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_047e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0493: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04de: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ff: Expected O, but got Unknown
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0527: Unknown result type (might be due to invalid IL or missing references)
			//IL_0540: Unknown result type (might be due to invalid IL or missing references)
			//IL_0321: Unknown result type (might be due to invalid IL or missing references)
			//IL_0326: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Unknown result type (might be due to invalid IL or missing references)
			//IL_0370: 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_0385: 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_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b4: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)map.m_largeRoot == (Object)null)
			{
				return;
			}
			float num = 380f;
			_panel = new GameObject("CarturPins_ClusterInspector", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			_panel.transform.SetParent(map.m_largeRoot.transform, false);
			_rect = (RectTransform)_panel.transform;
			RectTransform rect = _rect;
			Vector2 anchorMin = (_rect.anchorMax = Vector2.zero);
			rect.anchorMin = anchorMin;
			_rect.pivot = new Vector2(0f, 1f);
			_rect.sizeDelta = new Vector2(340f, num);
			((Graphic)_panel.GetComponent<Image>()).color = new Color(0.04f, 0.035f, 0.03f, 0.96f);
			GameObject val = new GameObject("Rail", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(_panel.transform, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = new Vector2(0f, 1f);
			val2.anchorMax = new Vector2(1f, 1f);
			val2.pivot = new Vector2(0.5f, 1f);
			val2.sizeDelta = new Vector2(0f, 2f);
			((Graphic)val.GetComponent<Image>()).color = IconGrid.Bronze;
			((Graphic)val.GetComponent<Image>()).raycastTarget = false;
			GameObject val3 = new GameObject("Title", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(_panel.transform, false);
			RectTransform val4 = (RectTransform)val3.transform;
			val4.anchorMin = new Vector2(0f, 1f);
			val4.anchorMax = new Vector2(1f, 1f);
			val4.pivot = new Vector2(0f, 1f);
			val4.offsetMin = new Vector2(10f, -30f);
			val4.offsetMax = new Vector2(-30f, -2f);
			_title = Fonts.AddLabel(val3);
			((TMP_Text)_title).fontSize = 16f;
			((Graphic)_title).color = Text;
			((TMP_Text)_title).alignment = (TextAlignmentOptions)4097;
			((TMP_Text)_title).textWrappingMode = (TextWrappingModes)0;
			((Graphic)_title).raycastTarget = false;
			AddButton(_panel.transform, "Close", "X", new Vector2(1f, 1f), new Vector2(-17f, -17f), new Vector2(24f, 24f), Close);
			_search = PinEditor.AddNameInput(map, _panel.transform);
			if ((Object)(object)_search != (Object)null)
			{
				RectTransform val5 = (RectTransform)((Component)_search).transform;
				val5.anchorMin = new Vector2(0f, 1f);
				val5.anchorMax = new Vector2(1f, 1f);
				val5.pivot = new Vector2(0.5f, 1f);
				val5.offsetMin = new Vector2(8f, 0f);
				val5.offsetMax = new Vector2(-8f, 0f);
				val5.anchoredPosition = new Vector2(0f, -30f);
				val5.sizeDelta = new Vector2(val5.sizeDelta.x, 26f);
				TextFocus.Register(_search);
				((UnityEvent<string>)(object)_search.onValueChanged).AddListener((UnityAction<string>)delegate
				{
					if (IsOpen)
					{
						Refilter();
					}
				});
			}
			GameObject val6 = new GameObject("View", new Type[4]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(RectMask2D),
				typeof(ScrollRect)
			});
			val6.transform.SetParent(_panel.transform, false);
			RectTransform val7 = (RectTransform)val6.transform;
			val7.anchorMin = Vector2.zero;
			val7.anchorMax = Vector2.one;
			val7.offsetMin = new Vector2(8f, 4f);
			val7.offsetMax = new Vector2(-8f, -60f);
			((Graphic)val6.GetComponent<Image>()).color = new Color(0f, 0f, 0f, 0.01f);
			GameObject val8 = new GameObject("Content", new Type[1] { typeof(RectTransform) });
			val8.transform.SetParent(val6.transform, false);
			_content = (RectTransform)val8.transform;
			_content.anchorMin = new Vector2(0f, 1f);
			_content.anchorMax = new Vector2(1f, 1f);
			_content.pivot = new Vector2(0.5f, 1f);
			_scroll = val6.GetComponent<ScrollRect>();
			_scroll.viewport = val7;
			_scroll.content = _content;
			_scroll.horizontal = false;
			_scroll.movementType = (MovementType)2;
			_scroll.scrollSensitivity = 0f;
			val6.AddComponent<IconGrid.SmoothScroll>().Bind(_scroll, 26f);
			((UnityEvent<Vector2>)(object)_scroll.onValueChanged).AddListener((UnityAction<Vector2>)delegate
			{
				Layout(force: false);
			});
			for (int num2 = 0; num2 < 14; num2++)
			{
				Rows[num2] = BuildRow((Transform)(object)_content);
			}
			_camera = IconGrid.CameraFor(_panel);
			_panel.SetActive(false);
		}

		private static Row BuildRow(Transform parent)
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_009f: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Expected O, but got Unknown
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_0206: Expected O, but got Unknown
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: 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_0246: Unknown result type (might be due to invalid IL or missing references)
			//IL_024c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_0261: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: 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)
			Row row = new Row();
			row.Go = new GameObject("Row", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			row.Go.transform.SetParent(parent, false);
			row.Rect = (RectTransform)row.Go.transform;
			row.Rect.anchorMin = new Vector2(0f, 1f);
			row.Rect.anchorMax = new Vector2(1f, 1f);
			row.Rect.pivot = new Vector2(0f, 1f);
			row.Rect.sizeDelta = new Vector2(0f, 24f);
			row.Back = row.Go.GetComponent<Image>();
			((Graphic)row.Back).color = new Color(1f, 1f, 1f, 0.04f);
			Button component = row.Go.GetComponent<Button>();
			((Selectable)component).targetGraphic = (Graphic)(object)row.Back;
			ColorBlock colors = ((Selectable)component).colors;
			((ColorBlock)(ref colors)).normalColor = Color.white;
			((ColorBlock)(ref colors)).highlightedColor = new Color(1f, 0.85f, 0.55f, 1f);
			((ColorBlock)(ref colors)).pressedColor = new Color(0.8f, 0.6f, 0.3f, 1f);
			((Selectable)component).colors = colors;
			((UnityEvent)component.onClick).AddListener((UnityAction)delegate
			{
				Pick(row);
			});
			GameObject val = new GameObject("Icon", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(row.Go.transform, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0f, 0.5f);
			val2.anchorMax = val3;
			val2.anchorMin = val3;
			val2.pivot = new Vector2(0f, 0.5f);
			val2.anchoredPosition = new Vector2(3f, 0f);
			val2.sizeDelta = new Vector2(20f, 20f);
			row.Icon = val.GetComponent<Image>();
			((Graphic)row.Icon).raycastTarget = false;
			row.Icon.preserveAspect = true;
			row.Name = AddText(row.Go.transform, "Name", 15f, (TextAlignmentOptions)4097, 26f, 0f, 0.58f);
			row.Meta = AddText(row.Go.transform, "Meta", 13f, (TextAlignmentOptions)4100, 0f, 0.58f, 1f);
			row.Go.SetActive(false);
			return row;
		}

		private static TextMeshProUGUI AddText(Transform parent, string name, float size, TextAlignmentOptions align, float left, float from, float to)
		{
			//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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_0098: 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)
			GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = new Vector2(from, 0f);
			val2.anchorMax = new Vector2(to, 1f);
			val2.offsetMin = new Vector2((left > 0f) ? left : 0f, 0f);
			val2.offsetMax = new Vector2(-4f, 0f);
			TextMeshProUGUI obj = Fonts.AddLabel(val);
			((TMP_Text)obj).fontSize = size;
			((Graphic)obj).color = Text;
			((TMP_Text)obj).alignment = align;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
			((Graphic)obj).raycastTarget = false;
			return obj;
		}

		private static void AddButton(Transform parent, string name, string caption, Vector2 anchor, Vector2 at, Vector2 size, Action click)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			//IL_0055: 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_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_0064: 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_006b: 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_0095: 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)
			//IL_00c7: Expected O, but got Unknown
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Expected O, but got Unknown
			//IL_0142: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Button)
			});
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 anchorMin = (val2.anchorMax = anchor);
			val2.anchorMin = anchorMin;
			val2.anchoredPosition = at;
			val2.sizeDelta = size;
			Image component = val.GetComponent<Image>();
			((Graphic)component).color = new Color(0.24f, 0.22f, 0.2f, 0.95f);
			((Selectable)val.GetComponent<Button>()).targetGraphic = (Graphic)(object)component;
			((UnityEvent)val.GetComponent<Button>().onClick).AddListener((UnityAction)delegate
			{
				click();
			});
			GameObject val4 = new GameObject("Caption", new Type[1] { typeof(RectTransform) });
			val4.transform.SetParent(val.transform, false);
			RectTransform val5 = (RectTransform)val4.transform;
			val5.anchorMin = Vector2.zero;
			val5.anchorMax = Vector2.one;
			anchorMin = (val5.offsetMax = Vector2.zero);
			val5.offsetMin = anchorMin;
			TextMeshProUGUI obj = Fonts.AddLabel(val4);
			((TMP_Text)obj).text = caption;
			((TMP_Text)obj).fontSize = 14f;
			((Graphic)obj).color = Text;
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((Graphic)obj).raycastTarget = false;
		}
	}
	[HarmonyPatch(typeof(Minimap), "SetMapMode")]
	internal static class Patch_Minimap_SetMapMode_Inspector
	{
		private static void Postfix(Minimap __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)__instance.m_mode != 2)
			{
				ClusterInspector.Close();
			}
		}
	}
	internal static class ClusterPopup
	{
		private const int Rows = 8;

		private static GameObject _panel;

		private static TextMeshProUGUI _text;

		public static bool Show(PinData leader, Transform root)
		{
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: 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)
			IReadOnlyList<PinData> readOnlyList = Clusters.GroupOf(leader);
			if (ClusterInspector.IsOpen || readOnlyList == null || readOnlyList.Count == 0)
			{
				return false;
			}
			if ((Object)(object)_panel == (Object)null || (Object)(object)_panel.transform.parent != (Object)(object)root)
			{
				Build(root);
			}
			if ((Object)(object)_panel == (Object)null)
			{
				return false;
			}
			Vector3 val = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).transform.position : leader.m_pos);
			Dictionary<string, KeyValuePair<int, float>> dictionary = new Dictionary<string, KeyValuePair<int, float>>();
			int num = 0;
			foreach (PinData item in readOnlyList)
			{
				string key = Labels.Localize(string.IsNullOrEmpty(item.m_name) ? "Pin" : item.m_name);
				int num2 = Crowding.MergedCount(item);
				float num3 = Utils.DistanceXZ(val, item.m_pos);
				if (dictionary.TryGetValue(key, out var value))
				{
					dictionary[key] = new KeyValuePair<int, float>(value.Key + num2, Mathf.Min(value.Value, num3));
				}
				else
				{
					dictionary[key] = new KeyValuePair<int, float>(num2, num3);
				}
				num += num2;
			}
			StringBuilder stringBuilder = new StringBuilder();
			stringBuilder.Append("<color=#C79452>").Append(num).Append(" pins</color>");
			foreach (KeyValuePair<string, KeyValuePair<int, float>> item2 in (from r in dictionary
				orderby r.Value.Key descending, r.Key
				select r).Take(8))
			{
				stringBuilder.Append('\n').Append(item2.Key).Append("  <color=#C79452>x")
					.Append(item2.Value.Key)
					.Append("</color>  <alpha=#99>")
					.Append(Mathf.RoundToInt(item2.Value.Value))
					.Append(" m");
			}
			if (dictionary.Count > 8)
			{
				stringBuilder.Append("\n<alpha=#99>+ ").Append(dictionary.Count - 8).Append(" more kinds");
			}
			((TMP_Text)_text).text = stringBuilder.ToString();
			_panel.SetActive(true);
			_panel.transform.SetAsLastSibling();
			return true;
		}

		public static void Place(Vector3 localPosition)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_panel != (Object)null && _panel.activeSelf)
			{
				_panel.transform.localPosition = localPosition;
			}
		}

		public static void Hide()
		{
			if ((Object)(object)_panel != (Object)null && _panel.activeSelf)
			{
				_panel.SetActive(false);
			}
		}

		private static void Build(Transform root)
		{
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			//IL_0061: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Expected O, but got Unknown
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0231: 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_0246: 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_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_panel != (Object)null)
			{
				Object.Destroy((Object)(object)_panel);
			}
			_panel = new GameObject("CarturPins_ClusterPopup", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			_panel.transform.SetParent(root, false);
			RectTransform val = (RectTransform)_panel.transform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			val.anchorMax = val2;
			val.anchorMin = val2;
			val.pivot = new Vector2(0f, 1f);
			Image component = _panel.GetComponent<Image>();
			((Graphic)component).color = new Color(0.04f, 0.035f, 0.03f, 0.94f);
			((Graphic)component).raycastTarget = false;
			ContentSizeFitter obj = _panel.AddComponent<ContentSizeFitter>();
			obj.horizontalFit = (FitMode)2;
			obj.verticalFit = (FitMode)2;
			VerticalLayoutGroup obj2 = _panel.AddComponent<VerticalLayoutGroup>();
			((LayoutGroup)obj2).padding = new RectOffset(12, 12, 8, 8);
			bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true);
			((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = childControlWidth;
			childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false);
			((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = childControlWidth;
			GameObject val3 = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val3.transform.SetParent(_panel.transform, false);
			_text = Fonts.AddLabel(val3);
			((TMP_Text)_text).fontSize = 16f;
			((Graphic)_text).color = new Color(0.95f, 0.92f, 0.82f, 1f);
			((TMP_Text)_text).alignment = (TextAlignmentOptions)257;
			((TMP_Text)_text).textWrappingMode = (TextWrappingModes)0;
			((Graphic)_text).raycastTarget = false;
			GameObject val4 = new GameObject("Rail", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(LayoutElement)
			});
			val4.transform.SetParent(_panel.transform, false);
			val4.GetComponent<LayoutElement>().ignoreLayout = true;
			RectTransform val5 = (RectTransform)val4.transform;
			val5.anchorMin = new Vector2(0f, 1f);
			val5.anchorMax = new Vector2(1f, 1f);
			val5.pivot = new Vector2(0.5f, 1f);
			val5.sizeDelta = new Vector2(0f, 2f);
			val5.anchoredPosition = Vector2.zero;
			((Graphic)val4.GetComponent<Image>()).color = IconGrid.Bronze;
			((Graphic)val4.GetComponent<Image>()).raycastTarget = false;
			_panel.SetActive(false);
		}
	}
	public enum ClusterClick
	{
		Zoom,
		Inspector,
		Spiderfy
	}
	internal static class Clusters
	{
		private const int MinimumPins = 3;

		private const float RadiusInIcons = 1.1f;

		private const float HysteresisSteps = 0.17f;

		private static readonly Dictionary<PinData, int> Leaders = new Dictionary<PinData, int>();

		private static readonly List<PinData> Members = new List<PinData>();

		private static readonly Dictionary<PinData, List<PinData>> Groups = new Dictionary<PinData, List<PinData>>();

		private static int _level = int.MinValue;

		private static int _signature;

		private static bool _built;

		internal static bool IncludeAll;

		public static bool Active
		{
			get
			{
				if (Plugin.ClusterPins != null)
				{
					return Plugin.ClusterPins.Value;
				}
				return false;
			}
		}

		public static IReadOnlyList<PinData> GroupOf(PinData leader)
		{
			if (leader == null || !Groups.TryGetValue(leader, out var value))
			{
				return null;
			}
			return value;
		}

		public static bool IsMixed(PinData leader)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			IReadOnlyList<PinData> readOnlyList = GroupOf(leader);
			if (readOnlyList == null)
			{
				return false;
			}
			for (int i = 1; i < readOnlyList.Count; i++)
			{
				if (readOnlyList[i].m_type != readOnlyList[0].m_type)
				{
					return true;
				}
			}
			return false;
		}

		public static int CountOf(PinData pin)
		{
			if (pin == null || !Leaders.TryGetValue(pin, out var value))
			{
				return 1;
			}
			return value;
		}

		internal static void Stats(out int leaders, out int members, out int represented)
		{
			leaders = Leaders.Count;
			members = Members.Count;
			represented = 0;
			foreach (int value in Leaders.Values)
			{
				represented += value;
			}
		}

		public static void Measure(List<PinData> pins)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Invalid comparison between Unknown and I4
			Minimap instance = Minimap.instance;
			if (!Active || (Object)(object)instance == (Object)null || (int)instance.m_mode != 2 || pins == null)
			{
				if (Leaders.Count > 0 || Members.Count > 0)
				{
					Leaders.Clear();
					Members.Clear();
					Groups.Clear();
					_built = false;
				}
				return;
			}
			float num = Crowding.IconMetres(instance);
			if (num <= 0f)
			{
				return;
			}
			float num2 = Mathf.Log(num, 2f);
			if (_level == int.MinValue || Mathf.Abs(num2 - (float)_level) > 0.67f)
			{
				_level = Mathf.RoundToInt(num2);
			}
			int num3 = Signature(pins);
			if (!_built || num3 != _signature)
			{
				_built = true;
				_signature = num3;
				Rebuild(pins, Mathf.Pow(2f, (float)_level) * 1.1f);
			}
			foreach (PinData member in Members)
			{
				Crowding.MarkNotDrawn(member);
			}
		}

		private static int Signature(List<PinData> pins)
		{
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected I4, but got Unknown
			int count = pins.Count;
			count = count * 31 + _level;
			count = count * 31 + PinFilter.Text.GetHashCode();
			count = (int)(count * 31 + PinHiding.Cycle);
			count = count * 31 + (Plugin.HiddenPins.Value?.GetHashCode() ?? 0);
			count = count * 31 + Plugin.HidePinsBeyond.Value.GetHashCode();
			count = count * 31 + (Plugin.MergeRepeatedPins.Value ? 1 : 0);
			count = count * 31 + (IncludeAll ? 1 : 0);
			count = count * 31 + (Plugin.MixedCategoryClusters.Value ? 1 : 0);
			foreach (PinData pin in pins)
			{
				if (pin != null)
				{
					count = count * 31 + RuntimeHelpers.GetHashCode(pin);
					count = count * 31 + Mathf.RoundToInt(pin.m_pos.x);
					count = count * 31 + Mathf.RoundToInt(pin.m_pos.z);
					count = count * 31 + pin.m_type;
					count = count * 31 + (pin.m_name?.GetHashCode() ?? 0);
					count = count * 31 + (int)((Crowding.OutOfSight(pin) ? 1u : 0u) | (uint)(pin.m_checked ? 2 : 0) | (uint)((IncludeAll || PinRecord.IsIndexedOurs(pin)) ? 4 : 0) | (uint)((pin.m_worldSize > 0f) ? 8 : 0));
					count = count * 31 + pin.m_ownerID.GetHashCode();
				}
			}
			return count;
		}

		private static void Rebuild(List<PinData> pins, float radius)
		{
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Invalid comparison between Unknown and I4
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			HashSet<PinData> before = new HashSet<PinData>(Leaders.Keys);
			Leaders.Clear();
			Members.Clear();
			Groups.Clear();
			bool value = Plugin.MixedCategoryClusters.Value;
			Dictionary<int, List<PinData>> dictionary = new Dictionary<int, List<PinData>>();
			foreach (PinData pin in pins)
			{
				if (pin != null && !Crowding.OutOfSight(pin) && !(pin.m_worldSize > 0f) && pin.m_ownerID == 0L && !pin.m_checked && (int)pin.m_type != 4 && (int)pin.m_type != 12 && (int)pin.m_type != 5 && (IncludeAll || PinRecord.IsIndexedOurs(pin)) && (!PinFilter.Active || !PinFilter.Matches(pin.m_name)))
				{
					int num = ((value && !IncludeAll) ? PriorityZoom.TierOfKey(PinRecord.KeyOfIndexed(pin)) : 0);
					int key = ((num > 0) ? (-num) : ((int)pin.m_type));
					if (!dictionary.TryGetValue(key, out var value2))
					{
						value2 = (dictionary[key] = new List<PinData>());
					}
					value2.Add(pin);
				}
			}
			foreach (List<PinData> value6 in dictionary.Values)
			{
				if (value6.Count < 3)
				{
					continue;
				}
				value6.Sort((PinData a, PinData b) => (a.m_pos.x == b.m_pos.x) ? a.m_pos.z.CompareTo(b.m_pos.z) : a.m_pos.x.CompareTo(b.m_pos.x));
				Dictionary<long, List<int>> dictionary2 = new Dictionary<long, List<int>>();
				for (int num2 = 0; num2 < value6.Count; num2++)
				{
					long key2 = CellKey(value6[num2].m_pos, radius);
					if (!dictionary2.TryGetValue(key2, out var value3))
					{
						value3 = (dictionary2[key2] = new List<int>());
					}
					value3.Add(num2);
				}
				bool[] array = new bool[value6.Count];
				List<int> list3 = new List<int>();
				List<int> list4 = new List<int>(value6.Count);
				for (int num3 = 0; num3 < value6.Count; num3++)
				{
					if (before.Contains(value6[num3]))
					{
						list4.Add(num3);
					}
				}
				for (int num4 = 0; num4 < value6.Count; num4++)
				{
					if (!before.Contains(value6[num4]))
					{
						list4.Add(num4);
					}
				}
				foreach (int item in list4)
				{
					if (array[item])
					{
						continue;
					}
					array[item] = true;
					list3.Clear();
					int num5 = Mathf.FloorToInt(value6[item].m_pos.x / radius);
					int num6 = Mathf.FloorToInt(value6[item].m_pos.z / radius);
					for (int num7 = -1; num7 <= 1; num7++)
					{
						for (int num8 = -1; num8 <= 1; num8++)
						{
							if (!dictionary2.TryGetValue(Pack(num5 + num7, num6 + num8), out var value4))
							{
								continue;
							}
							foreach (int item2 in value4)
							{
								if (!array[item2])
								{
									float num9 = value6[item2].m_pos.x - value6[item].m_pos.x;
									float num10 = value6[item2].m_pos.z - value6[item].m_pos.z;
									if (num9 * num9 + num10 * num10 <= radius * radius)
									{
										list3.Add(item2);
									}
								}
							}
						}
					}
					int num11 = Crowding.MergedCount(value6[item]);
					foreach (int item3 in list3)
					{
						num11 += Crowding.MergedCount(value6[item3]);
					}
					if (1 + list3.Count < 3)
					{
						continue;
					}
					List<PinData> list5 = new List<PinData> { value6[item] };
					foreach (int item4 in list3)
					{
						array[item4] = true;
						list5.Add(value6[item4]);
					}
					int num12 = list5.FindIndex((PinData p) => before.Contains(p));
					if (num12 > 0)
					{
						PinData value5 = list5[num12];
						list5[num12] = list5[0];
						list5[0] = value5;
					}
					for (int num13 = 1; num13 < list5.Count; num13++)
					{
						Members.Add(list5[num13]);
					}
					Leaders[list5[0]] = num11;
					Groups[list5[0]] = list5;
				}
			}
		}

		private static long CellKey(Vector3 pos, float cell)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			return Pack(Mathf.FloorToInt(pos.x / cell), Mathf.FloorToInt(pos.z / cell));
		}

		private static long Pack(int x, int z)
		{
			return ((long)x << 32) ^ (uint)z;
		}
	}
	internal static class ClusterBadge
	{
		private static readonly ConditionalWeakTable<Image, GameObject> Badges = new ConditionalWeakTable<Image, GameObject>();

		public static void Sync(PinData pin)
		{
			if ((Object)(object)pin?.m_iconElement == (Object)null)
			{
				return;
			}
			if (!Clusters.Active || Clusters.CountOf(pin) <= 1)
			{
				if (Badges.TryGetValue(pin.m_iconElement, out var value))
				{
					if ((Object)(object)value != (Object)null)
					{
						Object.Destroy((Object)(object)value);
					}
					Badges.Remove(pin.m_iconElement);
				}
			}
			else
			{
				if (!Badges.TryGetValue(pin.m_iconElement, out var value2) || (Object)(object)value2 == (Object)null)
				{
					value2 = Create(((Component)pin.m_iconElement).transform);
					Badges.Remove(pin.m_iconElement);
					Badges.Add(pin.m_iconElement, value2);
				}
				Apply(value2, Clusters.CountOf(pin), Clusters.IsMixed(pin));
			}
		}

		private static GameObject Create(Transform marker)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: 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_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_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_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_0179: 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_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Expected O, but got Unknown
			GameObject val = new GameObject("CarturBadge", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(marker, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(1f, 0f);
			val2.anchorMax = val3;
			val2.anchorMin = val3;
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.anchoredPosition = new Vector2(-3f, 5f);
			val2.sizeDelta = new Vector2(20f, 20f);
			Image component = val.GetComponent<Image>();
			component.sprite = IconGrid.Disc();
			((Graphic)component).color = new Color(0.07f, 0.06f, 0.05f, 0.95f);
			((Graphic)component).raycastTarget = false;
			GameObject val4 = new GameObject("Ring", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.transform.SetParent(val.transform, false);
			RectTransform val5 = (RectTransform)val4.transform;
			val5.anchorMin = Vector2.zero;
			val5.anchorMax = Vector2.one;
			val3 = (val5.offsetMin = (val5.offsetMax = Vector2.zero));
			Image component2 = val4.GetComponent<Image>();
			component2.sprite = IconGrid.Ring();
			((Graphic)component2).raycastTarget = false;
			GameObject val7 = new GameObject("Count", new Type[1] { typeof(RectTransform) });
			val7.transform.SetParent(val.transform, false);
			RectTransform val8 = (RectTransform)val7.transform;
			val8.anchorMin = Vector2.zero;
			val8.anchorMax = Vector2.one;
			val8.offsetMin = new Vector2(-4f, 0f);
			val8.offsetMax = new Vector2(4f, 0f);
			TextMeshProUGUI obj = Fonts.AddLabel(val7);
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj).fontSize = 11f;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((Graphic)obj).raycastTarget = false;
			return val;
		}

		private static void Apply(GameObject badge, int count, bool mixed)
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			Color val = (Color)(mixed ? new Color(0.45f, 0.75f, 0.8f, 1f) : ((count >= 100) ? IconGrid.SelectedGold : ((count >= 10) ? IconGrid.Bronze : new Color(0.85f, 0.82f, 0.74f, 1f))));
			Image component = ((Component)badge.transform.Find("Ring")).GetComponent<Image>();
			if (((Graphic)component).color != val)
			{
				((Graphic)component).color = val;
			}
			TextMeshProUGUI componentInChildren = badge.GetComponentInChildren<TextMeshProUGUI>();
			string text = ((count > 99) ? "99+" : count.ToString());
			if (((TMP_Text)componentInChildren).text != text)
			{
				((TMP_Text)componentInChildren).text = text;
			}
			((Graphic)componentInChildren).color = Color.white;
		}
	}
	[HarmonyPatch(typeof(Minimap), "OnMapLeftClick")]
	internal static class Patch_Cluster_LeftClick
	{
		private static readonly FieldInfo MapOffset = AccessTools.Field(typeof(Minimap), "m_mapOffset");

		[HarmonyPriority(800)]
		private static bool Prefix(Minimap __instance)
		{
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			PinData current = PinHover.Current;
			if (!Clusters.Active || current == null || Clusters.CountOf(current) <= 1 || ZInput.GetKey((KeyCode)304, false) || ZInput.GetKey((KeyCode)303, false))
			{
				return true;
			}
			if (Plugin.ClusterClickAction.Value != ClusterClick.Zoom)
			{
				if (Plugin.ClusterClickAction.Value == ClusterClick.Spiderfy && ClusterSpiderfy.Wants(Clusters.GroupOf(current).Count))
				{
					ClusterSpiderfy.Open(__instance, current);
				}
				else
				{
					ClusterInspector.Open(__instance, current);
				}
				return false;
			}
			__instance.LargeZoom = Mathf.Max(__instance.m_minZoom, __instance.LargeZoom * 0.5f);
			if ((Object)(object)Player.m_localPlayer != (Object)null && MapOffset != null)
			{
				MapOffset.SetValue(__instance, current.m_pos - ((Component)Player.m_localPlayer).transform.position);
			}
			return false;
		}
	}
	internal static class ClusterSpiderfy
	{
		private static GameObject _root;

		private static readonly List<GameObject> Spread = new List<GameObject>();

		private static readonly List<GameObject> Legs = new List<GameObject>();

		private static readonly List<RectTransform> Hit = new List<RectTransform>();

		private static PinData _leader;

		private static Vector2 _centre;

		private static float _zoom;

		public static bool IsOpen
		{
			get
			{
				if ((Object)(object)_root != (Object)null)
				{
					return _root.activeSelf;
				}
				return false;
			}
		}

		public static bool Wants(int members)
		{
			if (Plugin.EnableClusterSpiderfy.Value)
			{
				return Plugin.SpiderfyMaxPins.Value >= members;
			}
			return false;
		}

		public static void Open(Minimap map, PinData leader)
		{
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0120: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: 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_01bd: 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_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0219: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_0276: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: 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_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034b: Unknown result type (might be due to invalid IL or missing references)
			//IL_035e: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_0392: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_042c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_0437: Unknown result type (might be due to invalid IL or missing references)
			//IL_0438: 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_0451: 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_0464: 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)
			//IL_04ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: 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: Expected O, but got Unknown
			IReadOnlyList<PinData> group = Clusters.GroupOf(leader);
			Image val = leader?.m_iconElement;
			if (group == null || (Object)(object)val == (Object)null)
			{
				return;
			}
			Close();
			Transform parent = ((Component)val).transform.parent;
			if ((Object)(object)_root == (Object)null || (Object)(object)_root.transform.parent != (Object)(object)parent)
			{
				if ((Object)(object)_root != (Object)null)
				{
					Object.Destroy((Object)(object)_root);
				}
				_root = new GameObject("CarturPins_Spiderfy", new Type[1] { typeof(RectTransform) });
				_root.transform.SetParent(parent, false);
				Spread.Clear();
				Legs.Clear();
			}
			_root.SetActive(true);
			_root.transform.SetAsLastSibling();
			_leader = leader;
			_zoom = map.LargeZoom;
			_centre = Vector2.op_Implicit(((Transform)((Graphic)val).rectTransform).localPosition);
			Hit.Clear();
			Rect rect = ((Graphic)val).rectTransform.rect;
			float num = ((Rect)(ref rect)).width * ((Transform)((Graphic)val).rectTransform).localScale.x;
			float num2 = Mathf.Max(num * 2.4f, (float)group.Count * num * 1.6f / ((float)Math.PI * 2f));
			Vector2 val5 = default(Vector2);
			for (int i = 0; i < group.Count; i++)
			{
				PinData pin = group[i];
				float num3 = (float)Math.PI * 2f * (float)i / (float)group.Count - (float)Math.PI / 2f;
				Vector2 val2 = _centre + new Vector2(Mathf.Cos(num3), Mathf.Sin(num3)) * num2;
				Vector2 val3 = (((Object)(object)pin.m_iconElement != (Object)null) ? Vector2.op_Implicit(((Transform)((Graphic)pin.m_iconElement).rectTransform).localPosition) : _centre);
				RectTransform obj = Get(Legs, "Leg", i, typeof(Image));
				Vector2 val4 = val3 - val2;
				((Vector2)(ref val5))..ctor(0.5f, 0.5f);
				obj.anchorMax = val5;
				obj.anchorMin = val5;
				obj.pivot = new Vector2(0f, 0.5f);
				((Transform)obj).localPosition = Vector2.op_Implicit(val2);
				obj.sizeDelta = new Vector2(((Vector2)(ref val4)).magnitude, 2f);
				((Transform)obj).localRotation = Quaternion.Euler(0f, 0f, Mathf.Atan2(val4.y, val4.x) * 57.29578f);
				Image component = ((Component)obj).GetComponent<Image>();
				((Graphic)component).color = new Color(0.78f, 0.58f, 0.32f, 0.8f);
				((Graphic)component).raycastTarget = false;
				RectTransform val6 = Get(Spread, "Pin", i, typeof(Image), typeof(Button));
				((Vector2)(ref val5))..ctor(0.5f, 0.5f);
				val6.anchorMax = val5;
				val6.anchorMin = val5;
				val6.pivot = new Vector2(0.5f, 0.5f);
				((Transform)val6).localPosition = Vector2.op_Implicit(val2);
				((Transform)val6).localScale = Vector3.one;
				val6.sizeDelta = new Vector2(num * 1.4f, num * 1.4f);
				Image component2 = ((Component)val6).GetComponent<Image>();
				component2.sprite = IconGrid.Disc();
				((Graphic)component2).color = new Color(0.07f, 0.06f, 0.05f, 0.92f);
				((Graphic)component2).raycastTarget = true;
				Transform val7 = ((Transform)val6).Find("Icon");
				if ((Object)(object)val7 == (Object)null)
				{
					GameObject val8 = new GameObject("Icon", new Type[2]
					{
						typeof(RectTransform),
						typeof(Image)
					});
					val8.transform.SetParent((Transform)(object)val6, false);
					RectTransform val9 = (RectTransform)val8.transform;
					((Vector2)(ref val5))..ctor(0.5f, 0.5f);
					val9.anchorMax = val5;
					val9.anchorMin = val5;
					val9.sizeDelta = new Vector2(num, num);
					((Graphic)val8.GetComponent<Image>()).raycastTarget = false;
					val8.GetComponent<Image>().preserveAspect = true;
					val7 = val8.transform;
				}
				Image component3 = ((Component)val7).GetComponent<Image>();
				component3.sprite = (((Object)(object)pin.m_iconElement != (Object)null) ? pin.m_iconElement.sprite : pin.m_icon);
				((Graphic)component3).color = (((Object)(object)pin.m_iconElement != (Object)null) ? ((Graphic)pin.m_iconElement).color : Color.white);
				Button component4 = ((Component)val6).GetComponent<Button>();
				((Selectable)component4).targetGraphic = (Graphic)(object)component2;
				((UnityEventBase)component4.onClick).RemoveAllListeners();
				((UnityEvent)component4.onClick).AddListener((UnityAction)delegate
				{
					Close();
					ClusterInspector.FocusSeparated(map, pin, group);
				});
				Hit.Add(val6);
			}
			for (int num4 = group.Count; num4 < Spread.Count; num4++)
			{
				Spread[num4].SetActive(false);
				Legs[num4].SetActive(false);
			}
			for (int num5 = 0; num5 < group.Count; num5++)
			{
				Legs[num5].transform.SetAsLastSibling();
			}
			for (int num6 = 0; num6 < group.Count; num6++)
			{
				Spread[num6].transform.SetAsLastSibling();
			}
			ClusterPopup.Hide();
		}

		public static void Close()
		{
			if ((Object)(object)_root != (Object)null && _root.activeSelf)
			{
				_root.SetActive(false);
			}
			_leader = null;
		}

		public static void Tick(Minimap map)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			if (!IsOpen)
			{
				return;
			}
			Image val = _leader?.m_iconElement;
			if (!((Object)(object)val == (Object)null))
			{
				Vector2 val2 = Vector2.op_Implicit(((Transform)((Graphic)val).rectTransform).localPosition) - _centre;
				if (!(((Vector2)(ref val2)).sqrMagnitude > 4f) && !(Mathf.Abs(map.LargeZoom / _zoom - 1f) > 0.005f))
				{
					if (ZInput.GetMouseButtonDown(0) && !Over())
					{
						Close();
					}
					return;
				}
			}
			Close();
		}

		private static bool Over()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			foreach (RectTransform item in Hit)
			{
				if ((Object)(object)item != (Object)null && RectTransformUtility.RectangleContainsScreenPoint(item, Vector2.op_Implicit(ZInput.pointerPosition), (Camera)null))
				{
					return true;
				}
			}
			return false;
		}

		private static RectTransform Get(List<GameObject> pool, string name, int i, params Type[] parts)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			while (pool.Count <= i)
			{
				GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) });
				foreach (Type type in parts)
				{
					val.AddComponent(type);
				}
				val.transform.SetParent(_root.transform, false);
				pool.Add(val);
			}
			pool[i].SetActive(true);
			return (RectTransform)pool[i].transform;
		}
	}
	[HarmonyPatch(typeof(Minimap), "SetMapMode")]
	internal static class Patch_Minimap_SetMapMode_Spiderfy
	{
		private static void Postfix(Minimap __instance)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			if ((int)__instance.m_mode != 2)
			{
				ClusterSpiderfy.Close();
			}
		}
	}
	internal sealed class ColourWheel : MonoBehaviour
	{
		private sealed class WheelInput : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler
		{
			public ColourWheel Owner;

			public void OnPointerDown(PointerEventData e)
			{
				Set(e);
			}

			public void OnDrag(PointerEventData e)
			{
				Set(e);
			}

			private void Set(PointerEventData e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				//IL_000e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0039: 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_004b: 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_0054: 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_0065: 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_008a: Unknown result type (might be due to invalid IL or missing references)
				RectTransform val = (RectTransform)((Component)this).transform;
				Vector2 val2 = default(Vector2);
				if (RectTransformUtility.ScreenPointToLocalPointInRectangle(val, e.position, e.pressEventCamera, ref val2))
				{
					float num = 60f;
					float x = val2.x;
					Rect rect = val.rect;
					float num2 = x - ((Rect)(ref rect)).center.x;
					float y = val2.y;
					rect = val.rect;
					Vector2 val3 = new Vector2(num2, y - ((Rect)(ref rect)).center.y) / num;
					float s = Mathf.Min(((Vector2)(ref val3)).magnitude, 1f);
					Owner._h = (Mathf.Atan2(val3.y, val3.x) / ((float)Math.PI * 2f) + 1f) % 1f;
					Owner._s = s;
					Owner.Pick();
				}
			}
		}

		private sealed class BarInput : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IDragHandler
		{
			public ColourWheel Owner;

			public void OnPointerDown(PointerEventData e)
			{
				Set(e);
			}

			public void OnDrag(PointerEventData e)
			{
				Set(e);
			}

			private void Set(PointerEventData e)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Expected O, but got Unknown
				//IL_000e: 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_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_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)
				RectTransform val = (RectTransform)((Component)this).transform;
				Vector2 val2 = default(Vector2);
				if (RectTransformUtility.ScreenPointToLocalPointInRectangle(val, e.position, e.pressEventCamera, ref val2))
				{
					ColourWheel owner = Owner;
					float x = val2.x;
					Rect rect = val.rect;
					float num = x - ((Rect)(ref rect)).xMin;
					rect = val.rect;
					owner._v = Mathf.Clamp01(num / ((Rect)(ref rect)).width);
					Owner.Pick();
				}
			}
		}

		public const float Width = 258f;

		public const float Height = 140f;

		private const int WheelPixels = 128;

		private const float WheelSize = 120f;

		private const float RightX = 134f;

		private const float RightWidth = 124f;

		private static readonly Color Warm = new Color(0.95f, 0.92f, 0.82f, 1f);

		private Action<int> _onPick;

		private float _h;

		private float _s = 1f;

		private float _v = 1f;

		private bool _has;

		private Image _wheel;

		private Image _wheelMark;

		private Image _barMark;

		private Image _preview;

		private TextMeshProUGUI _previewText;

		private Texture2D _barTexture;

		private readonly Image[] _recent = (Image[])(object)new Image[5];

		public const int Recents = 5;

		private static readonly List<Color> RecentList = new List<Color>();

		private static bool _recentLoaded;

		private Color Current => Color.HSVToRGB(_h, _s, _v);

		private static string RecentPath => Path.Combine(Paths.ConfigPath, "carturpins_recent_colours.txt");

		public static IReadOnlyList<Color> Recent
		{
			get
			{
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				if (!_recentLoaded)
				{
					_recentLoaded = true;
					try
					{
						if (File.Exists(RecentPath))
						{
							string[] array = File.ReadAllLines(RecentPath);
							Color item = default(Color);
							foreach (string text in array)
							{
								if (ColorUtility.TryParseHtmlString("#" + text.Trim(), ref item) && RecentList.Count < 5)
								{
									RecentList.Add(item);
								}
							}
						}
					}
					catch (Exception ex)
					{
						Plugin.Log.LogWarning((object)("Could not read the recent colours: " + ex.Message));
					}
				}
				return RecentList;
			}
		}

		public static ColourWheel Build(Transform parent, float y, Action<int> onPick)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_004a: 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_0051: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("ColourWheel", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0f, 1f);
			val2.pivot = val3;
			Vector2 anchorMin = (val2.anchorMax = val3);
			val2.anchorMin = anchorMin;
			val2.anchoredPosition = new Vector2(0f, y);
			val2.sizeDelta = new Vector2(258f, 140f);
			ColourWheel colourWheel = val.AddComponent<ColourWheel>();
			colourWheel._onPick = onPick;
			colourWheel.BuildUi(val2);
			return colourWheel;
		}

		public void Show(int code)
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			_has = code != 0;
			if (_has)
			{
				Color.RGBToHSV(PinStyles.FromCode(code), ref _h, ref _s, ref _v);
			}
			Refresh();
		}

		private void Pick()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			_has = true;
			Refresh();
			_onPick?.Invoke(PinStyles.ToCode(Current));
		}

		private void Refresh()
		{
			//IL_003b: 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_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)
			//IL_00a2: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: 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_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
			float num = _h * (float)Math.PI * 2f;
			float num2 = _s * 60f;
			((Graphic)_wheelMark).rectTransform.anchoredPosition = new Vector2(Mathf.Cos(num) * num2, Mathf.Sin(num) * num2);
			((Behaviour)_wheelMark).enabled = _has;
			((Graphic)_wheel).color = new Color(_v, _v, _v, 1f);
			Color val = Color.HSVToRGB(_h, _s, 1f);
			for (int i = 0; i < ((Texture)_barTexture).width; i++)
			{
				_barTexture.SetPixel(i, 0, Color.Lerp(Color.black, val, (float)i / (float)(((Texture)_barTexture).width - 1)));
			}
			_barTexture.Apply();
			((Graphic)_barMark).rectTransform.anchoredPosition = new Vector2(_v * 124f, 0f);
			((Behaviour)_barMark).enabled = _has;
			((Graphic)_preview).color = (Color)(_has ? Current : new Color(1f, 1f, 1f, 0.12f));
			((TMP_Text)_previewText).text = (_has ? ("#" + ColorUtility.ToHtmlStringRGB(Current)) : "ORIGINAL");
			TextMeshProUGUI previewText = _previewText;
			Color color;
			if (_has)
			{
				Color current = Current;
				if (((Color)(ref current)).grayscale > 0.55f)
				{
					color = Color.black;
					goto IL_01ae;
				}
			}
			color = Warm;
			goto IL_01ae;
			IL_01ae:
			((Graphic)previewText).color = color;
			IReadOnlyList<Color> recent = Recent;
			for (int j = 0; j < _recent.Length; j++)
			{
				((Behaviour)_recent[j]).enabled = j < recent.Count;
				if (j < recent.Count)
				{
					((Graphic)_recent[j]).color = recent[j];
				}
			}
		}

		public static void Remember(int code)
		{
			//IL_000c: 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_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (code == 0)
			{
				return;
			}
			Color c = PinStyles.FromCode(code);
			c.a = 1f;
			_ = Recent;
			RecentList.RemoveAll((Color x) => ColorUtility.ToHtmlStringRGB(x) == ColorUtility.ToHtmlStringRGB(c));
			RecentList.Insert(0, c);
			while (RecentList.Count > 5)
			{
				RecentList.RemoveAt(RecentList.Count - 1);
			}
			try
			{
				List<string> list = new List<string>();
				foreach (Color recent in RecentList)
				{
					list.Add(ColorUtility.ToHtmlStringRGB(recent));
				}
				File.WriteAllLines(RecentPath, list.ToArray());
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Could not write the recent colours: " + ex.Message));
			}
		}

		private void BuildUi(RectTransform root)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Expected O, but got Unknown
			//IL_0163: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: 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_0234: Unknown result type (might be due to invalid IL or missing references)
			//IL_027a: 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_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e4: Expected O, but got Unknown
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0302: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0332: Unknown result type (might be due to invalid IL or missing references)
			//IL_0342: Unknown result type (might be due to invalid IL or missing references)
			//IL_0347: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Expected O, but got Unknown
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0377: Unknown result type (might be due to invalid IL or missing references)
			//IL_0386: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: 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_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0481: Unknown result type (might be due to invalid IL or missing references)
			//IL_0499: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: 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_04cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0517: Unknown result type (might be due to invalid IL or missing references)
			//IL_0521: Expected O, but got Unknown
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_0572: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Expected O, but got Unknown
			Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			float num = 64f;
			for (int i = 0; i < 128; i++)
			{
				for (int j = 0; j < 128; j++)
				{
					float num2 = ((float)j + 0.5f - num) / num;
					float num3 = ((float)i + 0.5f - num) / num;
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					Color val2 = Color.HSVToRGB((Mathf.Atan2(num3, num2) / ((float)Math.PI * 2f) + 1f) % 1f, Mathf.Min(num4, 1f), 1f);
					val2.a = Mathf.Clamp01((1f - num4) * num * 0.5f);
					val.SetPixel(j, i, val2);
				}
			}
			val.Apply();
			Sprite sprite = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f);
			GameObject val3 = new GameObject("Wheel", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(WheelInput)
			});
			val3.transform.SetParent((Transform)(object)root, false);
			RectTransform val4 = (RectTransform)val3.transform;
			Vector2 val5 = default(Vector2);
			((Vector2)(ref val5))..ctor(0f, 1f);
			val4.pivot = val5;
			Vector2 val6 = (val4.anchorMin = (val4.anchorMax = val5));
			val4.anchoredPosition = new Vector2(2f, -2f);
			val4.sizeDelta = new Vector2(120f, 120f);
			_wheel = val3.GetComponent<Image>();
			_wheel.sprite = sprite;
			val3.GetComponent<WheelInput>().Owner = this;
			_wheelMark = Ring(val3.transform, 12f);
			float num5 = -2f;
			_preview = Box((Transform)(object)root, "Preview", new Vector2(134f, num5), new Vector2(124f, 24f), new Color(1f, 1f, 1f, 0.12f));
			_previewText = LabelOn(((Component)_preview).transform, 13f, (TextAlignmentOptions)514);
			num5 -= 32f;
			LabelAt((Transform)(object)root, "BRIGHTNESS", new Vector2(134f, num5), 9f);
			num5 -= 12f;
			GameObject val9 = new GameObject("Bar", new Type[3]
			{
				typeof(RectTransform),
				typeof(RawImage),
				typeof(BarInput)
			});
			val9.transform.SetParent((Transform)(object)root, false);
			RectTransform val10 = (RectTransform)val9.transform;
			((Vector2)(ref val5))..ctor(0f, 1f);
			val10.pivot = val5;
			val6 = (val10.anchorMin = (val10.anchorMax = val5));
			val10.anchoredPosition = new Vector2(134f, num5);
			val10.sizeDelta = new Vector2(124f, 16f);
			_barTexture = new Texture2D(32, 1, (TextureFormat)4, false)
			{
				wrapMode = (TextureWrapMode)1
			};
			val9.GetComponent<RawImage>().texture = (Texture)(object)_barTexture;
			val9.GetComponent<BarInput>().Owner = this;
			_barMark = Box((Transform)(object)val10, "Mark", Vector2.zero, new Vector2(4f, 22f), Warm);
			RectTransform rectTransform = ((Graphic)_barMark).rectTransform;
			RectTransform rectTransform2 = ((Graphic)_barMark).rectTransform;
			((Vector2)(ref val6))..ctor(0f, 0.5f);
			rectTransform2.anchorMax = val6;
			rectTransform.anchorMin = val6;
			((Graphic)_barMark).rectTransform.pivot = new Vector2(0.5f, 0.5f);
			((Graphic)_barMark).raycastTarget = false;
			num5 -= 26f;
			LabelAt((Transform)(object)root, "LAST USED", new Vector2(134f, num5), 9f);
			num5 -= 12f;
			for (int k = 0; k < 5; k++)
			{
				int index = k;
				Image val13 = Box((Transform)(object)root, "Recent" + k, new Vector2(134f + (float)k * 25f, num5), new Vector2(21f, 21f), Color.white);
				Image obj = Box(((Component)val13).transform, "Frame", Vector2.zero, Vector2.zero, IconGrid.Resting);
				obj.sprite = IconGrid.Border;
				obj.type = (Type)1;
				((Graphic)obj).raycastTarget = false;
				RectTransform rectTransform3 = ((Graphic)obj).rectTransform;
				rectTransform3.anchorMin = Vector2.zero;
				rectTransform3.anchorMax = Vector2.one;
				val6 = (rectTransform3.offsetMin = (rectTransform3.offsetMax = Vector2.zero));
				Button obj2 = ((Component)val13).gameObject.AddComponent<Button>();
				((Selectable)obj2).targetGraphic = (Graphic)(object)val13;
				((UnityEvent)obj2.onClick).AddListener((UnityAction)delegate
				{
					//IL_001c: Unknown result type (might be due to invalid IL or missing references)
					IReadOnlyList<Color> recent = Recent;
					if (index < recent.Count)
					{
						Color.RGBToHSV(recent[index], ref _h, ref _s, ref _v);
						Pick();
					}
				});
				((Component)val13).gameObject.AddComponent<CellHover>().Bind(null);
				_recent[k] = val13;
			}
			num5 -= 28f;
			Image val15 = Box((Transform)(object)root, "Original", new Vector2(134f, num5), new Vector2(124f, 22f), new Color(0.18f, 0.14f, 0.1f, 0.95f));
			((TMP_Text)LabelOn(((Component)val15).transform, 12f, (TextAlignmentOptions)514)).text = "ORIGINAL";
			Button obj3 = ((Component)val15).gameObject.AddComponent<Button>();
			((Selectable)obj3).targetGraphic = (Graphic)(object)val15;
			((UnityEvent)obj3.onClick).AddListener((UnityAction)delegate
			{
				_has = false;
				Refresh();
				_onPick?.Invoke(0);
			});
			((Component)val15).gameObject.AddComponent<CellHover>().Bind(null);
			Refresh();
		}

		private static Image Ring(Transform parent, float size)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//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_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			Image val = Box(parent, "Mark", Vector2.zero, new Vector2(size, size), Color.white);
			val.sprite = IconGrid.Border;
			val.type = (Type)1;
			((Graphic)val).raycastTarget = false;
			RectTransform rectTransform = ((Graphic)val).rectTransform;
			RectTransform rectTransform2 = ((Graphic)val).rectTransform;
			Vector2 val2 = default(Vector2);
			((Vector2)(ref val2))..ctor(0.5f, 0.5f);
			rectTransform2.anchorMax = val2;
			rectTransform.anchorMin = val2;
			((Graphic)val).rectTransform.pivot = new Vector2(0.5f, 0.5f);
			return val;
		}

		private static Image Box(Transform parent, string name, Vector2 at, Vector2 size, Color color)
		{
			//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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_0040: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_0066: 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_006d: 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)
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0f, 1f);
			val2.pivot = val3;
			Vector2 anchorMin = (val2.anchorMax = val3);
			val2.anchorMin = anchorMin;
			val2.anchoredPosition = at;
			val2.sizeDelta = size;
			Image component = val.GetComponent<Image>();
			((Graphic)component).color = color;
			return component;
		}

		private static TextMeshProUGUI LabelOn(Transform parent, float size, TextAlignmentOptions align)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: 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_0051: 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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_006b: 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)
			GameObject val = new GameObject("Text", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			Vector2 offsetMin = (val2.offsetMax = Vector2.zero);
			val2.offsetMin = offsetMin;
			TextMeshProUGUI obj = Fonts.AddLabel(val);
			((TMP_Text)obj).fontSize = size;
			((TMP_Text)obj).alignment = align;
			((Graphic)obj).color = Warm;
			((Graphic)obj).raycastTarget = false;
			return obj;
		}

		private static void LabelAt(Transform parent, string text, Vector2 at, float size)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: 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_007d: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Label", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parent, false);
			RectTransform val2 = (RectTransform)val.transform;
			Vector2 val3 = default(Vector2);
			((Vector2)(ref val3))..ctor(0f, 1f);
			val2.pivot = val3;
			Vector2 anchorMin = (val2.anchorMax = val3);
			val2.anchorMin = anchorMin;
			val2.anchoredPosition = at;
			val2.sizeDelta = new Vector2(124f, 12f);
			TextMeshProUGUI obj = Fonts.AddLabel(val);
			((TMP_Text)obj).text = text;
			((TMP_Text)obj).fontSize = size;
			((TMP_Text)obj).characterSpacing = 4f;
			((Graphic)obj).color = new Color(0.95f, 0.92f, 0.82f, 0.55f);
			((TMP_Text)obj).alignment = (TextAlignmentOptions)4097;
			((Graphic)obj).raycastTarget = false;
		}
	}
	internal sealed class ConfigurationManagerAttributes
	{
		public bool? Browsable;

		public bool? IsAdvanced;

		public int? Order;

		public Action<ConfigEntryBase> CustomDrawer;

		public string DispName;

		public ConfigurationManagerAttributes Copy()
		{
			return (ConfigurationManagerAttributes)MemberwiseClone();
		}
	}