Decompiled source of Pinnacle v1.11.0

Pinnacle.dll

Decompiled 2 weeks 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.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ComfyLib;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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: AssemblyTitle("Pinnacle")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Pinnacle")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8d534f00-8286-4b0e-b2bc-a7669730bbca")]
[assembly: AssemblyFileVersion("1.11.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.11.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Pinnacle
{
	public static class CenterMapHelper
	{
		private static Coroutine _centerMapCoroutine;

		public static void CenterMapOnPosition(Vector3 targetPosition)
		{
			//IL_0034: 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)
			if (Object.op_Implicit((Object)(object)Minimap.m_instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				if (_centerMapCoroutine != null)
				{
					((MonoBehaviour)Minimap.m_instance).StopCoroutine(_centerMapCoroutine);
				}
				_centerMapCoroutine = ((MonoBehaviour)Minimap.m_instance).StartCoroutine(CenterMapCoroutine(targetPosition - ((Component)Player.m_localPlayer).transform.position, PluginConfig.CenterMapLerpDuration.Value));
			}
		}

		private static IEnumerator CenterMapCoroutine(Vector3 targetPosition, float lerpDuration)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			float timeElapsed = 0f;
			Vector3 startPosition = Minimap.m_instance.m_mapOffset;
			while (timeElapsed < lerpDuration)
			{
				float num = timeElapsed / lerpDuration;
				num = num * num * (3f - 2f * num);
				Minimap.m_instance.m_mapOffset = Vector3.Lerp(startPosition, targetPosition, num);
				timeElapsed += Time.deltaTime;
				yield return null;
			}
			Minimap.m_instance.m_mapOffset = targetPosition;
		}
	}
	public static class ExportPinsCommand
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ConsoleEventFailable <0>__ExportPinsToBinaryFile;

			public static ConsoleEventFailable <1>__ExportPinsToTextFile;
		}

		[ComfyCommand]
		public static IEnumerable<ConsoleCommand> Register()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			ConsoleCommand[] array = new ConsoleCommand[2];
			object obj = <>O.<0>__ExportPinsToBinaryFile;
			if (obj == null)
			{
				ConsoleEventFailable val = ExportPinsToBinaryFile;
				<>O.<0>__ExportPinsToBinaryFile = val;
				obj = (object)val;
			}
			array[0] = new ConsoleCommand("pinnacle-exportpins-binary", "<filename> [name-filter-regex] -- export pins to a file in binary format.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
			object obj2 = <>O.<1>__ExportPinsToTextFile;
			if (obj2 == null)
			{
				ConsoleEventFailable val2 = ExportPinsToTextFile;
				<>O.<1>__ExportPinsToTextFile = val2;
				obj2 = (object)val2;
			}
			array[1] = new ConsoleCommand("pinnacle-exportpins-text", "<filename> [name-filter-regex] -- export pins to a file in plain text format.", (ConsoleEventFailable)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
			return new <>z__ReadOnlyArray<ConsoleCommand>((ConsoleCommand[])(object)array);
		}

		public static object ExportPinsToBinaryFile(ConsoleEventArgs args)
		{
			PinImportExport.ExportPinsToFile(args, PinImportExport.PinFileFormat.Binary);
			return true;
		}

		public static object ExportPinsToTextFile(ConsoleEventArgs args)
		{
			PinImportExport.ExportPinsToFile(args, PinImportExport.PinFileFormat.PlainText);
			return true;
		}
	}
	public static class ImportPinsCommand
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ConsoleEvent <0>__ImportPinsFromBinaryFile;
		}

		[ComfyCommand]
		public static ConsoleCommand Register()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			object obj = <>O.<0>__ImportPinsFromBinaryFile;
			if (obj == null)
			{
				ConsoleEvent val = PinImportExport.ImportPinsFromBinaryFile;
				<>O.<0>__ImportPinsFromBinaryFile = val;
				obj = (object)val;
			}
			return new ConsoleCommand("pinnacle-importpins-binary", "<filename> [name-filter-regex] -- import pins in binary format from file.", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
		}
	}
	public static class RemoveAllPinsCommand
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ConsoleEventFailable <0>__Run;
		}

		[ComfyCommand]
		public static ConsoleCommand Register()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Expected O, but got Unknown
			object obj = <>O.<0>__Run;
			if (obj == null)
			{
				ConsoleEventFailable val = Run;
				<>O.<0>__Run = val;
				obj = (object)val;
			}
			return new ConsoleCommand("pinnacle-remove-all-pins", "(Pinnacle) Removes ALL pins.", (ConsoleEventFailable)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
		}

		public static object Run(ConsoleEventArgs args)
		{
			if (Object.op_Implicit((Object)(object)Minimap.m_instance))
			{
				return false;
			}
			int num = Minimap.m_instance.m_pins.RemoveAll((PinData pin) => pin.m_save);
			args.Context.AddString($"Removed {num} pins.");
			return true;
		}
	}
	public static class PinImportExport
	{
		public enum PinFileFormat
		{
			Binary,
			PlainText
		}

		public static void ExportPinsToFile(ConsoleEventArgs args, PinFileFormat exportFormat)
		{
			if (Object.op_Implicit((Object)(object)Minimap.m_instance))
			{
				object arg = ((args.Length >= 2) ? args[1] : DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString());
				object arg2 = Minimap.MAPVERSION;
				string text = string.Format("Pinnacle/{0}.v{1}.{2}", arg, arg2, exportFormat switch
				{
					PinFileFormat.Binary => "pins", 
					PinFileFormat.PlainText => "pins.txt", 
					_ => string.Empty, 
				});
				Directory.CreateDirectory(Path.GetDirectoryName(text));
				IReadOnlyCollection<PinData> readOnlyCollection = FilterPins(Minimap.m_instance.m_pins, (args.Length >= 3) ? args[2] : string.Empty);
				Pinnacle.LogInfo($"Exporting {readOnlyCollection.Count} pins to file: {text}");
				Pinnacle.LogInfo($"Exported {exportFormat switch
				{
					PinFileFormat.Binary => ExportPinsToBinaryFile(readOnlyCollection, text), 
					PinFileFormat.PlainText => ExportPinsToTextFile(readOnlyCollection, text), 
					_ => 0, 
				}} pins to file: {text} ");
			}
		}

		private static int ExportPinsToBinaryFile(IReadOnlyCollection<PinData> pins, string filename)
		{
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected I4, but got Unknown
			using FileStream output = new FileStream(filename, FileMode.CreateNew);
			using BinaryWriter binaryWriter = new BinaryWriter(output);
			int num = 0;
			binaryWriter.Write(pins.Count);
			foreach (PinData pin in pins)
			{
				if (pin.m_save)
				{
					binaryWriter.Write(pin.m_name);
					binaryWriter.Write(pin.m_pos.x);
					binaryWriter.Write(pin.m_pos.y);
					binaryWriter.Write(pin.m_pos.z);
					binaryWriter.Write((int)pin.m_type);
					binaryWriter.Write(pin.m_checked);
					binaryWriter.Write(pin.m_ownerID);
					binaryWriter.Write(pin.m_author);
					num++;
				}
			}
			return num;
		}

		private static int ExportPinsToTextFile(IReadOnlyCollection<PinData> pins, string filename)
		{
			//IL_0091: Unknown result type (might be due to invalid IL or missing references)
			using StreamWriter streamWriter = File.CreateText(filename);
			int num = 0;
			foreach (PinData pin in pins)
			{
				if (pin.m_save)
				{
					streamWriter.Write("\"" + pin.m_name + "\",");
					streamWriter.Write($"{pin.m_pos.x},{pin.m_pos.y},{pin.m_pos.z},");
					streamWriter.Write($"{pin.m_type},{pin.m_checked},{pin.m_ownerID},{pin.m_author}");
					streamWriter.WriteLine();
					num++;
				}
			}
			return num;
		}

		public static void ImportPinsFromBinaryFile(ConsoleEventArgs args)
		{
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: 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_0134: 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_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)Minimap.m_instance) || args.Length < 2)
			{
				return;
			}
			string text = "Pinnacle/" + args[1];
			if (!File.Exists(text))
			{
				args.Context.AddString("Could not find file: " + text);
				return;
			}
			Dictionary<PinType, Sprite> dictionary = Minimap.m_instance.m_icons.ToDictionary((SpriteData data) => data.m_name, (SpriteData data) => data.m_icon);
			using FileStream input = new FileStream(text, FileMode.Open);
			using BinaryReader binaryReader = new BinaryReader(input);
			int num = binaryReader.ReadInt32();
			List<PinData> list = new List<PinData>(num);
			Pinnacle.LogInfo($"Reading {num} pins from file: {text}");
			for (int i = 0; i < num; i++)
			{
				PinData val = new PinData
				{
					m_name = binaryReader.ReadString(),
					m_pos = new Vector3
					{
						x = binaryReader.ReadSingle(),
						y = binaryReader.ReadSingle(),
						z = binaryReader.ReadSingle()
					},
					m_type = (PinType)binaryReader.ReadInt32(),
					m_checked = binaryReader.ReadBoolean(),
					m_ownerID = binaryReader.ReadInt64(),
					m_author = binaryReader.ReadString(),
					m_save = true
				};
				dictionary.TryGetValue(val.m_type, out val.m_icon);
				list.Add(val);
			}
			if (args.Length >= 3)
			{
				list = FilterPins(list, args[2]);
			}
			Pinnacle.LogInfo($"Imported {list.Count} pins from file: {text}");
			Minimap.m_instance.m_pins.AddRange(list);
		}

		private static List<PinData> FilterPins(IReadOnlyCollection<PinData> pins, string nameRegexPattern)
		{
			if (nameRegexPattern.Length > 0)
			{
				Pinnacle.LogInfo($"Filtering {pins.Count} pins by pin.name with regex: {nameRegexPattern}");
				Regex regex = new Regex(nameRegexPattern, RegexOptions.CultureInvariant, TimeSpan.FromSeconds(1.0));
				return pins.Where((PinData pin) => pin.m_save && regex.Match(pin.m_name).Success).ToList();
			}
			return pins.Where((PinData pin) => pin.m_save).ToList();
		}
	}
	public static class PinListPanelController
	{
		public static PinListPanel PinListPanel { get; private set; }

		public static void TogglePanel()
		{
			PinListPanel pinListPanel = PinListPanel;
			bool? obj;
			if (pinListPanel == null)
			{
				obj = null;
			}
			else
			{
				GameObject obj2 = pinListPanel.Panel.Ref<GameObject>();
				obj = ((obj2 != null) ? new bool?(!obj2.activeSelf) : null);
			}
			bool? flag = obj;
			TogglePanel(flag.GetValueOrDefault());
		}

		public static void TogglePanel(bool toggleOn)
		{
			//IL_0048: 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_0070: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)PinListPanel?.Panel))
			{
				PinListPanel = new PinListPanel(Minimap.m_instance.m_largeRoot.transform);
				PinListPanel.PanelRectTransform.SetAnchorMin(new Vector2(0f, 0.5f)).SetAnchorMax(new Vector2(0f, 0.5f)).SetPivot(new Vector2(0f, 0.5f))
					.SetPosition(PluginConfig.PinListPanelPosition.Value)
					.SetSizeDelta(PluginConfig.PinListPanelSizeDelta.Value);
				PinListPanel.PanelDragger.OnPanelEndDrag += OnPanelDragEnd;
				PinListPanel.PanelResizer.OnPanelEndResize += OnPanelResizeEnd;
			}
			if (toggleOn)
			{
				PinListPanel.Panel.SetActive(true);
				PinListPanel.SetTargetPins();
			}
			else
			{
				PinListPanel.PinNameFilter.InputField.DeactivateInputField(false);
				PinListPanel.Panel.SetActive(false);
			}
		}

		public static bool IsPanelValid()
		{
			return Object.op_Implicit((Object)(object)PinListPanel?.Panel);
		}

		public static void SetBackgroundColor(Color color)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (IsPanelValid())
			{
				((Graphic)PinListPanel.PanelBackground).color = color;
			}
		}

		public static void SetPanelPosition(Vector2 position)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (IsPanelValid())
			{
				PinListPanel.PanelRectTransform.anchoredPosition = position;
			}
		}

		public static void SetPanelSize(Vector2 sizeDelta)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (IsPanelValid())
			{
				PinListPanel.PanelRectTransform.sizeDelta = sizeDelta;
				PinListPanel.SetTargetPins();
			}
		}

		public static void SetScrollRectMovementType(MovementType movementType)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (IsPanelValid())
			{
				PinListPanel.ScrollRect.movementType = movementType;
			}
		}

		private static void OnPanelDragEnd(object sender, Vector3 position)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			PluginConfig.PinListPanelPosition.Value = Vector2.op_Implicit(position);
		}

		private static void OnPanelResizeEnd(object sender, Vector2 sizeDelta)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			PluginConfig.PinListPanelSizeDelta.Value = sizeDelta;
		}
	}
	public static class PinMarkerUtils
	{
		public static void SetupPinNamePrefab(Minimap minimap)
		{
			TMP_Text componentInChildren = minimap.m_pinNamePrefab.GetComponentInChildren<TMP_Text>();
			componentInChildren.enableAutoSizing = false;
			componentInChildren.richText = true;
			SetPinNameFont();
			SetPinNameFontSize();
		}

		public static void SetPinNameFont()
		{
			if (!Object.op_Implicit((Object)(object)Minimap.m_instance))
			{
				return;
			}
			TMP_FontAsset fontAssetByName = UIResources.GetFontAssetByName(PluginConfig.PinFont.Value);
			foreach (TMP_Text pinNameLabel in GetPinNameLabels(Minimap.m_instance))
			{
				pinNameLabel.font = fontAssetByName;
			}
		}

		public static void SetPinNameFontSize()
		{
			if (!Object.op_Implicit((Object)(object)Minimap.m_instance))
			{
				return;
			}
			float fontSize = PluginConfig.PinFontSize.Value;
			foreach (TMP_Text pinNameLabel in GetPinNameLabels(Minimap.m_instance))
			{
				pinNameLabel.fontSize = fontSize;
			}
		}

		private static IEnumerable<TMP_Text> GetPinNameLabels(Minimap minimap)
		{
			TMP_Text[] componentsInChildren = minimap.m_pinNamePrefab.GetComponentsInChildren<TMP_Text>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				yield return componentsInChildren[i];
			}
			componentsInChildren = ((Component)minimap.m_pinNameRootLarge).GetComponentsInChildren<TMP_Text>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				yield return componentsInChildren[i];
			}
		}
	}
	public static class PinnacleUtils
	{
		public static void CenterMapOnOrTeleportTo(PinData targetPin)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			if (PluginConfig.IsModEnabled.Value && ((Terminal)Console.m_instance).IsCheatsEnabled() && Object.op_Implicit((Object)(object)Player.m_localPlayer) && ZInput.GetKey((KeyCode)304, true))
			{
				TeleportTo(targetPin);
				return;
			}
			Pinnacle.TogglePinEditPanel(PluginConfig.PinListPanelEditPinOnRowClick.Value ? targetPin : null);
			CenterMapHelper.CenterMapOnPosition(targetPin.m_pos);
		}

		public static void TeleportTo(PinData targetPin)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Invalid comparison between Unknown and I4
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			Vector3 targetPosition = targetPin.m_pos;
			if ((int)targetPin.m_type == 10 && !targetPin.m_save && !targetPin.m_checked)
			{
				targetPosition = GetPlayerInfoPosition(targetPin);
			}
			TeleportTo(targetPosition);
		}

		public static Vector3 GetPlayerInfoPosition(PinData targetPin)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			string name = targetPin.m_name;
			foreach (PlayerInfo player in ZNet.m_instance.m_players)
			{
				if (player.m_name == name && player.m_publicPosition)
				{
					Pinnacle.LogInfo($"Found PlayerInfo for {player.m_name}: {targetPin.m_pos:F0} -> {player.m_position:F0}");
					return player.m_position;
				}
			}
			return targetPin.m_pos;
		}

		public static void TeleportTo(Vector3 targetPosition)
		{
			//IL_0019: 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_004d: 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_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Player localPlayer = Player.m_localPlayer;
			if (!Object.op_Implicit((Object)(object)localPlayer))
			{
				Pinnacle.LogWarning("No local Player found.");
				return;
			}
			if (Mathf.Approximately(targetPosition.y, 0f))
			{
				targetPosition.y = GetHeight(targetPosition);
			}
			Pinnacle.LogInfo($"Teleporting player from {((Component)localPlayer).transform.position:F0} to {targetPosition:F0}.");
			((Character)localPlayer).TeleportTo(targetPosition, ((Component)localPlayer).transform.rotation, true);
			Minimap.m_instance.SetMapMode((MapMode)1);
		}

		public static float GetHeight(Vector3 targetPosition)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			float num = default(float);
			if (!Heightmap.GetHeight(targetPosition, ref num))
			{
				num = GetHeightmapData(targetPosition).m_baseHeights[0];
			}
			return Mathf.Max(0f, num);
		}

		public static HMBuildData GetHeightmapData(Vector3 targetPosition)
		{
			//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)
			//IL_0013: Expected O, but got Unknown
			HMBuildData val = new HMBuildData(targetPosition, 1, 1f, false, WorldGenerator.m_instance);
			HeightmapBuilder.m_instance.Build(val);
			return val;
		}

		public static PinData AddNewPin(Minimap minimap, Vector3 targetPosition)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (Mathf.Approximately(targetPosition.y, 0f))
			{
				targetPosition.y = GetHeight(targetPosition);
			}
			return minimap.AddPin(targetPosition, minimap.m_selectedType, string.Empty, true, false, 0L, "");
		}
	}
	public sealed class LabelButton
	{
		public GameObject Container { get; private set; }

		public RectTransform RectTransform { get; private set; }

		public TMP_Text Label { get; private set; }

		public Button Button { get; private set; }

		public LabelButton(Transform parentTransform)
		{
			Container = CreateContainer(parentTransform);
			RectTransform = Container.GetComponent<RectTransform>();
			Label = CreateLabel(Container.transform);
			Button = CreateButton(Container);
		}

		private static GameObject CreateContainer(Transform parentTransform)
		{
			//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_0045: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			GameObject val = new GameObject("Button", new Type[1] { typeof(RectTransform) });
			val.transform.SetParent(parentTransform, false);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("button"))
				.SetColor(Color.white);
			val.GetComponent<RectTransform>().SetAnchorMin(new Vector2(0.5f, 0.5f)).SetAnchorMax(new Vector2(0.5f, 0.5f))
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(new Vector2(120f, 45f));
			return val;
		}

		private static TMP_Text CreateLabel(Transform parentTransform)
		{
			//IL_002b: 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_0049: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((TMP_Text)(object)obj).SetFontSize<TMP_Text>(16f).SetAlignment<TMP_Text>((TextAlignmentOptions)514).SetText("Button");
			((TMP_Text)obj).rectTransform.SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one).SetPivot(new Vector2(0.5f, 0.5f))
				.SetPosition(Vector2.zero)
				.SetSizeDelta(Vector2.zero);
			return (TMP_Text)(object)obj;
		}

		private static Button CreateButton(GameObject container)
		{
			//IL_000f: 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)
			Button obj = container.AddComponent<Button>();
			Button selectable = obj.SetTransition<Button>((Transition)2);
			SpriteState spriteState = default(SpriteState);
			((SpriteState)(ref spriteState)).disabledSprite = UIResources.GetSprite("button_disabled");
			((SpriteState)(ref spriteState)).highlightedSprite = UIResources.GetSprite("button_highlight");
			((SpriteState)(ref spriteState)).pressedSprite = UIResources.GetSprite("button_pressed");
			((SpriteState)(ref spriteState)).selectedSprite = UIResources.GetSprite("button_highlight");
			selectable.SetSpriteState<Button>(spriteState);
			return obj;
		}
	}
	[HarmonyPatch(typeof(Game))]
	internal static class GamePatch
	{
		[HarmonyTranspiler]
		[HarmonyPatch("UpdateNoMap")]
		private static IEnumerable<CodeInstruction> UpdateNoMapTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[4]
			{
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_1, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Br, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_0, (object)null, (string)null),
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(Minimap), "SetMapMode", (Type[])null, (Type[])null), (string)null)
			}).ThrowIfInvalid("Could not patch Game.UpdateNoMap()! (SetMapMode)")
				.Advance(1)
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(GamePatch), "SetMapModeDelegate", (Type[])null, (Type[])null))
				})
				.InstructionEnumeration();
		}

		private static MapMode SetMapModeDelegate(MapMode mapMode)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Invalid comparison between Unknown and I4
			if (PluginConfig.IsModEnabled.Value && !Game.m_noMap && (int)Minimap.m_instance.m_mode == 2)
			{
				return (MapMode)2;
			}
			return mapMode;
		}
	}
	[HarmonyPatch(typeof(Minimap))]
	internal static class MinimapPatch
	{
		[HarmonyWrapSafe]
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void StartPostfix(Minimap __instance)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				PinMarkerUtils.SetupPinNamePrefab(__instance);
				Pinnacle.TogglePinEditPanel();
				PinListPanelController.TogglePanel(toggleOn: false);
				Pinnacle.TogglePinFilterPanel(toggleOn: true);
				Pinnacle.ToggleVanillaIconPanels(toggleOn: false);
				Pinnacle.PinFilterPanel?.UpdatePinIconFilters();
			}
		}

		[HarmonyTranspiler]
		[HarmonyPatch("OnMapDblClick")]
		private static IEnumerable<CodeInstruction> OnMapDblClickTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(Minimap), "m_selectedType"), (string)null),
				new CodeMatch((OpCode?)OpCodes.Ldc_I4_4, (object)null, (string)null)
			}).ThrowIfInvalid("Could not patch Minimap.OnMapDblClick()! (m_selectedType)")
				.Advance(2)
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Func<int, int>>((Func<int, int>)OnMapDblClickSelectedTypeDelegate) })
				.InstructionEnumeration();
		}

		private static int OnMapDblClickSelectedTypeDelegate(int pinTypeDeath)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				return -1;
			}
			return pinTypeDeath;
		}

		[HarmonyPrefix]
		[HarmonyPatch("OnMapLeftClick")]
		private static bool OnMapLeftClickPrefix(ref Minimap __instance)
		{
			//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)
			if (PluginConfig.IsModEnabled.Value && ((Terminal)Console.m_instance).IsCheatsEnabled() && Object.op_Implicit((Object)(object)Player.m_localPlayer) && ZInput.GetKey((KeyCode)304, true))
			{
				Vector3 targetPosition = __instance.ScreenToWorldPoint(Input.mousePosition);
				__instance.SetMapMode((MapMode)1);
				__instance.m_smallRoot.SetActive(true);
				PinnacleUtils.TeleportTo(targetPosition);
				return false;
			}
			return true;
		}

		[HarmonyTranspiler]
		[HarmonyPatch("OnMapLeftClick")]
		private static IEnumerable<CodeInstruction> OnMapLeftClickTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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_003b: Expected O, but got Unknown
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[2]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Minimap), "GetClosestPin", (Type[])null, (Type[])null), (string)null),
				new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null)
			}).ThrowIfInvalid("Could not patch Minimap.OnMapLeftClick()! (GetClosestPin)")
				.Advance(1)
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[1] { Transpilers.EmitDelegate<Func<PinData, PinData>>((Func<PinData, PinData>)GetClosestPinDelegate) })
				.InstructionEnumeration();
		}

		private static PinData GetClosestPinDelegate(PinData closestPin)
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				Pinnacle.TogglePinEditPanel(closestPin);
				return null;
			}
			return closestPin;
		}

		[HarmonyTranspiler]
		[HarmonyPatch("Update")]
		private static IEnumerable<CodeInstruction> UpdateTranspiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0002: 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_003b: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			return new CodeMatcher(instructions, (ILGenerator)null).Start().MatchStartForward((CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Call, (object)AccessTools.Method(typeof(Minimap), "InTextInput", (Type[])null, (Type[])null), (string)null)
			}).ThrowIfInvalid("Could not patch Minimap.Update()! (InTextInput)")
				.InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					Transpilers.EmitDelegate<Action<Minimap>>((Action<Minimap>)InTextInputPreDelegate)
				})
				.InstructionEnumeration();
		}

		private static void InTextInputPreDelegate(Minimap minimap)
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if (PluginConfig.IsModEnabled.Value && (int)minimap.m_mode == 2)
			{
				KeyboardShortcut value = PluginConfig.PinListPanelToggleShortcut.Value;
				if (((KeyboardShortcut)(ref value)).IsDown())
				{
					PinListPanelController.TogglePanel();
				}
				value = PluginConfig.AddPinAtMouseShortcut.Value;
				if (((KeyboardShortcut)(ref value)).IsDown())
				{
					minimap.OnMapDblClick();
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("InTextInput")]
		private static void InTextInputPostfix(ref bool __result)
		{
			if (PluginConfig.IsModEnabled.Value && !__result)
			{
				if (Object.op_Implicit((Object)(object)Pinnacle.PinEditPanel?.Panel) && Pinnacle.PinEditPanel.Panel.activeSelf && Pinnacle.PinEditPanel.HasFocus())
				{
					__result = true;
				}
				else if (Object.op_Implicit((Object)(object)PinListPanelController.PinListPanel?.Panel) && PinListPanelController.PinListPanel.HasFocus())
				{
					__result = true;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("UpdateMap")]
		private static void UpdateMapPrefix(ref bool takeInput)
		{
			if (PluginConfig.IsModEnabled.Value && Object.op_Implicit((Object)(object)PinListPanelController.PinListPanel?.Panel) && PinListPanelController.PinListPanel.HasFocus())
			{
				takeInput = false;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("RemovePin", new Type[] { typeof(PinData) })]
		private static void RemovePinPrefix(ref PinData pin)
		{
			if (PluginConfig.IsModEnabled.Value && Pinnacle.PinEditPanel?.TargetPin == pin)
			{
				Pinnacle.TogglePinEditPanel();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("SetMapMode")]
		private static void SetMapModePrefix(ref Minimap __instance, ref MapMode mode, ref MapMode __state)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected I4, but got Unknown
			if (PluginConfig.IsModEnabled.Value && Object.op_Implicit((Object)(object)PinListPanelController.PinListPanel?.Panel) && PinListPanelController.PinListPanel.Panel.activeSelf)
			{
				__state = (MapMode)(int)__instance.m_mode;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("SetMapMode")]
		private static void SetMapModePostfix(ref MapMode mode, ref MapMode __state)
		{
			if (PluginConfig.IsModEnabled.Value && (int)mode != 2)
			{
				if (Object.op_Implicit((Object)(object)Pinnacle.PinEditPanel?.Panel))
				{
					Pinnacle.TogglePinEditPanel();
				}
				if (Object.op_Implicit((Object)(object)PinListPanelController.PinListPanel?.Panel))
				{
					PinListPanelController.PinListPanel.PinNameFilter.InputField.DeactivateInputField(false);
				}
			}
			if (PluginConfig.IsModEnabled.Value && (int)mode == 2 && (int)__state != (int)mode)
			{
				PinListPanelController.PinListPanel.SetTargetPins();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ShowPinNameInput")]
		private static bool ShowPinNameInputPrefix(Minimap __instance, Vector3 pos)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (PluginConfig.IsModEnabled.Value)
			{
				__instance.m_namePin = null;
				Pinnacle.TogglePinEditPanel(PinnacleUtils.AddNewPin(__instance, pos));
				Pinnacle.PinEditPanel?.ActivatePinNameInputField();
				return false;
			}
			return true;
		}

		[HarmonyPostfix]
		[HarmonyPatch("SelectIcon")]
		private static void SelectIconPostfix()
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				Pinnacle.PinFilterPanel?.UpdatePinIconFilters();
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch("ToggleIconFilter")]
		private static void ToggleIconFilterPostfix()
		{
			if (PluginConfig.IsModEnabled.Value)
			{
				Pinnacle.PinFilterPanel?.UpdatePinIconFilters();
			}
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	internal static class TerminalPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch("InitTerminal")]
		private static void InitTerminalPrefix(ref bool __state)
		{
			__state = Terminal.m_terminalInitialized;
		}

		[HarmonyPostfix]
		[HarmonyPatch("InitTerminal")]
		private static void InitTerminalPostfix(bool __state)
		{
			if (!__state)
			{
				ComfyCommandUtils.ToggleCommands(PluginConfig.IsModEnabled.Value);
			}
			if (PluginConfig.IsModEnabled.Value)
			{
				ModifyResetMapCommand();
			}
		}

		private static void ModifyResetMapCommand()
		{
			if (Terminal.commands.TryGetValue("resetmap", out var value))
			{
				value.IsCheat = false;
				value.OnlyServer = false;
				Pinnacle.Log((LogLevel)16, "Modified 'resetmap' command: IsCheat = false, OnlyServer = false.");
			}
		}
	}
	[BepInPlugin("redseiko.valheim.pinnacle", "Pinnacle", "1.11.0")]
	public sealed class Pinnacle : BaseUnityPlugin
	{
		public const string PluginGuid = "redseiko.valheim.pinnacle";

		public const string PluginName = "Pinnacle";

		public const string PluginVersion = "1.11.0";

		private static ManualLogSource _logger;

		public static PinEditPanel PinEditPanel { get; private set; }

		public static PinFilterPanel PinFilterPanel { get; private set; }

		private void Awake()
		{
			_logger = ((BaseUnityPlugin)this).Logger;
			PluginConfig.BindConfig(((BaseUnityPlugin)this).Config);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "redseiko.valheim.pinnacle");
		}

		public static void TogglePinnacle(bool toggleOn)
		{
			TogglePinEditPanel();
			PinListPanelController.TogglePanel(toggleOn: false);
			TogglePinFilterPanel(toggleOn);
			ToggleVanillaIconPanels(!toggleOn);
		}

		public static void ToggleVanillaIconPanels(bool toggleOn)
		{
			foreach (GameObject item in (from child in Minimap.m_instance.Ref<Minimap>()?.m_largeRoot.Children()
				where ((Object)child).name.StartsWith("IconPanel")
				select child))
			{
				item.SetActive(toggleOn);
			}
		}

		public static void TogglePinEditPanel(PinData pinToEdit = null)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_009d: 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)
			if (!Object.op_Implicit((Object)(object)PinEditPanel?.Panel))
			{
				PinEditPanel = new PinEditPanel(Minimap.m_instance.m_largeRoot.transform);
				PinEditPanel.Panel.RectTransform().SetAnchorMin(new Vector2(0.5f, 0f)).SetAnchorMax(new Vector2(0.5f, 0f))
					.SetPivot(new Vector2(0.5f, 0f))
					.SetPosition(new Vector2(0f, 25f))
					.SetSizeDelta(new Vector2(200f, 200f));
			}
			if (pinToEdit == null)
			{
				PinEditPanel.SetTargetPin(null);
				PinEditPanel.SetActive(toggle: false);
			}
			else
			{
				CenterMapHelper.CenterMapOnPosition(pinToEdit.m_pos);
				PinEditPanel.SetTargetPin(pinToEdit);
				PinEditPanel.SetActive(toggle: true);
			}
		}

		public static void TogglePinFilterPanel(bool toggleOn)
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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)
			if (!Object.op_Implicit((Object)(object)PinFilterPanel?.Panel))
			{
				PinFilterPanel = new PinFilterPanel(Minimap.m_instance.m_largeRoot.transform);
				PinFilterPanel.Panel.RectTransform().SetAnchorMin(new Vector2(1f, 0.5f)).SetAnchorMax(new Vector2(1f, 0.5f))
					.SetPivot(new Vector2(1f, 0.5f))
					.SetPosition(PluginConfig.PinFilterPanelPosition.Value);
				PluginConfig.PinFilterPanelGridIconSize.OnSettingChanged<float>(PinFilterPanel.SetPanelStyle);
				PinFilterPanel.PanelDragger.OnPanelEndDrag += delegate(object _, Vector3 position)
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					//IL_0006: Unknown result type (might be due to invalid IL or missing references)
					PluginConfig.PinFilterPanelPosition.Value = Vector2.op_Implicit(position);
				};
			}
			PinFilterPanel.Panel.SetActive(toggleOn);
		}

		public static void Log(LogLevel logLevel, object o)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			_logger.Log(logLevel, (object)$"[{DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)}] {o}");
		}

		public static void LogInfo(object obj)
		{
			_logger.LogInfo((object)$"[{DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)}] {obj}");
			Chat.m_instance.AddMessage(obj);
		}

		public static void LogWarning(object obj)
		{
			_logger.LogWarning((object)$"[{DateTime.Now.ToString(DateTimeFormatInfo.InvariantInfo)}] {obj}");
			Chat.m_instance.AddMessage(obj);
		}
	}
	public static class PluginConfig
	{
		[HarmonyPatch(typeof(FejdStartup))]
		private static class FejdStartupPatch
		{
			[HarmonyPostfix]
			[HarmonyPatch("Awake")]
			private static void AwakePostfix()
			{
				while (_lateBindConfigQueue.Count > 0)
				{
					_lateBindConfigQueue.Dequeue()?.Invoke(CurrentConfig);
				}
			}
		}

		private static readonly Queue<Action<ConfigFile>> _lateBindConfigQueue = new Queue<Action<ConfigFile>>();

		public static ConfigFile CurrentConfig { get; private set; }

		public static ConfigEntry<bool> IsModEnabled { get; private set; }

		public static ConfigEntry<float> CenterMapLerpDuration { get; private set; }

		public static ConfigEntry<KeyboardShortcut> PinListPanelToggleShortcut { get; private set; }

		public static ConfigEntry<bool> PinListPanelShowPinPosition { get; private set; }

		public static ConfigEntry<Vector2> PinListPanelPosition { get; private set; }

		public static ConfigEntry<Vector2> PinListPanelSizeDelta { get; private set; }

		public static ConfigEntry<Color> PinListPanelBackgroundColor { get; private set; }

		public static ConfigEntry<MovementType> PinListPanelScrollRectMovementType { get; private set; }

		public static ConfigEntry<bool> PinListPanelEditPinOnRowClick { get; private set; }

		public static ConfigEntry<float> PinEditPanelToggleLerpDuration { get; private set; }

		public static ConfigEntry<Vector2> PinFilterPanelPosition { get; private set; }

		public static ConfigEntry<float> PinFilterPanelGridIconSize { get; private set; }

		public static ConfigEntry<string> PinFont { get; private set; }

		public static ConfigEntry<int> PinFontSize { get; private set; }

		public static ConfigEntry<KeyboardShortcut> AddPinAtMouseShortcut { get; private set; }

		public static void BindConfig(ConfigFile config)
		{
			CurrentConfig = config;
			IsModEnabled = config.BindInOrder("_Global", "isModEnabled", defaultValue: true, "Globally enable or disable this mod.");
			IsModEnabled.OnSettingChanged<bool>(Pinnacle.TogglePinnacle);
			IsModEnabled.OnSettingChanged<bool>(ComfyCommandUtils.ToggleCommands);
			CenterMapLerpDuration = config.BindInOrder("CenterMap", "lerpDuration", 1f, "Duration (in seconds) for the CenterMap lerp.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f));
			BindPinListPanelConfig(config);
			BindPinEditPanelConfig(config);
			BindPinFilterPanelConfig(config);
			_lateBindConfigQueue.Clear();
			_lateBindConfigQueue.Enqueue(BindMinimapConfig);
		}

		public static void BindPinListPanelConfig(ConfigFile config)
		{
			//IL_0012: 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_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			PinListPanelToggleShortcut = config.BindInOrder<KeyboardShortcut>("PinListPanel", "pinListPanelToggleShortcut", new KeyboardShortcut((KeyCode)9, Array.Empty<KeyCode>()), "Keyboard shortcut to toggle the PinListPanel on/off.");
			PinListPanelShowPinPosition = config.BindInOrder("PinListPanel.Columns", "pinListPanelShowPinPosition", defaultValue: true, "Show the Pin.Position columns in the PinListPanel.");
			PinListPanelPosition = config.BindInOrder<Vector2>("PinListPanel.Panel", "pinListPanelPosition", new Vector2(25f, 0f), "The value for the PinListPanel.Panel position (relative to pivot/anchors).");
			PinListPanelPosition.OnSettingChanged((Action<Vector2>)PinListPanelController.SetPanelPosition);
			PinListPanelSizeDelta = config.BindInOrder<Vector2>("PinListPanel.Panel", "pinListPanelSizeDelta", new Vector2(400f, 400f), "The value for the PinListPanel.Panel sizeDelta (width/height in pixels).");
			PinListPanelSizeDelta.OnSettingChanged((Action<Vector2>)PinListPanelController.SetPanelSize);
			PinListPanelBackgroundColor = config.BindInOrder<Color>("PinListPanel.Panel", "pinListPanelBackgroundColor", new Color(0f, 0f, 0f, 0.9f), "The value for the PinListPanel.Panel background color.");
			PinListPanelBackgroundColor.OnSettingChanged((Action<Color>)PinListPanelController.SetBackgroundColor);
			PinListPanelScrollRectMovementType = config.BindInOrder<MovementType>("PinListPanel.ScrollRect", "movementType", (MovementType)2, "Determines how the PinListPanel scrolling should behave.", (AcceptableValueBase)(object)new AcceptableValueEnumList<MovementType>((MovementType)2, (MovementType)1));
			PinListPanelScrollRectMovementType.OnSettingChanged((Action<MovementType>)PinListPanelController.SetScrollRectMovementType);
			PinListPanelEditPinOnRowClick = config.BindInOrder("PinListPanel.Behaviour", "pinListPanelEditPinOnRowClick", defaultValue: true, "If set, will show the PinEditPanel when a row is selected in the PinListPanel.");
		}

		public static void BindPinEditPanelConfig(ConfigFile config)
		{
			PinEditPanelToggleLerpDuration = config.BindInOrder("PinEditPanel.Toggle", "pinEditPanelToggleLerpDuration", 0.25f, "Duration (in seconds) for the PinEdiPanl.Toggle on/off lerp.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f));
		}

		public static void BindPinFilterPanelConfig(ConfigFile config)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			PinFilterPanelPosition = config.BindInOrder<Vector2>("PinFilterPanel.Panel", "pinFilterPanelPanelPosition", new Vector2(-25f, 0f), "The value for the PinFilterPanel.Panel position (relative to pivot/anchors).");
			PinFilterPanelGridIconSize = config.BindInOrder("PinFilterPanel.Grid", "pinFilterPanelGridIconSize", 30f, "The size of the PinFilterPanel.Grid icons.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100f));
		}

		public static void BindMinimapConfig(ConfigFile config)
		{
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			string valheimNorseFont = UIResources.ValheimNorseFont;
			List<string> list = new List<string>();
			list.AddRange(from f in Resources.FindObjectsOfTypeAll<TMP_FontAsset>()
				select ((Object)f).name into f
				orderby f
				select f);
			PinFont = config.BindInOrder("Minimap", "Pin.Font", valheimNorseFont, "The font for the Pin text on the Minimap.", (AcceptableValueBase)(object)new AcceptableValueList<string>(list.ToArray()));
			PinFontSize = config.BindInOrder("Minimap", "Pin.FontSize", 18, "The font size for the Pin text on the Minimap.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 26));
			PinFont.OnSettingChanged<string>(PinMarkerUtils.SetPinNameFont);
			PinFontSize.OnSettingChanged<int>(PinMarkerUtils.SetPinNameFontSize);
			AddPinAtMouseShortcut = config.BindInOrder<KeyboardShortcut>("Minimap.Actions", "addPinAtMouseShortcut", KeyboardShortcut.Empty, "Keyboard shortcut to add a Minimap.Pin at the mouse position.");
		}
	}
	public sealed class DisableHighlightOnSelect : MonoBehaviour, ISelectHandler, IEventSystemHandler
	{
		private InputField _inputField;

		private void Start()
		{
			_inputField = ((Component)this).GetComponent<InputField>();
		}

		public void OnSelect(BaseEventData eventData)
		{
			((MonoBehaviour)this).StartCoroutine(DisableHighlight());
		}

		private IEnumerator DisableHighlight()
		{
			Color original = _inputField.selectionColor;
			_inputField.selectionColor = Color.clear;
			yield return null;
			_inputField.MoveTextEnd(false);
			_inputField.selectionColor = original;
		}
	}
	public sealed class LabelRow
	{
		public GameObject Row { get; private set; }

		public TMP_Text Label { get; private set; }

		public LabelRow(Transform parentTransform)
		{
			Row = CreateChildRow(parentTransform);
			Label = CreateChildLabel(Row.transform);
		}

		private GameObject CreateChildRow(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetPadding(8, 8, 2, 2)
				.SetSpacing(12f)
				.SetChildAlignment((TextAnchor)4);
			return val;
		}

		private TMP_Text CreateChildLabel(Transform parentTransform)
		{
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((TMP_Text)(object)obj).SetName<TMP_Text>("Label");
			((TMP_Text)obj).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj).text = "Label";
			((Component)obj).gameObject.AddComponent<LayoutElement>();
			return (TMP_Text)(object)obj;
		}
	}
	public sealed class LabelValueRow
	{
		public GameObject Row { get; private set; }

		public TMP_Text Label { get; private set; }

		public ValueCell Value { get; private set; }

		public LabelValueRow(Transform parentTransform)
		{
			Row = CreateChildRow(parentTransform);
			Label = CreateChildLabel(Row.transform);
			Value = new ValueCell(Row.transform);
		}

		private GameObject CreateChildRow(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Expected O, but got Unknown
			GameObject val = new GameObject("Row", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetPadding(8, 8, 2, 2)
				.SetSpacing(12f)
				.SetChildAlignment((TextAnchor)4);
			return val;
		}

		private TMP_Text CreateChildLabel(Transform parentTransform)
		{
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((TMP_Text)(object)obj).SetName<TMP_Text>("Label");
			((TMP_Text)obj).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj).text = "Name";
			((Component)obj).gameObject.AddComponent<LayoutElement>().SetPreferred(75f, null);
			return (TMP_Text)(object)obj;
		}
	}
	public sealed class PanelDragger : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler
	{
		private Vector2 _lastMousePosition;

		public RectTransform TargetRectTransform;

		public event EventHandler<Vector3> OnPanelEndDrag;

		public void OnBeginDrag(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			_lastMousePosition = eventData.position;
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0031: 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)
			//IL_0047: 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)
			Vector2 val = eventData.position - _lastMousePosition;
			if (Object.op_Implicit((Object)(object)TargetRectTransform))
			{
				RectTransform targetRectTransform = TargetRectTransform;
				((Transform)targetRectTransform).position = ((Transform)targetRectTransform).position + new Vector3(val.x, val.y, ((Transform)TargetRectTransform).position.z);
			}
			_lastMousePosition = eventData.position;
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			//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)
			if (Object.op_Implicit((Object)(object)TargetRectTransform))
			{
				this.OnPanelEndDrag?.Invoke(this, Vector2.op_Implicit(TargetRectTransform.anchoredPosition));
			}
		}
	}
	public sealed class PanelResizer : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IBeginDragHandler, IDragHandler, IEndDragHandler
	{
		private CanvasGroup _canvasGroup;

		private float _targetAlpha;

		private Vector2 _lastMousePosition;

		private Coroutine _lerpAlphaCoroutine;

		public RectTransform TargetRectTransform;

		public event EventHandler<Vector2> OnPanelEndResize;

		private void Awake()
		{
			_canvasGroup = ((Component)this).GetComponent<CanvasGroup>();
		}

		private void SetCanvasGroupAlpha(float alpha)
		{
			if (_lerpAlphaCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(_lerpAlphaCoroutine);
				_lerpAlphaCoroutine = null;
			}
			if (_canvasGroup.alpha != alpha)
			{
				_lerpAlphaCoroutine = ((MonoBehaviour)this).StartCoroutine(LerpCanvasGroupAlpha(alpha, 0.25f));
			}
		}

		private IEnumerator LerpCanvasGroupAlpha(float targetAlpha, float lerpDuration)
		{
			float timeElapsed = 0f;
			float sourceAlpha = _canvasGroup.alpha;
			while (timeElapsed < lerpDuration)
			{
				float num = timeElapsed / lerpDuration;
				num = num * num * (3f - 2f * num);
				_canvasGroup.SetAlpha(Mathf.Lerp(sourceAlpha, targetAlpha, num));
				timeElapsed += Time.deltaTime;
				yield return null;
			}
			_canvasGroup.SetAlpha(targetAlpha);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			_targetAlpha = 1f;
			SetCanvasGroupAlpha(_targetAlpha);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			_targetAlpha = 0f;
			if (!eventData.dragging)
			{
				SetCanvasGroupAlpha(_targetAlpha);
			}
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//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)
			SetCanvasGroupAlpha(1f);
			_lastMousePosition = eventData.position;
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0085: 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)
			//IL_0026: 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_003c: 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_0052: 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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = _lastMousePosition - eventData.position;
			if (Object.op_Implicit((Object)(object)TargetRectTransform))
			{
				RectTransform targetRectTransform = TargetRectTransform;
				targetRectTransform.anchoredPosition += new Vector2(0f, -0.5f * val.y);
				RectTransform targetRectTransform2 = TargetRectTransform;
				targetRectTransform2.sizeDelta += new Vector2(-1f * val.x, val.y);
			}
			SetCanvasGroupAlpha(1f);
			_lastMousePosition = eventData.position;
		}

		public void OnEndDrag(PointerEventData eventData)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			SetCanvasGroupAlpha(_targetAlpha);
			this.OnPanelEndResize?.Invoke(this, TargetRectTransform.sizeDelta);
		}
	}
	public sealed class ParentSizeFitter : MonoBehaviour
	{
		private RectTransform _parentRectTransform;

		private RectTransform _rectTransform;

		private void Awake()
		{
			_parentRectTransform = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>();
			_rectTransform = ((Component)this).GetComponent<RectTransform>();
		}

		private void OnRectTransformDimensionsChange()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_parentRectTransform))
			{
				_parentRectTransform = ((Component)((Component)this).transform.parent).GetComponent<RectTransform>();
			}
			if (!Object.op_Implicit((Object)(object)_rectTransform))
			{
				_rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
			if (Object.op_Implicit((Object)(object)_rectTransform) && Object.op_Implicit((Object)(object)_parentRectTransform))
			{
				_rectTransform.SetSizeWithCurrentAnchors((Axis)0, _parentRectTransform.sizeDelta.x);
			}
		}
	}
	public sealed class PinFilterPanel
	{
		public GameObject Panel { get; private set; }

		public PanelDragger PanelDragger { get; private set; }

		public PinIconSelector PinIconSelector { get; private set; }

		public PinFilterPanel(Transform parentTransform)
		{
			Panel = CreateChildPanel(parentTransform);
			PanelDragger = CreateChildPanelDragger(Panel.transform).AddComponent<PanelDragger>();
			PanelDragger.TargetRectTransform = Panel.RectTransform();
			PinIconSelector = new PinIconSelector(Panel.transform);
			PinIconSelector.GridLayoutGroup.SetConstraint((Constraint)1).SetConstraintCount(2).SetStartAxis((Axis)1);
			PinIconSelector.OnPinIconClicked += ProcessOnPinIconClicked;
			SetPanelStyle();
		}

		private void ProcessOnPinIconClicked(object sender, PinType pinType)
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			Minimap obj = Minimap.m_instance.Ref<Minimap>();
			if (obj != null)
			{
				obj.ToggleIconFilter(pinType);
			}
		}

		public void SetPanelStyle()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			PinIconSelector.GridLayoutGroup.SetCellSize(new Vector2(PluginConfig.PinFilterPanelGridIconSize.Value, PluginConfig.PinFilterPanelGridIconSize.Value));
		}

		public void UpdatePinIconFilters()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_0056: 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)
			foreach (PinType key in PinIconSelector.IconsByType.Keys)
			{
				PinIconSelector.IconsByType[key].Image().Ref<Image>()?.SetColor(Minimap.m_instance.m_visibleIconTypes[key] ? Color.white : Color.gray);
			}
		}

		private GameObject CreateChildPanel(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			GameObject val = new GameObject("PinFilter.Panel", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<VerticalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetPadding(8, 8, 8, 8)
				.SetSpacing(4f);
			val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateSuperellipse(200, 200, 10f))
				.SetColor(new Color(0f, 0f, 0f, 0.9f));
			val.AddComponent<CanvasGroup>().SetBlocksRaycasts(blocksRaycasts: true);
			return val;
		}

		private GameObject CreateChildPanelDragger(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//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: Expected O, but got Unknown
			//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_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: 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_007e: Expected O, but got Unknown
			GameObject val = new GameObject("Dragger", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<LayoutElement>().SetIgnoreLayout(ignoreLayout: true);
			GameObjectExtensions.RectTransform(val).SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetSizeDelta(Vector2.zero);
			val.AddComponent<Image>().SetColor(Color.clear);
			return val;
		}
	}
	public sealed class PinListRow
	{
		private PinData _targetPin;

		private static readonly Lazy<ColorBlock> ButtonColorBlock = new Lazy<ColorBlock>((Func<ColorBlock>)delegate
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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)
			ColorBlock result = default(ColorBlock);
			((ColorBlock)(ref result)).normalColor = new Color(0f, 0f, 0f, 0.01f);
			((ColorBlock)(ref result)).highlightedColor = Color32.op_Implicit(new Color32((byte)50, (byte)161, (byte)217, (byte)128));
			((ColorBlock)(ref result)).disabledColor = new Color(0f, 0f, 0f, 0.1f);
			((ColorBlock)(ref result)).pressedColor = Color32.op_Implicit(new Color32((byte)50, (byte)161, (byte)217, (byte)192));
			((ColorBlock)(ref result)).selectedColor = Color32.op_Implicit(new Color32((byte)50, (byte)161, (byte)217, (byte)248));
			((ColorBlock)(ref result)).colorMultiplier = 1f;
			((ColorBlock)(ref result)).fadeDuration = 0f;
			return result;
		});

		public GameObject Row { get; private set; }

		public Image PinIcon { get; private set; }

		public TMP_Text PinName { get; private set; }

		public TMP_Text PositionX { get; private set; }

		public TMP_Text PositionY { get; private set; }

		public TMP_Text PositionZ { get; private set; }

		public PinListRow(Transform parentTransform)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			Row = CreateChildRow(parentTransform);
			((UnityEvent)Row.Button().onClick).AddListener(new UnityAction(OnRowClick));
			PinIcon = CreateChildPinIcon(Row.transform).Image();
			PinName = CreateChildPinName(Row.transform);
			UIBuilder.CreateRowSpacer(Row.transform);
			PositionX = CreateChildPinPositionValue(Row.transform);
			((Graphic)PositionX).color = new Color(1f, 0.878f, 0.51f);
			PositionY = CreateChildPinPositionValue(Row.transform);
			((Graphic)PositionY).color = new Color(0.565f, 0.792f, 0.976f);
			PositionZ = CreateChildPinPositionValue(Row.transform);
			((Graphic)PositionZ).color = new Color(0.647f, 0.839f, 0.655f);
		}

		private void OnRowClick()
		{
			PinnacleUtils.CenterMapOnOrTeleportTo(_targetPin);
		}

		public PinListRow SetRowContent(PinData pin)
		{
			_targetPin = pin;
			PinIcon.SetSprite(pin.m_icon);
			PinName.SetText(GetLocalizedPinName(pin));
			PositionX.SetText($"{pin.m_pos.x:F0}");
			PositionY.SetText($"{pin.m_pos.y:F0}");
			PositionZ.SetText($"{pin.m_pos.z:F0}");
			return this;
		}

		private string GetLocalizedPinName(PinData pin)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			if (pin.m_name.Length <= 0)
			{
				return $"<i>{pin.m_type}</i>";
			}
			if (pin.m_name[0] == '$')
			{
				return Localization.m_instance.Localize(pin.m_name);
			}
			return pin.m_name;
		}

		public void TogglePinPosition(bool toggleOn)
		{
			((Component)PositionX).gameObject.SetActive(toggleOn);
			((Component)PositionY).gameObject.SetActive(toggleOn);
			((Component)PositionZ).gameObject.SetActive(toggleOn);
		}

		private GameObject CreateChildRow(Transform parentTransform)
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("PinList.Row", new Type[1] { typeof(RectTransform) });
			val.SetParent(parentTransform);
			val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetChildAlignment((TextAnchor)4)
				.SetPadding(5, 10, 4, 4)
				.SetSpacing(2.5f);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(400, 400, 5, (FilterMode)1));
			val.AddComponent<Button>().SetNavigationMode<Button>((Mode)0).SetTargetGraphic<Button>((Graphic)(object)val.Image())
				.SetColors<Button>(ButtonColorBlock.Value);
			val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)0).SetVerticalFit((FitMode)2);
			val.AddComponent<ParentSizeFitter>();
			return val;
		}

		private GameObject CreateChildPinIcon(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			GameObject val = new GameObject("Pin.Icon", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<LayoutElement>().SetPreferred(20f, 20f);
			val.AddComponent<Image>().SetType((Type)0);
			return val;
		}

		private TMP_Text CreateChildPinName(Transform parentTransform)
		{
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(parentTransform);
			((TMP_Text)(object)obj).SetName<TMP_Text>("Pin.Name");
			((TMP_Text)obj).alignment = (TextAlignmentOptions)513;
			((TMP_Text)obj).textWrappingMode = (TextWrappingModes)0;
			((TMP_Text)obj).overflowMode = (TextOverflowModes)1;
			((TMP_Text)obj).fontSize = 16f;
			return (TMP_Text)(object)obj;
		}

		private TMP_Text CreateChildPinPositionValue(Transform parentTransform)
		{
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			TMP_Text val = (TMP_Text)(object)UIBuilder.CreateTMPLabel(parentTransform);
			val.SetName<TMP_Text>("Pin.Position.Value");
			val.alignment = (TextAlignmentOptions)516;
			val.text = "-99999";
			val.textWrappingMode = (TextWrappingModes)0;
			val.overflowMode = (TextOverflowModes)1;
			val.fontSize = 14f;
			((Component)val).gameObject.AddComponent<LayoutElement>().SetPreferred(val.GetPreferredValues().x, null);
			return val;
		}
	}
	public sealed class PinIconSelector
	{
		private static readonly Lazy<ColorBlock> ButtonColorBlock = new Lazy<ColorBlock>((Func<ColorBlock>)delegate
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock result = default(ColorBlock);
			((ColorBlock)(ref result)).normalColor = new Color(1f, 1f, 1f, 0.8f);
			((ColorBlock)(ref result)).highlightedColor = new Color(0.565f, 0.792f, 0.976f);
			((ColorBlock)(ref result)).disabledColor = new Color(0f, 0f, 0f, 0.5f);
			((ColorBlock)(ref result)).pressedColor = new Color(0.647f, 0.839f, 0.655f);
			((ColorBlock)(ref result)).selectedColor = new Color(1f, 0.878f, 0.51f);
			((ColorBlock)(ref result)).colorMultiplier = 1f;
			((ColorBlock)(ref result)).fadeDuration = 0.25f;
			return result;
		});

		public GameObject Grid { get; private set; }

		public GridLayoutGroup GridLayoutGroup { get; private set; }

		public List<GameObject> Icons { get; } = new List<GameObject>();


		public Dictionary<PinType, GameObject> IconsByType { get; } = new Dictionary<PinType, GameObject>();


		public event EventHandler<PinType> OnPinIconClicked;

		public PinIconSelector(Transform parentTransform)
		{
			//IL_0068: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: 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_0115: Expected O, but got Unknown
			Grid = CreateChildGrid(parentTransform);
			GridLayoutGroup = Grid.GetComponent<GridLayoutGroup>();
			foreach (PinType pinType in Enum.GetValues(typeof(PinType)))
			{
				Sprite sprite = Minimap.m_instance.GetSprite(pinType);
				if (!((Object)(object)sprite == (Object)null))
				{
					GameObject val = CreateChildIcon(Grid.transform);
					Icons.Add(val);
					IconsByType[pinType] = val;
					val.Image().SetSprite(sprite);
					val.AddComponent<Button>().SetNavigationMode<Button>((Mode)0).SetTargetGraphic<Button>((Graphic)(object)val.Image())
						.SetTransition<Button>((Transition)1)
						.SetColors<Button>(ButtonColorBlock.Value);
					((UnityEvent)val.Button().onClick).AddListener((UnityAction)delegate
					{
						//IL_0017: Unknown result type (might be due to invalid IL or missing references)
						this.OnPinIconClicked?.Invoke(this, pinType);
					});
				}
			}
		}

		public void UpdateIcons(PinType pinType)
		{
			//IL_0005: 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_0086: 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_006d: 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_0075: Unknown result type (might be due to invalid IL or missing references)
			Sprite obj = Minimap.m_instance.GetSprite(pinType).Ref<Sprite>();
			string text = ((obj != null) ? ((Object)obj).name : null);
			foreach (Image item in Icons.Select((GameObject i) => i.Image()))
			{
				ColorBlock value;
				Color color;
				if (!(((Object)item.sprite).name == text))
				{
					value = ButtonColorBlock.Value;
					color = ((ColorBlock)(ref value)).normalColor;
				}
				else
				{
					value = ButtonColorBlock.Value;
					color = ((ColorBlock)(ref value)).selectedColor;
				}
				item.SetColor(color);
			}
		}

		public void SetIconSize(Vector2 sizeDelta)
		{
			//IL_0038: 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_0073: Unknown result type (might be due to invalid IL or missing references)
			foreach (LayoutElement item in Icons.Select((GameObject icon) => icon.LayoutElement()))
			{
				item.SetFlexible(sizeDelta.x, sizeDelta.y);
			}
			Grid.GetComponent<GridLayoutGroup>().SetCellSize(sizeDelta);
		}

		private GameObject CreateChildGrid(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: 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_004a: 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_008d: Expected O, but got Unknown
			GameObject val = new GameObject("PinIconSelector.Grid", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<GridLayoutGroup>().SetCellSize(new Vector2(25f, 25f)).SetSpacing(new Vector2(8f, 8f))
				.SetConstraint((Constraint)2)
				.SetConstraintCount(2)
				.SetStartAxis((Axis)0)
				.SetStartCorner((Corner)0);
			val.AddComponent<LayoutElement>().SetFlexible(1f);
			return val;
		}

		private GameObject CreateChildIcon(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: 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_005a: Expected O, but got Unknown
			GameObject val = new GameObject("Icon", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<Image>().SetType((Type)0).SetPreserveAspect(preserveAspect: true);
			val.AddComponent<LayoutElement>().SetPreferred(25f, 25f);
			return val;
		}
	}
	public sealed class PinListPanel
	{
		private readonly PointerState _pointerState;

		public readonly List<PinData> TargetPins = new List<PinData>();

		private readonly List<PinListRow> _rowCache = new List<PinListRow>();

		private int _visibleRows;

		private float _rowPreferredHeight;

		private LayoutElement _bufferBlock;

		private bool _isRefreshing;

		private int _previousRowIndex = -1;

		public GameObject Panel { get; private set; }

		public RectTransform PanelRectTransform { get; private set; }

		public Image PanelBackground { get; private set; }

		public ValueCell PinNameFilter { get; private set; }

		public GameObject Viewport { get; private set; }

		public GameObject Content { get; private set; }

		public ScrollRect ScrollRect { get; private set; }

		public LabelCell PinStats { get; private set; }

		public LabelButton RefreshButton { get; private set; }

		public PanelDragger PanelDragger { get; private set; }

		public PanelResizer PanelResizer { get; private set; }

		public PinListPanel(Transform parentTransform)
		{
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_023e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Expected O, but got Unknown
			Panel = CreateChildPanel(parentTransform);
			PanelRectTransform = Panel.GetComponent<RectTransform>();
			PanelBackground = Panel.GetComponent<Image>();
			PanelDragger = CreateChildPanelDragger(Panel).AddComponent<PanelDragger>();
			PanelDragger.TargetRectTransform = Panel.RectTransform();
			PanelResizer = CreateChildPanelResizer(Panel).AddComponent<PanelResizer>();
			PanelResizer.TargetRectTransform = Panel.RectTransform();
			PinNameFilter = new ValueCell(Panel.transform);
			LayoutElement layoutElement = PinNameFilter.Cell.LayoutElement().SetFlexible(1f);
			float? height = 30f;
			layoutElement.SetPreferred(null, height);
			((UnityEvent<string>)(object)PinNameFilter.InputField.onValueChanged).AddListener((UnityAction<string>)SetTargetPins);
			Viewport = CreateChildViewport(Panel.transform);
			Content = CreateChildContent(Viewport.transform);
			ScrollRect = CreateChildScrollRect(Panel, Viewport, Content);
			PinStats = new LabelCell(Panel.transform);
			PinStats.Cell.GetComponent<HorizontalLayoutGroup>().SetPadding(8, 8, 2, 2);
			PinStats.Cell.Image().SetColor(new Color(0.5f, 0.5f, 0.5f, 0.1f));
			PinStats.Cell.AddComponent<Outline>().SetEffectDistance(new Vector2(2f, -2f));
			RefreshButton = CreateRefreshButton(PinStats.Cell.transform);
			((UnityEvent)RefreshButton.Button.onClick).AddListener(new UnityAction(RefreshTargetPins));
			_pointerState = Panel.AddComponent<PointerState>();
		}

		public bool HasFocus()
		{
			if (Object.op_Implicit((Object)(object)Panel) && Panel.activeInHierarchy)
			{
				return _pointerState.IsPointerHovered;
			}
			return false;
		}

		private static bool IsPinNameValid(PinData pin, string filter)
		{
			if (filter.Length != 0)
			{
				if (pin.m_name.Length > 0)
				{
					return pin.m_name.IndexOf(filter, 0, StringComparison.InvariantCultureIgnoreCase) >= 0;
				}
				return false;
			}
			return true;
		}

		public void RefreshTargetPins()
		{
			SetTargetPins();
		}

		public void SetTargetPins()
		{
			SetTargetPins(PinNameFilter.InputField.text);
		}

		public void SetTargetPins(string filter)
		{
			SetTargetPins(Minimap.m_instance.m_pins.Where((PinData pin) => IsPinNameValid(pin, filter)).ToList());
		}

		public void SetTargetPins(List<PinData> pins)
		{
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			TargetPins.Clear();
			TargetPins.AddRange(from p in pins
				orderby p.m_type, p.m_name
				select p);
			foreach (PinData item in pins.Where((PinData p) => Mathf.Approximately(p.m_pos.y, 0f)))
			{
				item.m_pos.y = PinnacleUtils.GetHeight(item.m_pos);
			}
			RefreshPinListRows();
			PinStats.Label.SetText($"{TargetPins.Count} pins.");
		}

		private void RefreshPinListRows()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			_isRefreshing = true;
			((UnityEventBase)ScrollRect.onValueChanged).RemoveAllListeners();
			Content.RectTransform().SetPosition(Vector2.zero);
			ScrollRect.SetVerticalScrollPosition(1f);
			_previousRowIndex = -1;
			_rowCache.Clear();
			foreach (GameObject item in Content.Children())
			{
				Object.Destroy((Object)(object)item);
			}
			GameObject val = new GameObject("Block", new Type[1] { typeof(RectTransform) });
			val.SetParent(Content.transform);
			_bufferBlock = val.AddComponent<LayoutElement>();
			LayoutElement bufferBlock = _bufferBlock;
			float? height = 0f;
			bufferBlock.SetPreferred(null, height);
			PinListRow pinListRow = new PinListRow(Content.transform);
			LayoutRebuilder.ForceRebuildLayoutImmediate(Panel.RectTransform());
			_rowPreferredHeight = LayoutUtility.GetPreferredHeight(pinListRow.Row.RectTransform());
			_visibleRows = Mathf.CeilToInt(Viewport.RectTransform().sizeDelta.y / _rowPreferredHeight);
			Object.Destroy((Object)(object)pinListRow.Row);
			Content.RectTransform().SetSizeDelta(new Vector2(Viewport.RectTransform().sizeDelta.x, _rowPreferredHeight * (float)TargetPins.Count));
			for (int i = 0; i < Mathf.Min(TargetPins.Count, _visibleRows); i++)
			{
				pinListRow = new PinListRow(Content.transform);
				pinListRow.TogglePinPosition(PluginConfig.PinListPanelShowPinPosition.Value);
				pinListRow.SetRowContent(TargetPins[i]);
				_rowCache.Add(pinListRow);
			}
			_previousRowIndex = -1;
			ScrollRect.SetVerticalScrollPosition(1f);
			((UnityEvent<Vector2>)(object)ScrollRect.onValueChanged).AddListener((UnityAction<Vector2>)OnVerticalScroll);
			_isRefreshing = false;
		}

		private void OnVerticalScroll(Vector2 scroll)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (_isRefreshing || TargetPins.Count == 0 || _rowCache.Count == 0)
			{
				return;
			}
			int num = Mathf.Clamp(Mathf.CeilToInt(Content.RectTransform().anchoredPosition.y / _rowPreferredHeight), 0, TargetPins.Count - _rowCache.Count);
			if (num != _previousRowIndex)
			{
				if (num > _previousRowIndex)
				{
					PinListRow pinListRow = _rowCache[0];
					_rowCache.RemoveAt(0);
					((Transform)pinListRow.Row.RectTransform()).SetAsLastSibling();
					int index = Mathf.Clamp(num + _rowCache.Count, 0, TargetPins.Count - 1);
					pinListRow.SetRowContent(TargetPins[index]);
					_rowCache.Add(pinListRow);
				}
				else
				{
					PinListRow pinListRow2 = _rowCache[_rowCache.Count - 1];
					_rowCache.RemoveAt(_rowCache.Count - 1);
					((Transform)pinListRow2.Row.RectTransform()).SetSiblingIndex(1);
					pinListRow2.SetRowContent(TargetPins[num]);
					_rowCache.Insert(0, pinListRow2);
				}
				LayoutElement bufferBlock = _bufferBlock;
				float? height = (float)num * _rowPreferredHeight;
				bufferBlock.SetPreferred(null, height);
				_previousRowIndex = num;
			}
		}

		private GameObject CreateChildPanel(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Expected O, but got Unknown
			GameObject val = new GameObject("PinList.Panel", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<VerticalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetPadding(8, 8, 8, 8)
				.SetSpacing(8f);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateSuperellipse(400, 400, 15f))
				.SetColor(new Color(0f, 0f, 0f, 0.9f));
			return val;
		}

		private GameObject CreateChildViewport(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: 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_008e: 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_00aa: Expected O, but got Unknown
			GameObject val = new GameObject("PinList.Viewport", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<RectMask2D>();
			val.AddComponent<LayoutElement>().SetFlexible(1f, 1f);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(128, 128, 8, (FilterMode)1))
				.SetColor(new Color(0.5f, 0.5f, 0.5f, 0.1f));
			val.AddComponent<Outline>().SetEffectDistance(new Vector2(2f, -2f));
			return val;
		}

		private GameObject CreateChildContent(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_002c: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			GameObject val = new GameObject("PinList.Content", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			GameObjectExtensions.RectTransform(val).SetAnchorMin(Vector2.up).SetAnchorMax(Vector2.up)
				.SetPivot(Vector2.up);
			val.AddComponent<VerticalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetSpacing(0f);
			val.AddComponent<Image>().SetColor(Color.clear).SetRaycastTarget(raycastTarget: true);
			return val;
		}

		private ScrollRect CreateChildScrollRect(GameObject panel, GameObject viewport, GameObject content)
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			return panel.AddComponent<ScrollRect>().SetViewport(viewport.RectTransform()).SetContent(content.RectTransform())
				.SetHorizontal(horizontal: false)
				.SetVertical(vertical: true)
				.SetMovementType(PluginConfig.PinListPanelScrollRectMovementType.Value)
				.SetScrollSensitivity(30f);
		}

		private GameObject CreateChildPanelDragger(GameObject panel)
		{
			//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: Expected O, but got Unknown
			//IL_002b: 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_003e: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Expected O, but got Unknown
			GameObject val = new GameObject("Dragger", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, panel.transform);
			val.AddComponent<LayoutElement>().SetIgnoreLayout(ignoreLayout: true);
			GameObjectExtensions.RectTransform(val).SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetSizeDelta(Vector2.zero);
			val.AddComponent<Image>().SetColor(Color.clear);
			return val;
		}

		private GameObject CreateChildPanelResizer(GameObject panel)
		{
			//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: Expected O, but got Unknown
			//IL_002b: 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_003e: Expected O, but got Unknown
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: 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_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			GameObject val = new GameObject("Resizer", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, panel.transform);
			val.AddComponent<LayoutElement>().SetIgnoreLayout(ignoreLayout: true);
			GameObjectExtensions.RectTransform(val).SetAnchorMin(Vector2.right).SetAnchorMax(Vector2.right)
				.SetPivot(Vector2.right)
				.SetSizeDelta(new Vector2(42.5f, 42.5f))
				.SetPosition(new Vector2(15f, -15f));
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIResources.GetSprite("button"))
				.SetColor(new Color(1f, 1f, 1f, 0.95f));
			val.AddComponent<CanvasGroup>().SetAlpha(0f);
			TextMeshProUGUI obj = UIBuilder.CreateTMPLabel(val.transform);
			((TMP_Text)(object)obj).SetName<TMP_Text>("Icon");
			((Component)obj).gameObject.AddComponent<LayoutElement>().SetIgnoreLayout(ignoreLayout: true);
			((Component)obj).gameObject.RectTransform().SetAnchorMin(Vector2.zero).SetAnchorMax(Vector2.one)
				.SetPivot(new Vector2(0.5f, 0.5f))
				.SetSizeDelta(Vector2.zero);
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((TMP_Text)obj).fontSize = 24f;
			((TMP_Text)obj).text = "<rotate=-45>↔</rotate>";
			return val;
		}

		private LabelButton CreateRefreshButton(Transform parentTransform)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			LabelButton labelButton = new LabelButton(parentTransform);
			labelButton.RectTransform.SetSizeDelta(new Vector2(100f, 35f));
			labelButton.Container.AddComponent<LayoutElement>().SetPreferred(100f, 35f);
			labelButton.Label.SetFontSize<TMP_Text>(14f).SetText("Refresh");
			labelButton.Button.SetNavigationMode<Button>((Mode)0);
			return labelButton;
		}
	}
	public sealed class PointerState : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public bool IsPointerHovered { get; private set; }

		public void OnPointerEnter(PointerEventData eventData)
		{
			IsPointerHovered = true;
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			IsPointerHovered = false;
		}
	}
	public sealed class ToggleCell
	{
		private static readonly Lazy<ColorBlock> ToggleColorBlock = new Lazy<ColorBlock>((Func<ColorBlock>)delegate
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			ColorBlock result = default(ColorBlock);
			((ColorBlock)(ref result)).normalColor = new Color(1f, 1f, 1f, 0.9f);
			((ColorBlock)(ref result)).highlightedColor = new Color(0.565f, 0.792f, 0.976f);
			((ColorBlock)(ref result)).disabledColor = new Color(0.2f, 0.2f, 0.2f, 0.8f);
			((ColorBlock)(ref result)).pressedColor = new Color(0.647f, 0.839f, 0.655f);
			((ColorBlock)(ref result)).selectedColor = new Color(1f, 0.878f, 0.51f);
			((ColorBlock)(ref result)).colorMultiplier = 1f;
			((ColorBlock)(ref result)).fadeDuration = 0.25f;
			return result;
		});

		public GameObject Cell { get; private set; }

		public TMP_Text Label { get; private set; }

		public Image Checkbox { get; private set; }

		public Image Checkmark { get; private set; }

		public Toggle Toggle { get; private set; }

		public ToggleCell(Transform parentTransform)
		{
			//IL_0095: 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)
			Cell = CreateChildCell(parentTransform);
			Label = CreateChildLabel(Cell.transform);
			Checkbox = CreateChildCheckbox(Cell.transform).Image();
			Checkmark = CreateChildCheckmark(((Component)Checkbox).transform).Image();
			Toggle = Cell.AddComponent<Toggle>();
			Toggle.SetTransition<Toggle>((Transition)1).SetNavigationMode<Toggle>((Mode)0).SetTargetGraphic<Toggle>((Graphic)(object)Checkbox)
				.SetColors<Toggle>(ToggleColorBlock.Value);
			Toggle.graphic = (Graphic)(object)Checkmark;
			Toggle.toggleTransition = (ToggleTransition)1;
		}

		private GameObject CreateChildCell(Transform parentTransform)
		{
			//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_0025: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Expected O, but got Unknown
			GameObject val = new GameObject("Cell", new Type[1] { typeof(RectTransform) });
			GameObjectExtensions.SetParent(val, parentTransform);
			val.AddComponent<HorizontalLayoutGroup>().SetChildControl(true, true).SetChildForceExpand(false, false)
				.SetPadding(8, 8, 4, 4)
				.SetSpacing(8f)
				.SetChildAlignment((TextAnchor)4);
			val.AddComponent<Image>().SetType((Type)1).SetSprite(UIBuilder.CreateRoundedCornerSprite(64, 64, 8, (FilterMode)1))
				.SetColor(new Color(0.5f, 0.5f, 0.5f, 0.5f));
			val.AddComponent<Shadow>().SetEffectDistance(new Vector2(2f, -2f));
			val.AddComponent<ContentSizeFitter>().SetHorizontalFit((FitMode)2).SetVerticalFit((FitMode)2);
			return val;
		}

		private GameObject CreateChildCheckbox(Transform parentTransfor