Decompiled source of OpenMinimap v1.3.1

plugins\OpenMinimap\OpenMinimap.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using OpenMinimap.Config;
using OpenMinimap.Tracking;
using OpenMinimap.UI;
using OpenMinimap.Util;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("OpenMinimap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.3.1.0")]
[assembly: AssemblyInformationalVersion("1.3.1+b6f06737926d722847ede2ccc3aeaf8ce28a5f9e")]
[assembly: AssemblyProduct("OpenMinimap")]
[assembly: AssemblyTitle("OpenMinimap")]
[assembly: AssemblyVersion("1.3.1.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace OpenMinimap
{
	[BepInPlugin("OpenMinimap", "OpenMinimap", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static ShouldHudDisplayDelegate <0>__OnShouldHudDisplay;

			public static Action<Stage> <1>__OnStageStart;

			public static Action<DamageReport> <2>__OnDeath;

			public static Action<Interactor, IInteractable, GameObject> <3>__OnInteraction;
		}

		public const string Name = "OpenMinimap";

		public const string GUID = "OpenMinimap";

		public const string Version = "1.0.0";

		internal static ManualLogSource Log;

		internal static MinimapConfig Config { get; private set; }

		private void Awake()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			Log = ((BaseUnityPlugin)this).Logger;
			Config = new MinimapConfig(((BaseUnityPlugin)this).Config);
			object obj = <>O.<0>__OnShouldHudDisplay;
			if (obj == null)
			{
				ShouldHudDisplayDelegate val = OnShouldHudDisplay;
				<>O.<0>__OnShouldHudDisplay = val;
				obj = (object)val;
			}
			HUD.shouldHudDisplay += (ShouldHudDisplayDelegate)obj;
			Stage.onStageStartGlobal += OnStageStart;
			GlobalEventManager.onCharacterDeathGlobal += OnDeath;
			GlobalEventManager.OnInteractionsGlobal += OnInteraction;
			Log.LogInfo((object)"OpenMinimap v1.0.0 loaded.");
		}

		private void Start()
		{
			Config.RegisterRiskOfOptions("OpenMinimap", "Minimap (top-right) and optional compass (top-center) HUD using in-game icons. Zoom, orientation, opacity and every object category are selectable. Supports all DLC content.", "OpenMinimap");
		}

		private void OnDestroy()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			object obj = <>O.<0>__OnShouldHudDisplay;
			if (obj == null)
			{
				ShouldHudDisplayDelegate val = OnShouldHudDisplay;
				<>O.<0>__OnShouldHudDisplay = val;
				obj = (object)val;
			}
			HUD.shouldHudDisplay -= (ShouldHudDisplayDelegate)obj;
			Stage.onStageStartGlobal -= OnStageStart;
			GlobalEventManager.onCharacterDeathGlobal -= OnDeath;
			GlobalEventManager.OnInteractionsGlobal -= OnInteraction;
		}

		private static void OnShouldHudDisplay(HUD hud, ref bool shouldDisplay)
		{
			if (Object.op_Implicit((Object)(object)hud) && !Object.op_Implicit((Object)(object)((Component)hud).gameObject.GetComponent<MinimapController>()))
			{
				((Component)hud).gameObject.AddComponent<MinimapController>();
			}
		}

		private static void OnStageStart(Stage stage)
		{
			MapScanner.OnStageStarted();
		}

		private static void OnDeath(DamageReport report)
		{
			MapScanner.QueueEventRescan();
		}

		private static void OnInteraction(Interactor interactor, IInteractable interactable, GameObject gameObject)
		{
			MapScanner.QueueEventRescan();
		}

		[ConCommand(/*Could not decode attribute arguments.*/)]
		private static void CmdScan(ConCommandArgs args)
		{
			PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>();
			foreach (PurchaseInteraction val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					Log.LogInfo((object)$"[scan] purchase '{((Object)((Component)val).gameObject).name}' context='{val.contextToken}' display='{val.displayNameToken}' available={val.available} components={Describe(((Component)val).gameObject)}");
				}
			}
			GenericInteraction[] array2 = Object.FindObjectsOfType<GenericInteraction>();
			foreach (GenericInteraction val2 in array2)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					Log.LogInfo((object)("[scan] generic '" + ((Object)((Component)val2).gameObject).name + "' context='" + val2.contextToken + "' components=" + Describe(((Component)val2).gameObject)));
				}
			}
			Log.LogInfo((object)"[scan] done");
		}

		private static string Describe(GameObject go)
		{
			List<string> list = new List<string>(8);
			Component[] components = go.GetComponents<Component>();
			foreach (Component val in components)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					list.Add(((object)val).GetType().Name);
				}
			}
			return "[" + string.Join(",", list) + "]";
		}
	}
}
namespace OpenMinimap.Util
{
	public static class TextureGen
	{
		public static Texture2D Bake(int size, Func<int, int, Color> pixel)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(size, size, (TextureFormat)4, false, true);
			Color[] array = (Color[])(object)new Color[size * size];
			for (int i = 0; i < size; i++)
			{
				for (int j = 0; j < size; j++)
				{
					array[i * size + j] = pixel(j, i);
				}
			}
			val.SetPixels(array);
			val.Apply(false, true);
			return val;
		}

		public static Texture2D FilledCircle(int size, Color fill, Color ring, float ringWidth)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			float c = (float)(size - 1) / 2f;
			return Bake(size, delegate(int x, int y)
			{
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_0054: Unknown result type (might be due to invalid IL or missing references)
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Sqrt(((float)x - c) * ((float)x - c) + ((float)y - c) * ((float)y - c));
				if (num > c)
				{
					return Color.clear;
				}
				return (!(num >= c - ringWidth)) ? fill : ring;
			});
		}

		public static Texture2D CircleAlpha(int size)
		{
			float c = (float)(size - 1) / 2f;
			return Bake(size, delegate(int x, int y)
			{
				//IL_004f: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Sqrt(((float)x - c) * ((float)x - c) + ((float)y - c) * ((float)y - c));
				return new Color(1f, 1f, 1f, Mathf.Clamp01(c - num + 0.5f));
			});
		}

		public static Texture2D RingAlpha(int size, float width)
		{
			float c = (float)(size - 1) / 2f;
			return Bake(size, delegate(int x, int y)
			{
				//IL_006e: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Sqrt(((float)x - c) * ((float)x - c) + ((float)y - c) * ((float)y - c));
				float num2 = Mathf.Clamp01(c - num + 0.5f);
				float num3 = Mathf.Clamp01(num - (c - width) + 0.5f);
				return new Color(1f, 1f, 1f, num2 * num3);
			});
		}

		public static Texture2D RectRingAlpha(int size, float width)
		{
			return Bake(size, delegate(int x, int y)
			{
				//IL_0049: Unknown result type (might be due to invalid IL or missing references)
				float num = Mathf.Min(Mathf.Min(x, size - 1 - x), Mathf.Min(y, size - 1 - y));
				return new Color(1f, 1f, 1f, Mathf.Clamp01(width - num + 0.5f));
			});
		}

		public static Texture2D SolidAlpha(int size)
		{
			return Bake(size, (int x, int y) => Color.white);
		}

		public static Texture2D TriangleAlpha(int size)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			Vector2 apex = new Vector2((float)size * 0.5f, (float)size * 0.92f);
			Vector2 left = new Vector2((float)size * 0.08f, (float)size * 0.1f);
			Vector2 right = new Vector2((float)size * 0.92f, (float)size * 0.1f);
			return Bake(size, delegate(int x, int y)
			{
				//IL_0010: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: 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_0028: Unknown result type (might be due to invalid IL or missing references)
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: 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)
				Vector2 p = new Vector2((float)x + 0.5f, (float)y + 0.5f);
				float num = Sign(p, apex, left);
				float num2 = Sign(p, left, right);
				float num3 = Sign(p, right, apex);
				bool flag = num >= 0f && num2 >= 0f && num3 >= 0f;
				float num4 = Mathf.Min(Mathf.Min(Mathf.Abs(num), Mathf.Abs(num2)), Mathf.Abs(num3));
				float num5 = (flag ? Mathf.Clamp01(num4 + 0.5f) : 0f);
				return new Color(1f, 1f, 1f, num5);
			});
		}

		public static Texture2D ConeAlpha(int size)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0052: Unknown result type (might be due to invalid IL or missing references)
			Vector2 apex = new Vector2((float)size * 0.5f, (float)size * 0.12f);
			Vector2 left = new Vector2((float)size * 0.02f, (float)size * 0.98f);
			Vector2 right = new Vector2((float)size * 0.98f, (float)size * 0.98f);
			return Bake(size, delegate(int x, int y)
			{
				//IL_0017: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: 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_0045: 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_00c7: 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)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor((float)x + 0.5f, (float)y + 0.5f);
				float num = Sign(val, apex, left);
				float num2 = Sign(val, left, right);
				float num3 = Sign(val, right, apex);
				if (!(num >= 0f) || !(num2 >= 0f) || !(num3 >= 0f))
				{
					return Color.clear;
				}
				float num4 = Mathf.Clamp01((val.y - apex.y) / (left.y - apex.y));
				return new Color(1f, 1f, 1f, Mathf.Lerp(0.45f, 0.08f, num4));
			});
		}

		public static Texture2D HexAlpha(int size)
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			Vector2[] verts = (Vector2[])(object)new Vector2[6];
			for (int i = 0; i < 6; i++)
			{
				float num = (60f * (float)i + 90f) * (MathF.PI / 180f);
				verts[i] = new Vector2(0.5f + 0.45f * Mathf.Cos(num), 0.5f + 0.45f * Mathf.Sin(num));
			}
			return Bake(size, delegate(int x, int y)
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: Unknown result type (might be due to invalid IL or missing references)
				//IL_0046: 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_0049: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				Vector2 p = default(Vector2);
				((Vector2)(ref p))..ctor((float)x + 0.5f, (float)y + 0.5f);
				int num2 = 0;
				float num3 = float.MaxValue;
				for (int j = 0; j < 6; j++)
				{
					Vector2 a = verts[j];
					Vector2 b = verts[(j + 1) % 6];
					float num4 = Sign(p, a, b);
					int num5 = ((num4 > 0f) ? 1 : ((num4 < 0f) ? (-1) : 0));
					if (num5 != 0)
					{
						if (num2 == 0)
						{
							num2 = num5;
						}
						else if (num5 != num2)
						{
							return Color.clear;
						}
					}
					num3 = Mathf.Min(num3, Mathf.Abs(num4));
				}
				float num6 = Mathf.Clamp01(num3 + 0.5f);
				return new Color(1f, 1f, 1f, num6);
			});
		}

		private static float Sign(Vector2 p, Vector2 a, Vector2 b)
		{
			//IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			return (b.x - a.x) * (p.y - a.y) - (a.y - b.y) * (p.x - a.x);
		}

		public static Sprite MakeSprite(Texture2D tex)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f));
		}
	}
}
namespace OpenMinimap.UI
{
	public sealed class CompassView
	{
		private readonly struct Label
		{
			public readonly float Angle;

			public readonly bool Cardinal;

			public readonly RectTransform Rect;

			public Label(float angle, bool cardinal, RectTransform rect)
			{
				Angle = angle;
				Cardinal = cardinal;
				Rect = rect;
			}
		}

		private const float SpanDeg = 90f;

		private const float Height = 30f;

		private static readonly string[] Names = new string[8] { "N", "NE", "E", "SE", "S", "SW", "W", "NW" };

		private static readonly float[] Angles = new float[8] { 0f, 45f, 90f, 135f, 180f, 225f, 270f, 315f };

		private readonly GameObject _root;

		private readonly RectTransform _rootRect;

		private readonly CanvasGroup _group;

		private readonly RectTransform _markerContainer;

		private readonly List<Label> _labels = new List<Label>(8);

		private readonly List<RectTransform> _ticks = new List<RectTransform>(24);

		private readonly Dictionary<int, MarkerIcon.Instance> _icons = new Dictionary<int, MarkerIcon.Instance>(256);

		public CompassView(Transform parent)
		{
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0237: Unknown result type (might be due to invalid IL or missing references)
			//IL_023d: Expected O, but got Unknown
			//IL_024b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Expected O, but got Unknown
			//IL_0277: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			Sprite sprite = TextureGen.MakeSprite(TextureGen.SolidAlpha(4));
			_root = new GameObject("OpenMinimap.Compass", new Type[2]
			{
				typeof(RectTransform),
				typeof(CanvasGroup)
			});
			_root.layer = 5;
			_rootRect = (RectTransform)_root.transform;
			((Transform)_rootRect).SetParent(parent, false);
			_rootRect.anchorMin = new Vector2(0.5f, 1f);
			_rootRect.anchorMax = new Vector2(0.5f, 1f);
			_rootRect.pivot = new Vector2(0.5f, 1f);
			_rootRect.sizeDelta = new Vector2(480f, 30f);
			_rootRect.anchoredPosition = new Vector2(0f, -24f);
			_group = _root.GetComponent<CanvasGroup>();
			GameObject val = new GameObject("Backdrop", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			})
			{
				layer = 5
			};
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)_rootRect, false);
			val2.anchorMin = Vector2.zero;
			val2.anchorMax = Vector2.one;
			val2.offsetMin = Vector2.zero;
			val2.offsetMax = Vector2.zero;
			Image component = val.GetComponent<Image>();
			component.sprite = sprite;
			((Graphic)component).color = new Color(0.04f, 0.05f, 0.08f, 0.55f);
			((Graphic)component).raycastTarget = false;
			for (int i = 0; i < 8; i++)
			{
				_labels.Add(MakeLabel(Names[i], Angles[i], i == 0));
			}
			for (int j = 0; j < 24; j++)
			{
				_ticks.Add(MakeTick());
			}
			GameObject val3 = new GameObject("Markers", new Type[1] { typeof(RectTransform) });
			val3.layer = 5;
			_markerContainer = (RectTransform)val3.transform;
			((Transform)_markerContainer).SetParent((Transform)(object)_rootRect, false);
			_markerContainer.anchorMin = new Vector2(0.5f, 0.5f);
			_markerContainer.anchorMax = new Vector2(0.5f, 0.5f);
			_markerContainer.pivot = new Vector2(0.5f, 0.5f);
			_markerContainer.sizeDelta = Vector2.zero;
		}

		private Label MakeLabel(string text, float angle, bool cardinal)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("cardinal_" + text, new Type[1] { typeof(RectTransform) })
			{
				layer = 5
			};
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)_rootRect, false);
			val2.anchorMin = new Vector2(0.5f, 0.5f);
			val2.anchorMax = new Vector2(0.5f, 0.5f);
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.sizeDelta = new Vector2(30f, 30f);
			HGTextMeshProUGUI obj = val.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)obj).text = text;
			((TMP_Text)obj).fontSize = (cardinal ? 15f : 11f);
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((Graphic)obj).raycastTarget = false;
			((Graphic)obj).color = (cardinal ? new Color(0.95f, 0.85f, 0.7f, 1f) : new Color(0.9f, 0.9f, 0.95f, 0.7f));
			((TMP_Text)obj).fontStyle = (FontStyles)(cardinal ? 1 : 0);
			return new Label(angle, cardinal, val2);
		}

		private RectTransform MakeTick()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Expected O, but got Unknown
			GameObject val = new GameObject("tick", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.layer = 5;
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)_rootRect, false);
			val2.anchorMin = new Vector2(0.5f, 0.5f);
			val2.anchorMax = new Vector2(0.5f, 0.5f);
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.sizeDelta = new Vector2(1.5f, 5f);
			Image component = val.GetComponent<Image>();
			((Graphic)component).raycastTarget = false;
			((Graphic)component).color = new Color(0.9f, 0.9f, 0.95f, 0.35f);
			return val2;
		}

		public void SetVisible(bool visible)
		{
			if (_root.activeSelf != visible)
			{
				_root.SetActive(visible);
			}
		}

		public void CreateIcon(TrackedMarker m)
		{
			if (!_icons.ContainsKey(m.Id))
			{
				_icons[m.Id] = MarkerIcon.Create(_markerContainer, m, withChargeLabel: false, withDistanceLabel: true);
			}
		}

		public void DestroyIcon(TrackedMarker m)
		{
			if (_icons.TryGetValue(m.Id, out var value))
			{
				MarkerIcon.Instance instance = value;
				MarkerIcon.Destroy(ref instance);
				_icons.Remove(m.Id);
			}
		}

		public void Refresh(Transform cam)
		{
			//IL_001f: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_038b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0412: Unknown result type (might be due to invalid IL or missing references)
			//IL_0462: Unknown result type (might be due to invalid IL or missing references)
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_055e: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0622: Unknown result type (might be due to invalid IL or missing references)
			//IL_062e: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Unknown result type (might be due to invalid IL or missing references)
			MinimapConfig config = Plugin.Config;
			float num = config.CompassWidth.Value;
			_rootRect.sizeDelta = new Vector2(num, 30f);
			_rootRect.anchoredPosition = new Vector2(0f, (float)(-config.CompassOffsetY.Value));
			_group.alpha = (float)config.Opacity.Value / 100f;
			float y = cam.eulerAngles.y;
			float num2 = num / 90f;
			float num3 = 45f;
			float num4 = (config.CompassInvert.Value ? (-1f) : 1f);
			bool value = config.CompassIntercardinals.Value;
			bool value2 = config.CompassTicks.Value;
			foreach (Label label in _labels)
			{
				bool flag = label.Cardinal || value;
				if (flag)
				{
					float num5 = num4 * Mathf.DeltaAngle(label.Angle, y);
					flag = Mathf.Abs(num5) <= num3;
					if (flag)
					{
						label.Rect.anchoredPosition = new Vector2(num5 * num2, 0f);
					}
				}
				if (((Component)label.Rect).gameObject.activeSelf != flag)
				{
					((Component)label.Rect).gameObject.SetActive(flag);
				}
			}
			for (int i = 0; i < _ticks.Count; i++)
			{
				RectTransform val = _ticks[i];
				bool flag2 = value2;
				if (flag2)
				{
					float num6 = num4 * Mathf.DeltaAngle((float)i * 15f, y);
					flag2 = Mathf.Abs(num6) <= num3;
					if (flag2)
					{
						val.anchoredPosition = new Vector2(num6 * num2, -11.5f);
					}
				}
				if (((Component)val).gameObject.activeSelf != flag2)
				{
					((Component)val).gameObject.SetActive(flag2);
				}
			}
			bool value3 = config.CompassClampMarkers.Value;
			bool value4 = config.CompassCenterBoost.Value;
			bool value5 = config.CompassDistanceLabels.Value;
			float num7 = 12f;
			foreach (TrackedMarker item in MapScanner.Visible)
			{
				if (!_icons.TryGetValue(item.Id, out var value6) || (Object)(object)value6.Root == (Object)null)
				{
					continue;
				}
				if (!item.Show)
				{
					if (value6.Root.activeSelf)
					{
						value6.Root.SetActive(false);
					}
					continue;
				}
				float num8 = num4 * item.BearingDelta;
				bool flag3 = false;
				float num9;
				if (Mathf.Abs(num8) <= num3)
				{
					num9 = num8 * num2;
				}
				else
				{
					if (!value3)
					{
						if (value6.Root.activeSelf)
						{
							value6.Root.SetActive(false);
						}
						continue;
					}
					num9 = ((num8 > 0f) ? 1f : (-1f)) * (num * 0.5f - num7);
					flag3 = true;
				}
				float num10 = 1f - Mathf.Clamp01(Mathf.Abs(num8) / num3);
				float num11 = (value4 ? Mathf.Lerp(0.3f, 1f, num10) : 1f);
				float num12 = (value4 ? Mathf.Lerp(0.85f, 1.1f, num10) : 1f);
				if (!value6.Root.activeSelf)
				{
					value6.Root.SetActive(true);
				}
				value6.Root.transform.localPosition = new Vector3(num9, 0f, 0f);
				value6.Root.transform.localRotation = Quaternion.identity;
				RectTransform rectTransform = ((Graphic)value6.Image).rectTransform;
				float num13 = config.Kinds[item.Kind].Size.Value * config.IconScale.Value * (flag3 ? 0.85f : 1f) * num12;
				if (!Mathf.Approximately(rectTransform.sizeDelta.x, num13))
				{
					rectTransform.sizeDelta = new Vector2(num13, num13);
				}
				if ((Object)(object)value6.Image.sprite != (Object)(object)item.Sprite)
				{
					value6.Image.sprite = item.Sprite;
				}
				Color color = IconLibrary.GetColor(item, config.Kinds[item.Kind].Color.Value);
				if ((Object)(object)item.Purchase != (Object)null && !item.Purchase.available)
				{
					color.a = 0.35f;
				}
				if (flag3)
				{
					color.a *= 0.55f;
				}
				color.a *= num11;
				((Graphic)value6.Image).color = color;
				bool flag4 = config.ElevationArrows.Value && Mathf.Abs(item.YOffset) > config.ElevationThreshold.Value;
				if (((Component)value6.Elevation).gameObject.activeSelf != flag4)
				{
					((Component)value6.Elevation).gameObject.SetActive(flag4);
				}
				if (flag4)
				{
					((Transform)value6.ElevationRect).localRotation = Quaternion.Euler(0f, 0f, (item.YOffset > 0f) ? (-90f) : 90f);
					Color color2 = ((Graphic)value6.Elevation).color;
					float num14 = 0.95f * num11;
					if (!Mathf.Approximately(color2.a, num14))
					{
						color2.a = num14;
						((Graphic)value6.Elevation).color = color2;
					}
				}
				if (!((Object)(object)value6.DistanceText != (Object)null))
				{
					continue;
				}
				if (((Component)value6.DistanceRect).gameObject.activeSelf != value5)
				{
					((Component)value6.DistanceRect).gameObject.SetActive(value5);
				}
				if (value5)
				{
					string text = Mathf.RoundToInt(item.Distance) + "m";
					if (((TMP_Text)value6.DistanceText).text != text)
					{
						((TMP_Text)value6.DistanceText).text = text;
					}
					Color color3 = ((Graphic)value6.DistanceText).color;
					float num15 = 0.6f * num11;
					if (!Mathf.Approximately(color3.a, num15))
					{
						color3.a = num15;
						((Graphic)value6.DistanceText).color = color3;
					}
				}
			}
		}
	}
	internal static class MarkerIcon
	{
		public readonly struct Instance
		{
			public readonly GameObject Root;

			public readonly Image Image;

			public readonly Image Elevation;

			public readonly RectTransform ElevationRect;

			public readonly RectTransform ChargeRect;

			public readonly HGTextMeshProUGUI ChargeText;

			public readonly RectTransform DistanceRect;

			public readonly HGTextMeshProUGUI DistanceText;

			public Instance(GameObject root, Image image, Image elevation, RectTransform elevationRect, RectTransform chargeRect, HGTextMeshProUGUI chargeText, RectTransform distanceRect, HGTextMeshProUGUI distanceText)
			{
				Root = root;
				Image = image;
				Elevation = elevation;
				ElevationRect = elevationRect;
				ChargeRect = chargeRect;
				ChargeText = chargeText;
				DistanceRect = distanceRect;
				DistanceText = distanceText;
			}
		}

		public static Instance Create(RectTransform parent, TrackedMarker m, bool withChargeLabel = false, bool withDistanceLabel = false)
		{
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Expected O, but got Unknown
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0067: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_022a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Expected O, but got Unknown
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("icon_" + m.Kind, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.layer = 5;
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)parent, false);
			val2.anchorMin = new Vector2(0.5f, 0.5f);
			val2.anchorMax = new Vector2(0.5f, 0.5f);
			val2.pivot = new Vector2(0.5f, 0.5f);
			Image component = val.GetComponent<Image>();
			((Graphic)component).raycastTarget = false;
			((MaskableGraphic)component).maskable = true;
			component.sprite = m.Sprite;
			GameObject val3 = new GameObject("elevation", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			})
			{
				layer = 5
			};
			RectTransform val4 = (RectTransform)val3.transform;
			((Transform)val4).SetParent((Transform)(object)val2, false);
			val4.anchorMin = new Vector2(0.5f, 1f);
			val4.anchorMax = new Vector2(0.5f, 1f);
			val4.pivot = new Vector2(0.5f, 0.5f);
			val4.sizeDelta = new Vector2(9f, 9f);
			val4.anchoredPosition = new Vector2(0f, 7f);
			Image component2 = val3.GetComponent<Image>();
			((Graphic)component2).raycastTarget = false;
			component2.sprite = IconLibrary.ElevationChevron;
			((Graphic)component2).color = new Color(1f, 0.95f, 0.55f, 0.95f);
			val3.SetActive(false);
			RectTransform val5 = null;
			HGTextMeshProUGUI val6 = null;
			if (withChargeLabel)
			{
				GameObject val7 = new GameObject("charge", new Type[1] { typeof(RectTransform) })
				{
					layer = 5
				};
				val5 = (RectTransform)val7.transform;
				((Transform)val5).SetParent((Transform)(object)val2, false);
				val5.anchorMin = new Vector2(0.5f, 0f);
				val5.anchorMax = new Vector2(0.5f, 0f);
				val5.pivot = new Vector2(0.5f, 1f);
				val5.sizeDelta = new Vector2(80f, 16f);
				val5.anchoredPosition = new Vector2(0f, -4f);
				val6 = val7.AddComponent<HGTextMeshProUGUI>();
				((TMP_Text)val6).fontSize = 11f;
				((TMP_Text)val6).alignment = (TextAlignmentOptions)514;
				((Graphic)val6).raycastTarget = false;
				((Graphic)val6).color = new Color(1f, 1f, 1f, 0.95f);
				((TMP_Text)val6).text = "0%";
				val7.SetActive(false);
			}
			RectTransform val8 = null;
			HGTextMeshProUGUI val9 = null;
			if (withDistanceLabel)
			{
				GameObject val10 = new GameObject("distance", new Type[1] { typeof(RectTransform) })
				{
					layer = 5
				};
				val8 = (RectTransform)val10.transform;
				((Transform)val8).SetParent((Transform)(object)val2, false);
				val8.anchorMin = new Vector2(0.5f, 0f);
				val8.anchorMax = new Vector2(0.5f, 0f);
				val8.pivot = new Vector2(0.5f, 1f);
				val8.sizeDelta = new Vector2(70f, 14f);
				val8.anchoredPosition = new Vector2(0f, -4f);
				val9 = val10.AddComponent<HGTextMeshProUGUI>();
				((TMP_Text)val9).fontSize = 9f;
				((TMP_Text)val9).alignment = (TextAlignmentOptions)514;
				((Graphic)val9).raycastTarget = false;
				((Graphic)val9).color = new Color(1f, 1f, 1f, 0.55f);
				((TMP_Text)val9).text = "0m";
				val10.SetActive(false);
			}
			return new Instance(val, component, component2, val4, val5, val6, val8, val9);
		}

		public static void Destroy(ref Instance instance)
		{
			if (Object.op_Implicit((Object)(object)instance.Root))
			{
				Object.Destroy((Object)(object)instance.Root);
			}
		}
	}
	[DisallowMultipleComponent]
	public sealed class MinimapController : MonoBehaviour
	{
		private HUD _hud;

		private MinimapView _minimap;

		private CompassView _compass;

		private void Awake()
		{
			_hud = ((Component)this).GetComponent<HUD>();
			Transform transform = ((Component)this).transform;
			if (Object.op_Implicit((Object)(object)_hud) && Object.op_Implicit((Object)(object)_hud.mainUIPanel))
			{
				Canvas componentInParent = _hud.mainUIPanel.GetComponentInParent<Canvas>();
				if (Object.op_Implicit((Object)(object)componentInParent))
				{
					transform = ((Component)componentInParent).transform;
				}
			}
			_minimap = new MinimapView(transform);
			_compass = new CompassView(transform);
			MapScanner.MarkerAdded += OnMarkerAdded;
			MapScanner.MarkerRemoved += OnMarkerRemoved;
			foreach (TrackedMarker item in MapScanner.All)
			{
				OnMarkerAdded(item);
			}
		}

		private void OnDestroy()
		{
			MapScanner.MarkerAdded -= OnMarkerAdded;
			MapScanner.MarkerRemoved -= OnMarkerRemoved;
		}

		private void OnMarkerAdded(TrackedMarker m)
		{
			m.Sprite = IconLibrary.ResolveSprite(m, Plugin.Config.Kinds[m.Kind].Icon.Value);
			_minimap.CreateIcon(m);
			_compass.CreateIcon(m);
		}

		private void OnMarkerRemoved(TrackedMarker m)
		{
			_minimap.DestroyIcon(m);
			_compass.DestroyIcon(m);
		}

		private void Update()
		{
			//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_0014: Unknown result type (might be due to invalid IL or missing references)
			MinimapConfig config = Plugin.Config;
			KeyboardShortcut value = config.ToggleKey.Value;
			if ((int)((KeyboardShortcut)(ref value)).MainKey != 0 && ((KeyboardShortcut)(ref value)).IsDown())
			{
				config.Enabled.Value = !config.Enabled.Value;
			}
			MapScanner.Update();
			CameraRigController val = ((Object.op_Implicit((Object)(object)_hud) && Object.op_Implicit((Object)(object)_hud.cameraRigController)) ? _hud.cameraRigController : null);
			Transform val2 = ((Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.sceneCam)) ? ((Component)val.sceneCam).transform : null);
			CharacterBody val3 = (Object.op_Implicit((Object)(object)val) ? val.targetBody : null);
			bool flag = config.Enabled.Value && (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null;
			if (flag)
			{
				ComputeFrameData(val2, val3);
			}
			DisplayMode value2 = config.Display.Value;
			_minimap.SetVisible(flag && value2 != DisplayMode.Compass);
			_compass.SetVisible(flag && value2 != DisplayMode.Minimap);
			if (flag)
			{
				_minimap.Refresh(val2);
				_compass.Refresh(val2);
			}
		}

		private void ComputeFrameData(Transform cam, CharacterBody body)
		{
			//IL_0007: 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_001d: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			MinimapConfig config = Plugin.Config;
			float y = cam.eulerAngles.y;
			Vector3 position = ((Component)body).transform.position;
			foreach (TrackedMarker item in MapScanner.Visible)
			{
				if (!Object.op_Implicit((Object)(object)item.Transform))
				{
					item.Show = false;
					continue;
				}
				Vector3 val = item.Transform.position - position;
				item.Delta = new Vector2(val.x, val.z);
				item.Distance = ((Vector2)(ref item.Delta)).magnitude;
				item.YOffset = val.y;
				item.Bearing = Mathf.Atan2(val.x, val.z) * 57.29578f;
				item.BearingDelta = Mathf.DeltaAngle(item.Bearing, y);
				item.Sprite = IconLibrary.ResolveSprite(item, config.Kinds[item.Kind].Icon.Value);
				item.Show = config.IsKindVisible(item.Kind) && item.Body != body;
			}
		}
	}
	public sealed class MinimapView
	{
		private readonly GameObject _root;

		private readonly RectTransform _rootRect;

		private readonly CanvasGroup _group;

		private readonly RectTransform _container;

		private readonly RectTransform _playerArrow;

		private readonly Image _backdrop;

		private readonly Image _maskImage;

		private readonly Image _border;

		private readonly RectTransform _coneRect;

		private readonly List<RectTransform> _rings = new List<RectTransform>(4);

		private readonly RectTransform _northRect;

		private readonly RectTransform _stageRect;

		private readonly HGTextMeshProUGUI _stageLabel;

		private readonly Dictionary<int, MarkerIcon.Instance> _icons = new Dictionary<int, MarkerIcon.Instance>(256);

		private readonly Dictionary<int, RectTransform> _chargeRings = new Dictionary<int, RectTransform>(4);

		private static Sprite _circleSprite;

		private static Sprite _circleRingSprite;

		private static Sprite _squareRingSprite;

		private static Sprite _whiteSprite;

		public MinimapView(Transform parent)
		{
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Expected O, but got Unknown
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018a: Expected O, but got Unknown
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f7: Expected O, but got Unknown
			//IL_0214: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0287: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Expected O, but got Unknown
			//IL_029b: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a5: Expected O, but got Unknown
			//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_037e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_038a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0390: Unknown result type (might be due to invalid IL or missing references)
			//IL_0397: Expected O, but got Unknown
			//IL_03b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_046a: Expected O, but got Unknown
			//IL_047a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Expected O, but got Unknown
			//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04da: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0530: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Unknown result type (might be due to invalid IL or missing references)
			//IL_057e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ac: Expected O, but got Unknown
			//IL_05bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c6: Expected O, but got Unknown
			//IL_05e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0602: Unknown result type (might be due to invalid IL or missing references)
			//IL_061c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0636: Unknown result type (might be due to invalid IL or missing references)
			//IL_068a: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b3: Expected O, but got Unknown
			//IL_06c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06cd: Expected O, but got Unknown
			//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0709: Unknown result type (might be due to invalid IL or missing references)
			//IL_0723: Unknown result type (might be due to invalid IL or missing references)
			//IL_073d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0757: Unknown result type (might be due to invalid IL or missing references)
			//IL_07b4: Unknown result type (might be due to invalid IL or missing references)
			EnsureSprites();
			_root = new GameObject("OpenMinimap.Minimap", new Type[2]
			{
				typeof(RectTransform),
				typeof(CanvasGroup)
			});
			_root.layer = 5;
			_rootRect = (RectTransform)_root.transform;
			((Transform)_rootRect).SetParent(parent, false);
			_rootRect.anchorMin = new Vector2(1f, 1f);
			_rootRect.anchorMax = new Vector2(1f, 1f);
			_rootRect.pivot = new Vector2(1f, 1f);
			_rootRect.sizeDelta = new Vector2(280f, 280f);
			_group = _root.GetComponent<CanvasGroup>();
			_backdrop = AddStretched(_rootRect, "Backdrop", _whiteSprite, new Color(0.04f, 0.05f, 0.08f, 0.7f));
			GameObject val = new GameObject("Mask", new Type[3]
			{
				typeof(RectTransform),
				typeof(Image),
				typeof(Mask)
			});
			val.layer = 5;
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)_rootRect, false);
			Stretch(val2);
			_maskImage = val.GetComponent<Image>();
			((Graphic)_maskImage).raycastTarget = false;
			val.GetComponent<Mask>().showMaskGraphic = false;
			GameObject val3 = new GameObject("Container", new Type[1] { typeof(RectTransform) });
			val3.layer = 5;
			_container = (RectTransform)val3.transform;
			((Transform)_container).SetParent((Transform)(object)val2, false);
			_container.anchorMin = new Vector2(0.5f, 0.5f);
			_container.anchorMax = new Vector2(0.5f, 0.5f);
			_container.pivot = new Vector2(0.5f, 0.5f);
			_container.sizeDelta = Vector2.zero;
			GameObject val4 = new GameObject("ViewCone", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val4.layer = 5;
			_coneRect = (RectTransform)val4.transform;
			((Transform)_coneRect).SetParent((Transform)(object)_container, false);
			_coneRect.anchorMin = new Vector2(0.5f, 0.5f);
			_coneRect.anchorMax = new Vector2(0.5f, 0.5f);
			_coneRect.pivot = new Vector2(0.5f, 0.5f);
			Image component = val4.GetComponent<Image>();
			component.sprite = TextureGen.MakeSprite(TextureGen.ConeAlpha(256));
			((Graphic)component).color = new Color(0.75f, 0.85f, 1f, 0.9f);
			((Graphic)component).raycastTarget = false;
			for (int i = 0; i < 4; i++)
			{
				GameObject val5 = new GameObject("distance_ring_" + i, new Type[2]
				{
					typeof(RectTransform),
					typeof(Image)
				})
				{
					layer = 5
				};
				RectTransform val6 = (RectTransform)val5.transform;
				((Transform)val6).SetParent((Transform)(object)_container, false);
				val6.anchorMin = new Vector2(0.5f, 0.5f);
				val6.anchorMax = new Vector2(0.5f, 0.5f);
				val6.pivot = new Vector2(0.5f, 0.5f);
				Image component2 = val5.GetComponent<Image>();
				component2.sprite = _circleRingSprite;
				((Graphic)component2).color = new Color(1f, 1f, 1f, 0.16f);
				((Graphic)component2).raycastTarget = false;
				val5.SetActive(false);
				_rings.Add(val6);
			}
			GameObject val7 = new GameObject("PlayerArrow", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val7.layer = 5;
			_playerArrow = (RectTransform)val7.transform;
			((Transform)_playerArrow).SetParent((Transform)(object)_rootRect, false);
			_playerArrow.anchorMin = new Vector2(0.5f, 0.5f);
			_playerArrow.anchorMax = new Vector2(0.5f, 0.5f);
			_playerArrow.pivot = new Vector2(0.5f, 0.5f);
			_playerArrow.sizeDelta = new Vector2(26f, 26f);
			Image component3 = val7.GetComponent<Image>();
			((Graphic)component3).raycastTarget = false;
			component3.sprite = IconLibrary.Load("Textures/MiscIcons/texOptionsArrowLeft");
			((Graphic)component3).color = new Color(1f, 1f, 1f, 0.95f);
			((Transform)_playerArrow).localRotation = Quaternion.Euler(0f, 0f, -90f);
			_border = AddStretched(_rootRect, "Border", _circleRingSprite, new Color(0.85f, 0.85f, 0.9f, 0.8f));
			GameObject val8 = new GameObject("NorthMarker", new Type[1] { typeof(RectTransform) });
			val8.layer = 5;
			_northRect = (RectTransform)val8.transform;
			((Transform)_northRect).SetParent((Transform)(object)_rootRect, false);
			_northRect.anchorMin = new Vector2(0.5f, 0.5f);
			_northRect.anchorMax = new Vector2(0.5f, 0.5f);
			_northRect.pivot = new Vector2(0.5f, 0.5f);
			_northRect.sizeDelta = new Vector2(24f, 20f);
			HGTextMeshProUGUI obj = val8.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)obj).text = "N";
			((TMP_Text)obj).fontSize = 14f;
			((TMP_Text)obj).fontStyle = (FontStyles)1;
			((TMP_Text)obj).alignment = (TextAlignmentOptions)514;
			((Graphic)obj).raycastTarget = false;
			((Graphic)obj).color = new Color(1f, 0.82f, 0.35f, 0.9f);
			GameObject val9 = new GameObject("StageInfo", new Type[1] { typeof(RectTransform) });
			val9.layer = 5;
			_stageRect = (RectTransform)val9.transform;
			((Transform)_stageRect).SetParent((Transform)(object)_rootRect, false);
			_stageRect.anchorMin = new Vector2(0.5f, 0f);
			_stageRect.anchorMax = new Vector2(0.5f, 0f);
			_stageRect.pivot = new Vector2(0.5f, 1f);
			_stageRect.sizeDelta = new Vector2(280f, 26f);
			_stageRect.anchoredPosition = new Vector2(0f, -6f);
			_stageLabel = val9.AddComponent<HGTextMeshProUGUI>();
			((TMP_Text)_stageLabel).fontSize = 11f;
			((TMP_Text)_stageLabel).alignment = (TextAlignmentOptions)258;
			((Graphic)_stageLabel).raycastTarget = false;
			((Graphic)_stageLabel).color = new Color(0.9f, 0.9f, 0.95f, 0.8f);
		}

		public void SetVisible(bool visible)
		{
			if (_root.activeSelf != visible)
			{
				_root.SetActive(visible);
			}
		}

		public void CreateIcon(TrackedMarker m)
		{
			bool flag = m.Kind == MapKind.Teleporter;
			_icons[m.Id] = MarkerIcon.Create(_container, m, flag);
			if (flag)
			{
				_chargeRings[m.Id] = MakeChargeRing();
			}
		}

		private RectTransform MakeChargeRing()
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: 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_0089: 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_00b3: Expected O, but got Unknown
			GameObject val = new GameObject("charge_radius", new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			});
			val.layer = 5;
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)_container, false);
			val2.anchorMin = new Vector2(0.5f, 0.5f);
			val2.anchorMax = new Vector2(0.5f, 0.5f);
			val2.pivot = new Vector2(0.5f, 0.5f);
			((Transform)val2).localRotation = Quaternion.identity;
			Image component = val.GetComponent<Image>();
			component.sprite = _circleRingSprite;
			((Graphic)component).raycastTarget = false;
			val.SetActive(false);
			return val2;
		}

		public void DestroyIcon(TrackedMarker m)
		{
			if (_icons.TryGetValue(m.Id, out var value))
			{
				MarkerIcon.Instance instance = value;
				MarkerIcon.Destroy(ref instance);
				_icons.Remove(m.Id);
			}
			if (_chargeRings.TryGetValue(m.Id, out var value2))
			{
				if (Object.op_Implicit((Object)(object)value2))
				{
					Object.Destroy((Object)(object)((Component)value2).gameObject);
				}
				_chargeRings.Remove(m.Id);
			}
		}

		public void Refresh(Transform cam)
		{
			//IL_001c: 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_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_032b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_035a: Unknown result type (might be due to invalid IL or missing references)
			//IL_058d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0594: Unknown result type (might be due to invalid IL or missing references)
			//IL_0599: Unknown result type (might be due to invalid IL or missing references)
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0624: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06db: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0712: Unknown result type (might be due to invalid IL or missing references)
			//IL_0789: Unknown result type (might be due to invalid IL or missing references)
			//IL_0852: Unknown result type (might be due to invalid IL or missing references)
			//IL_0854: Unknown result type (might be due to invalid IL or missing references)
			//IL_086d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0899: Unknown result type (might be due to invalid IL or missing references)
			//IL_089b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bb: Unknown result type (might be due to invalid IL or missing references)
			MinimapConfig config = Plugin.Config;
			int value = config.MapSize.Value;
			_rootRect.sizeDelta = new Vector2((float)value, (float)value);
			_rootRect.anchoredPosition = new Vector2((float)(-config.MapOffsetX.Value), (float)(-config.MapOffsetY.Value));
			_group.alpha = (float)config.Opacity.Value / 100f;
			bool num = config.Shape.Value == MapShape.Circle;
			Sprite val = (num ? _circleSprite : _whiteSprite);
			if ((Object)(object)_maskImage.sprite != (Object)(object)val)
			{
				_maskImage.sprite = val;
				_backdrop.sprite = val;
			}
			Sprite val2 = (num ? _circleRingSprite : _squareRingSprite);
			if ((Object)(object)_border.sprite != (Object)(object)val2)
			{
				_border.sprite = val2;
			}
			float y = cam.eulerAngles.y;
			bool flag = config.Orientation.Value == MapOrientation.RotateWithPlayer;
			((Transform)_container).localRotation = (flag ? Quaternion.Euler(0f, 0f, y) : Quaternion.identity);
			if (!flag)
			{
				float num2 = y * (MathF.PI / 180f);
				float num3 = Mathf.Atan2(0f - Mathf.Cos(num2), 0f - Mathf.Sin(num2)) * 57.29578f;
				((Transform)_playerArrow).localRotation = Quaternion.Euler(0f, 0f, num3);
			}
			else
			{
				((Transform)_playerArrow).localRotation = Quaternion.Euler(0f, 0f, -90f);
			}
			float num4 = (float)value * 0.5f;
			float num5 = Mathf.Max(10f, num4 - 10f);
			float value2 = config.Zoom.Value;
			float value3 = config.IconScale.Value;
			bool value4 = config.ClampToEdge.Value;
			bool value5 = config.ElevationArrows.Value;
			float value6 = config.ElevationThreshold.Value;
			Quaternion localRotation = (flag ? Quaternion.Euler(0f, 0f, 0f - y) : Quaternion.identity);
			bool value7 = config.ShowViewCone.Value;
			((Component)_coneRect).gameObject.SetActive(value7);
			if (value7)
			{
				float num6 = num5 * 1.9f;
				if (!Mathf.Approximately(_coneRect.sizeDelta.x, num6))
				{
					_coneRect.sizeDelta = new Vector2(num6, num6);
				}
				((Transform)_coneRect).localPosition = Vector3.zero;
				((Transform)_coneRect).localRotation = (flag ? Quaternion.identity : Quaternion.Euler(0f, 0f, 0f - y));
			}
			bool value8 = config.ShowDistanceRings.Value;
			float num7 = Mathf.Max(10f, (float)config.DistanceRingSpacing.Value);
			for (int i = 0; i < _rings.Count; i++)
			{
				RectTransform val3 = _rings[i];
				float num8 = (float)(i + 1) * num7 * value2;
				bool flag2 = value8 && num8 <= num5 * 0.98f && num8 > 4f;
				if (((Component)val3).gameObject.activeSelf != flag2)
				{
					((Component)val3).gameObject.SetActive(flag2);
				}
				if (flag2)
				{
					((Transform)val3).localPosition = Vector3.zero;
					float num9 = num8 * 2f;
					if (!Mathf.Approximately(val3.sizeDelta.x, num9))
					{
						val3.sizeDelta = new Vector2(num9, num9);
					}
				}
			}
			bool value9 = config.ShowNorthMarker.Value;
			((Component)_northRect).gameObject.SetActive(value9);
			if (value9)
			{
				Vector2 anchoredPosition = (Vector2)(flag ? (new Vector2(0f - Mathf.Sin(y * (MathF.PI / 180f)), Mathf.Cos(y * (MathF.PI / 180f))) * (num5 - 12f)) : new Vector2(0f, num5 - 12f));
				_northRect.anchoredPosition = anchoredPosition;
			}
			bool value10 = config.ShowStageInfo.Value;
			((Component)_stageRect).gameObject.SetActive(value10);
			if (value10)
			{
				_stageRect.sizeDelta = new Vector2((float)value, 26f);
				string text = null;
				SceneInfo instance = SceneInfo.instance;
				if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.sceneDef))
				{
					text = Language.GetString(instance.sceneDef.nameToken);
				}
				foreach (TrackedMarker item in MapScanner.Visible)
				{
					if (item.Kind == MapKind.Teleporter && (Object)(object)item.Teleporter != (Object)null)
					{
						text = (string.IsNullOrEmpty(text) ? "" : (text + "  ·  ")) + "TP " + Mathf.RoundToInt(item.Distance) + "m";
						break;
					}
				}
				if (!string.IsNullOrEmpty(text) && ((TMP_Text)_stageLabel).text != text)
				{
					((TMP_Text)_stageLabel).text = text;
				}
			}
			foreach (TrackedMarker item2 in MapScanner.Visible)
			{
				if (!_icons.TryGetValue(item2.Id, out var value11) || (Object)(object)value11.Root == (Object)null)
				{
					continue;
				}
				if (!item2.Show)
				{
					if (value11.Root.activeSelf)
					{
						value11.Root.SetActive(false);
					}
					continue;
				}
				Vector2 val4 = item2.Delta * value2;
				float magnitude = ((Vector2)(ref val4)).magnitude;
				bool flag3 = false;
				if (magnitude > num5)
				{
					if (!value4)
					{
						if (value11.Root.activeSelf)
						{
							value11.Root.SetActive(false);
						}
						continue;
					}
					val4 *= num5 / magnitude;
					flag3 = true;
				}
				if (!value11.Root.activeSelf)
				{
					value11.Root.SetActive(true);
				}
				value11.Root.transform.localPosition = Vector2.op_Implicit(val4);
				value11.Root.transform.localRotation = localRotation;
				RectTransform rectTransform = ((Graphic)value11.Image).rectTransform;
				float num10 = config.Kinds[item2.Kind].Size.Value * value3 * (flag3 ? 0.85f : 1f);
				if (!Mathf.Approximately(rectTransform.sizeDelta.x, num10))
				{
					rectTransform.sizeDelta = new Vector2(num10, num10);
				}
				if ((Object)(object)value11.Image.sprite != (Object)(object)item2.Sprite)
				{
					value11.Image.sprite = item2.Sprite;
				}
				Color color = IconLibrary.GetColor(item2, config.Kinds[item2.Kind].Color.Value);
				if ((Object)(object)item2.Purchase != (Object)null && !item2.Purchase.available)
				{
					color.a = 0.35f;
				}
				((Graphic)value11.Image).color = color;
				bool flag4 = value5 && Mathf.Abs(item2.YOffset) > value6;
				if (((Component)value11.Elevation).gameObject.activeSelf != flag4)
				{
					((Component)value11.Elevation).gameObject.SetActive(flag4);
				}
				if (flag4)
				{
					((Transform)value11.ElevationRect).localRotation = Quaternion.Euler(0f, 0f, (item2.YOffset > 0f) ? (-90f) : 90f);
				}
				bool flag5 = item2.Kind == MapKind.Teleporter && (Object)(object)item2.Teleporter != (Object)null;
				bool flag6 = !flag3;
				if (_chargeRings.TryGetValue(item2.Id, out var value12))
				{
					float num11 = ((flag5 && Object.op_Implicit((Object)(object)item2.Teleporter.holdoutZoneController)) ? item2.Teleporter.holdoutZoneController.currentRadius : 0f);
					bool flag7 = flag5 && flag6 && num11 > 1f && value2 * num11 * 2f <= (float)value * 3f;
					if (((Component)value12).gameObject.activeSelf != flag7)
					{
						((Component)value12).gameObject.SetActive(flag7);
					}
					if (flag7)
					{
						((Transform)value12).localPosition = Vector2.op_Implicit(val4);
						float num12 = num11 * 2f * value2;
						if (!Mathf.Approximately(value12.sizeDelta.x, num12))
						{
							value12.sizeDelta = new Vector2(num12, num12);
						}
						Image component = ((Component)value12).GetComponent<Image>();
						Color val5 = color;
						val5.a = 0.3f;
						if (((Graphic)component).color != val5)
						{
							((Graphic)component).color = val5;
						}
					}
				}
				if (!((Object)(object)value11.ChargeText != (Object)null))
				{
					continue;
				}
				bool flag8 = flag5 && flag6 && item2.Teleporter.isCharging;
				if (((Component)value11.ChargeRect).gameObject.activeSelf != flag8)
				{
					((Component)value11.ChargeRect).gameObject.SetActive(flag8);
				}
				if (flag8)
				{
					string text2 = Mathf.RoundToInt(Mathf.Clamp01(item2.Teleporter.chargeFraction) * 100f) + "%";
					if (((TMP_Text)value11.ChargeText).text != text2)
					{
						((TMP_Text)value11.ChargeText).text = text2;
					}
				}
			}
		}

		private static void EnsureSprites()
		{
			if (!((Object)(object)_circleSprite != (Object)null))
			{
				_circleSprite = TextureGen.MakeSprite(TextureGen.CircleAlpha(256));
				_circleRingSprite = TextureGen.MakeSprite(TextureGen.RingAlpha(256, 3f));
				_squareRingSprite = TextureGen.MakeSprite(TextureGen.RectRingAlpha(256, 3f));
				_whiteSprite = TextureGen.MakeSprite(TextureGen.SolidAlpha(4));
			}
		}

		private static void Stretch(RectTransform rt)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			rt.anchorMin = Vector2.zero;
			rt.anchorMax = Vector2.one;
			rt.pivot = new Vector2(0.5f, 0.5f);
			rt.offsetMin = Vector2.zero;
			rt.offsetMax = Vector2.zero;
		}

		private static Image AddStretched(RectTransform parent, string name, Sprite sprite, Color color)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject(name, new Type[2]
			{
				typeof(RectTransform),
				typeof(Image)
			})
			{
				layer = 5
			};
			RectTransform val2 = (RectTransform)val.transform;
			((Transform)val2).SetParent((Transform)(object)parent, false);
			Stretch(val2);
			Image component = val.GetComponent<Image>();
			component.sprite = sprite;
			((Graphic)component).color = color;
			((Graphic)component).raycastTarget = false;
			return component;
		}
	}
}
namespace OpenMinimap.Tracking
{
	public static class IconLibrary
	{
		public readonly struct KindDefault
		{
			public readonly MapIcon Icon;

			public readonly Color Color;

			public readonly float Size;

			public KindDefault(MapIcon icon, Color color, float size)
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				Icon = icon;
				Color = color;
				Size = size;
			}
		}

		private const string MysteryIcon = "Textures/MiscIcons/texMysteryIcon";

		private const string ElevationIcon = "Textures/MiscIcons/texOptionsArrowLeft";

		private static readonly Dictionary<string, Sprite> Cache = new Dictionary<string, Sprite>();

		private static readonly Dictionary<int, Sprite> PortraitCache = new Dictionary<int, Sprite>();

		private static readonly HashSet<string> Warned = new HashSet<string>();

		private static Sprite _dotSprite;

		private static Sprite _triangleSprite;

		private static Sprite _ringSprite;

		private static Sprite _hexSprite;

		private static readonly Dictionary<MapKind, KindDefault> Defaults = new Dictionary<MapKind, KindDefault>
		{
			{
				MapKind.Chest,
				new KindDefault(MapIcon.ChestOutlined, Color.white, 24f)
			},
			{
				MapKind.GoldChest,
				new KindDefault(MapIcon.ChestOutlined, new Color(1f, 0.3f, 0.25f), 26f)
			},
			{
				MapKind.CategoryChest,
				new KindDefault(MapIcon.Chest, Color.white, 24f)
			},
			{
				MapKind.Shrine,
				new KindDefault(MapIcon.Shrine, Color.white, 24f)
			},
			{
				MapKind.NewtAltar,
				new KindDefault(MapIcon.LunarPillar, new Color(0.75f, 0.8f, 1f), 24f)
			},
			{
				MapKind.Drone,
				new KindDefault(MapIcon.Drone, Color.white, 20f)
			},
			{
				MapKind.DroneBroken,
				new KindDefault(MapIcon.Drone, new Color(0.62f, 0.62f, 0.68f), 20f)
			},
			{
				MapKind.Scrapper,
				new KindDefault(MapIcon.WIP, Color.white, 22f)
			},
			{
				MapKind.Printer,
				new KindDefault(MapIcon.Edit, Color.white, 22f)
			},
			{
				MapKind.Multishop,
				new KindDefault(MapIcon.Chest, Color.white, 22f)
			},
			{
				MapKind.MultishopTriple,
				new KindDefault(MapIcon.Ring, new Color(1f, 0.85f, 0.35f), 26f)
			},
			{
				MapKind.EquipmentBarrel,
				new KindDefault(MapIcon.Barrel, new Color(1f, 0.62f, 0.18f), 22f)
			},
			{
				MapKind.Barrel,
				new KindDefault(MapIcon.Barrel, Color.white, 20f)
			},
			{
				MapKind.Teleporter,
				new KindDefault(MapIcon.Teleporter, Color.white, 28f)
			},
			{
				MapKind.Portal,
				new KindDefault(MapIcon.Quickplay, Color.white, 22f)
			},
			{
				MapKind.VoidPotential,
				new KindDefault(MapIcon.Loot, new Color(0.8f, 0.55f, 1f), 20f)
			},
			{
				MapKind.CommandCube,
				new KindDefault(MapIcon.Loot, new Color(1f, 0.95f, 0.45f), 20f)
			},
			{
				MapKind.Relic,
				new KindDefault(MapIcon.Hex, new Color(0.55f, 1f, 0.8f), 22f)
			},
			{
				MapKind.GroundItem,
				new KindDefault(MapIcon.Dot, Color.white, 14f)
			},
			{
				MapKind.Enemy,
				new KindDefault(MapIcon.Attack, new Color(1f, 0.45f, 0.4f), 16f)
			},
			{
				MapKind.EnemyElite,
				new KindDefault(MapIcon.Attack, new Color(1f, 0.32f, 0.12f), 17f)
			},
			{
				MapKind.EnemyBoss,
				new KindDefault(MapIcon.Attack, new Color(1f, 0.12f, 0.1f), 20f)
			},
			{
				MapKind.Minion,
				new KindDefault(MapIcon.Drone, new Color(0.45f, 1f, 0.9f), 18f)
			},
			{
				MapKind.OtherPlayer,
				new KindDefault(MapIcon.Sprint, new Color(0.5f, 0.9f, 1f), 18f)
			},
			{
				MapKind.Other,
				new KindDefault(MapIcon.Mystery, Color.white, 20f)
			}
		};

		public static Sprite ElevationChevron => Load("Textures/MiscIcons/texOptionsArrowLeft");

		private static string IconPath(MapIcon icon)
		{
			return icon switch
			{
				MapIcon.ChestOutlined => "Textures/MiscIcons/texInventoryIconOutlined", 
				MapIcon.Chest => "Textures/MiscIcons/texInventoryIcon", 
				MapIcon.Shrine => "Textures/MiscIcons/texShrineIconOutlined", 
				MapIcon.Teleporter => "Textures/MiscIcons/texTeleporterIconOutlined", 
				MapIcon.TeleporterAlt => "Textures/MiscIcons/texTeleporterIcon", 
				MapIcon.Drone => "Textures/MiscIcons/texDroneIconOutlined", 
				MapIcon.Barrel => "Textures/MiscIcons/texBarrelIcon", 
				MapIcon.Loot => "Textures/MiscIcons/texLootIconOutlined", 
				MapIcon.Mystery => "Textures/MiscIcons/texMysteryIcon", 
				MapIcon.WIP => "Textures/MiscIcons/texWIPIcon", 
				MapIcon.Attack => "Textures/MiscIcons/texAttackIcon", 
				MapIcon.Sprint => "Textures/MiscIcons/texSprintIcon", 
				MapIcon.Quickplay => "Textures/MiscIcons/texQuickplay", 
				MapIcon.LunarPillar => "Textures/MiscIcons/texLunarPillarIcon", 
				MapIcon.Edit => "Textures/MiscIcons/texEditIcon", 
				MapIcon.RescueShip => "Textures/MiscIcons/texRescueshipIcon", 
				MapIcon.Hurt => "Textures/MiscIcons/texCriticallyHurtIcon", 
				MapIcon.Unlock => "Textures/MiscIcons/texUnlockIcon", 
				MapIcon.Arrow => "Textures/MiscIcons/texOptionsArrowLeft", 
				MapIcon.Randomize => "Textures/MiscIcons/texRandomizeIcon", 
				MapIcon.RandomMap => "Textures/MiscIcons/texRuleMapIsRandom", 
				_ => null, 
			};
		}

		public static Sprite Load(string path)
		{
			if (path == null)
			{
				return null;
			}
			if (Cache.TryGetValue(path, out var value))
			{
				return value;
			}
			Sprite val = null;
			try
			{
				val = LegacyResourcesAPI.Load<Sprite>(path);
			}
			catch (Exception)
			{
			}
			if ((Object)(object)val == (Object)null && Warned.Add(path))
			{
				Plugin.Log.LogWarning((object)("Sprite not found: '" + path + "'."));
			}
			Cache[path] = val;
			return val;
		}

		public static Sprite GetSprite(MapIcon icon)
		{
			switch (icon)
			{
			case MapIcon.Dot:
				if ((Object)(object)_dotSprite == (Object)null)
				{
					_dotSprite = TextureGen.MakeSprite(TextureGen.CircleAlpha(64));
				}
				return _dotSprite;
			case MapIcon.Triangle:
				if ((Object)(object)_triangleSprite == (Object)null)
				{
					_triangleSprite = TextureGen.MakeSprite(TextureGen.TriangleAlpha(64));
				}
				return _triangleSprite;
			case MapIcon.Ring:
				if ((Object)(object)_ringSprite == (Object)null)
				{
					_ringSprite = TextureGen.MakeSprite(TextureGen.RingAlpha(64, 6f));
				}
				return _ringSprite;
			case MapIcon.Hex:
				if ((Object)(object)_hexSprite == (Object)null)
				{
					_hexSprite = TextureGen.MakeSprite(TextureGen.HexAlpha(64));
				}
				return _hexSprite;
			default:
			{
				Sprite val = Load(IconPath(icon));
				if (!((Object)(object)val != (Object)null))
				{
					return Load("Textures/MiscIcons/texMysteryIcon");
				}
				return val;
			}
			}
		}

		public static Sprite ResolveSprite(TrackedMarker m, MapIcon iconChoice)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			if (m.Kind == MapKind.GroundItem && iconChoice == MapIcon.Dot && (Object)(object)m.Pickup != (Object)null)
			{
				PickupIndex pickupIndex = m.Pickup.pickupIndex;
				if (((PickupIndex)(ref pickupIndex)).isValid)
				{
					PickupDef pickupDef = PickupCatalog.GetPickupDef(m.Pickup.pickupIndex);
					if (pickupDef != null && (Object)(object)pickupDef.iconSprite != (Object)null)
					{
						return pickupDef.iconSprite;
					}
					return GetSprite(MapIcon.Dot);
				}
			}
			if (m.Kind == MapKind.EnemyBoss && iconChoice == MapIcon.Attack && (Object)(object)m.Body != (Object)null)
			{
				Sprite portraitSprite = GetPortraitSprite(m.Body);
				if ((Object)(object)portraitSprite != (Object)null)
				{
					return portraitSprite;
				}
			}
			Sprite sprite = GetSprite(iconChoice);
			if ((Object)(object)sprite != (Object)null)
			{
				return sprite;
			}
			if ((Object)(object)m.Source != (Object)null)
			{
				try
				{
					Sprite interactableIcon = PingIndicator.GetInteractableIcon(m.Source.gameObject);
					if ((Object)(object)interactableIcon != (Object)null)
					{
						return interactableIcon;
					}
				}
				catch (Exception)
				{
				}
			}
			return Load("Textures/MiscIcons/texMysteryIcon");
		}

		private static Sprite GetPortraitSprite(CharacterBody body)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			Texture portraitIcon = body.portraitIcon;
			Texture2D val = (Texture2D)(object)((portraitIcon is Texture2D) ? portraitIcon : null);
			if (val == null || (Object)(object)val == (Object)null)
			{
				return null;
			}
			int instanceID = ((Object)val).GetInstanceID();
			if (PortraitCache.TryGetValue(instanceID, out var value))
			{
				return value;
			}
			value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
			PortraitCache[instanceID] = value;
			return value;
		}

		public static Color GetColor(TrackedMarker m, Color baseColor)
		{
			//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_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0012: Unknown result type (might be due to invalid IL or missing references)
			if (m.TintColor == Color.clear)
			{
				return baseColor;
			}
			Color tintColor = m.TintColor;
			return baseColor * tintColor;
		}

		public static Color GetTeleporterTint(TeleporterInteraction tp)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Invalid comparison between Unknown and I4
			//IL_0018: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			if ((int)tp.activationState >= 3)
			{
				return new Color(0.35f, 1f, 0.45f);
			}
			if ((int)tp.activationState >= 2)
			{
				return new Color(1f, 0.85f, 0.35f);
			}
			return Color.clear;
		}

		public static KindDefault DefaultFor(MapKind kind)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			if (!Defaults.TryGetValue(kind, out var value))
			{
				return new KindDefault(MapIcon.Mystery, Color.white, 20f);
			}
			return value;
		}

		public static string Label(MapKind kind)
		{
			return kind switch
			{
				MapKind.Chest => "Chest", 
				MapKind.GoldChest => "Large Chest", 
				MapKind.CategoryChest => "Category Chest", 
				MapKind.Shrine => "Shrine", 
				MapKind.NewtAltar => "Newt Altar", 
				MapKind.Drone => "Drone", 
				MapKind.DroneBroken => "Broken Drone", 
				MapKind.Scrapper => "Scrapper", 
				MapKind.Printer => "Printer / Cauldron", 
				MapKind.Multishop => "Multishop", 
				MapKind.MultishopTriple => "Multishop (Triple)", 
				MapKind.EquipmentBarrel => "Equipment Barrel", 
				MapKind.Barrel => "Barrel", 
				MapKind.Teleporter => "Teleporter", 
				MapKind.Portal => "Portal", 
				MapKind.VoidPotential => "Void Potential", 
				MapKind.CommandCube => "Command Cube", 
				MapKind.Relic => "Hallowed Relic", 
				MapKind.GroundItem => "Ground Item", 
				MapKind.Enemy => "Enemy", 
				MapKind.EnemyElite => "Elite Enemy", 
				MapKind.EnemyBoss => "Boss", 
				MapKind.Minion => "Minion", 
				MapKind.OtherPlayer => "Other Player", 
				_ => "Other", 
			};
		}
	}
	public enum MapIcon
	{
		ChestOutlined,
		Chest,
		Shrine,
		Teleporter,
		TeleporterAlt,
		Drone,
		Barrel,
		Loot,
		Mystery,
		WIP,
		Attack,
		Sprint,
		Quickplay,
		LunarPillar,
		Edit,
		RescueShip,
		Hurt,
		Unlock,
		Arrow,
		Randomize,
		RandomMap,
		Dot,
		Triangle,
		Ring,
		Hex
	}
	public enum MapKind
	{
		Chest,
		GoldChest,
		CategoryChest,
		Shrine,
		NewtAltar,
		Drone,
		DroneBroken,
		Scrapper,
		Printer,
		Multishop,
		MultishopTriple,
		EquipmentBarrel,
		Barrel,
		Teleporter,
		Portal,
		VoidPotential,
		CommandCube,
		Relic,
		GroundItem,
		Enemy,
		EnemyElite,
		EnemyBoss,
		Minion,
		OtherPlayer,
		Other
	}
	public static class MapScanner
	{
		private const float RescanInterval = 2f;

		private const float EventRescanCooldown = 0.5f;

		private const int MaxEnemyMarkers = 200;

		private const float TripleShopClusterRadius = 4f;

		private const float ShrineHideGraceSeconds = 10f;

		private const float UsedHideGraceSeconds = 0.75f;

		private static readonly string[] RelicHints = new string[9] { "Hex", "Reliquary", "Gong", "Nkuhana", "Hallowed", "Veil", "Compulsion", "Descent", "Concept" };

		private static readonly Dictionary<int, TrackedMarker> Markers = new Dictionary<int, TrackedMarker>(256);

		private static readonly List<TrackedMarker> VisibleList = new List<TrackedMarker>(256);

		private static readonly List<TrackedMarker> StaleBuffer = new List<TrackedMarker>(32);

		private static readonly Dictionary<Type, MemberInfo[]> PickupIndexMembers = new Dictionary<Type, MemberInfo[]>(64);

		private static float _nextRescan;

		private static float _eventRescanAt = float.MaxValue;

		private static bool _scannedOnce;

		public static IReadOnlyList<TrackedMarker> Visible => VisibleList;

		public static IEnumerable<TrackedMarker> All => Markers.Values;

		public static event Action<TrackedMarker> MarkerAdded;

		public static event Action<TrackedMarker> MarkerRemoved;

		public static void OnStageStarted()
		{
			Clear();
			ForceScan();
		}

		public static void QueueEventRescan()
		{
			_eventRescanAt = Time.unscaledTime + 0.5f;
		}

		public static void Update()
		{
			if (!_scannedOnce || Time.unscaledTime >= _nextRescan || Time.unscaledTime >= _eventRescanAt)
			{
				ForceScan();
				_nextRescan = Time.unscaledTime + 2f;
				_eventRescanAt = float.MaxValue;
				_scannedOnce = true;
			}
			Refresh();
		}

		public static void ForceScan()
		{
			if (Object.op_Implicit((Object)(object)SceneInfo.instance))
			{
				HashSet<int> seen = new HashSet<int>(Markers.Count * 2);
				ScanPurchasables(seen);
				ScanTeleporter(seen);
				ScanGenericInteractions(seen);
				ScanPickups(seen);
				ScanCharacters(seen);
				RemoveUnseen(seen);
			}
		}

		public static void Clear()
		{
			foreach (TrackedMarker value in Markers.Values)
			{
				MapScanner.MarkerRemoved?.Invoke(value);
			}
			Markers.Clear();
			VisibleList.Clear();
			_scannedOnce = false;
		}

		private static void RemoveUnseen(HashSet<int> seen)
		{
			StaleBuffer.Clear();
			foreach (KeyValuePair<int, TrackedMarker> marker in Markers)
			{
				if (!seen.Contains(marker.Key))
				{
					StaleBuffer.Add(marker.Value);
				}
			}
			foreach (TrackedMarker item in StaleBuffer)
			{
				Markers.Remove(item.Id);
				MapScanner.MarkerRemoved?.Invoke(item);
			}
		}

		private static TrackedMarker GetOrCreate(int id, Component source, MapKind kind)
		{
			if (Markers.TryGetValue(id, out var value))
			{
				value.Kind = kind;
				return value;
			}
			TrackedMarker trackedMarker = new TrackedMarker
			{
				Id = id,
				Source = source,
				Transform = source.transform,
				Kind = kind
			};
			Markers[id] = trackedMarker;
			MapScanner.MarkerAdded?.Invoke(trackedMarker);
			return trackedMarker;
		}

		private static void ScanPurchasables(HashSet<int> seen)
		{
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			List<(PurchaseInteraction, MapKind, bool)> list = new List<(PurchaseInteraction, MapKind, bool)>(64);
			PurchaseInteraction[] array = Object.FindObjectsOfType<PurchaseInteraction>();
			foreach (PurchaseInteraction val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					bool tinted;
					MapKind item = Classify(val, out tinted);
					list.Add((val, item, tinted));
				}
			}
			HashSet<int> hashSet = new HashSet<int>();
			foreach (var item2 in list)
			{
				if (item2.Item2 != MapKind.Multishop)
				{
					continue;
				}
				int num = 0;
				foreach (var item3 in list)
				{
					if (item3.Item2 == MapKind.Multishop && item3.Item1 != item2.Item1 && WithinXZ(((Component)item2.Item1).transform.position, ((Component)item3.Item1).transform.position, 4f))
					{
						num++;
					}
				}
				if (num >= 2)
				{
					hashSet.Add(((Object)item2.Item1).GetInstanceID());
				}
			}
			foreach (var item4 in list)
			{
				var (val2, _, _) = item4;
				seen.Add(((Object)val2).GetInstanceID());
				MapKind mapKind = item4.Item2;
				if (mapKind == MapKind.Multishop && hashSet.Contains(((Object)val2).GetInstanceID()))
				{
					if (MergeTripleShop(val2))
					{
						continue;
					}
					mapKind = MapKind.MultishopTriple;
				}
				TrackedMarker orCreate = GetOrCreate(((Object)val2).GetInstanceID(), (Component)(object)val2, mapKind);
				orCreate.Purchase = val2;
				orCreate.TintColor = Color.clear;
				if (mapKind == MapKind.Barrel)
				{
					orCreate.Barrel = ((Component)val2).GetComponent<BarrelInteraction>();
				}
				if (item4.Item3)
				{
					orCreate.TintColor = Color32.op_Implicit(TintFor(val2));
				}
			}
		}

		private static bool MergeTripleShop(PurchaseInteraction pi)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = ((Component)pi).transform.position;
			TrackedMarker trackedMarker = null;
			foreach (KeyValuePair<int, TrackedMarker> marker in Markers)
			{
				TrackedMarker value = marker.Value;
				if (value.Kind == MapKind.MultishopTriple && Object.op_Implicit((Object)(object)value.Transform) && WithinXZ(position, value.Transform.position, 4f))
				{
					trackedMarker = value;
					break;
				}
			}
			if (trackedMarker == null)
			{
				return false;
			}
			bool available = pi.available;
			bool flag = Object.op_Implicit((Object)(object)trackedMarker.Purchase) && trackedMarker.Purchase.available;
			if (available && !flag)
			{
				trackedMarker.Source = (Component)(object)pi;
				trackedMarker.Transform = ((Component)pi).transform;
				trackedMarker.Purchase = pi;
				trackedMarker.Hidden = false;
				trackedMarker.Available = true;
				trackedMarker.UnavailableSince = -1f;
				trackedMarker.TintColor = Color32.op_Implicit(TintFor(pi));
			}
			int instanceID = ((Object)pi).GetInstanceID();
			if (Markers.TryGetValue(instanceID, out var value2) && value2 != trackedMarker)
			{
				Markers.Remove(instanceID);
				MapScanner.MarkerRemoved?.Invoke(value2);
			}
			return true;
		}

		private static bool WithinXZ(Vector3 a, Vector3 b, float r)
		{
			//IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			float num = a.x - b.x;
			float num2 = a.z - b.z;
			return num * num + num2 * num2 <= r * r;
		}

		private static void ScanTeleporter(HashSet<int> seen)
		{
			TeleporterInteraction[] array = Object.FindObjectsOfType<TeleporterInteraction>();
			foreach (TeleporterInteraction val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					seen.Add(((Object)val).GetInstanceID());
					GetOrCreate(((Object)val).GetInstanceID(), (Component)(object)val, MapKind.Teleporter).Teleporter = val;
				}
			}
		}

		private static void ScanGenericInteractions(HashSet<int> seen)
		{
			GenericInteraction[] array = Object.FindObjectsOfType<GenericInteraction>();
			foreach (GenericInteraction val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					seen.Add(((Object)val).GetInstanceID());
					string contextToken = val.contextToken;
					string name = ((Object)((Component)val).gameObject).name;
					GetOrCreate(kind: (!IsPortalToken(contextToken) && !IsPortalToken(name)) ? ((!MatchesRelic(contextToken) && !MatchesRelic(name)) ? MapKind.Other : MapKind.Relic) : MapKind.Portal, id: ((Object)val).GetInstanceID(), source: (Component)(object)val);
				}
			}
		}

		private static bool MatchesRelic(string s)
		{
			if (string.IsNullOrEmpty(s))
			{
				return false;
			}
			string[] relicHints = RelicHints;
			foreach (string value in relicHints)
			{
				if (s.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0)
				{
					return true;
				}
			}
			return false;
		}

		private static void ScanPickups(HashSet<int> seen)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			GenericPickupController[] array = Object.FindObjectsOfType<GenericPickupController>();
			foreach (GenericPickupController val in array)
			{
				if (Object.op_Implicit((Object)(object)val))
				{
					PickupIndex pickupIndex = val.pickupIndex;
					if (((PickupIndex)(ref pickupIndex)).isValid && !(val.pickupIndex == PickupIndex.none))
					{
						seen.Add(((Object)val).GetInstanceID());
						GetOrCreate(((Object)val).GetInstanceID(), (Component)(object)val, MapKind.GroundItem).Pickup = val;
					}
				}
			}
		}

		private static void ScanCharacters(HashSet<int> seen)
		{
			//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)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Invalid comparison between Unknown and I4
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Invalid comparison between Unknown and I4
			int num = 0;
			TeamComponent[] array = Object.FindObjectsOfType<TeamComponent>();
			foreach (TeamComponent val in array)
			{
				if (!Object.op_Implicit((Object)(object)val))
				{
					continue;
				}
				TeamIndex teamIndex = val.teamIndex;
				MapKind kind;
				if ((int)teamIndex != 1)
				{
					if (teamIndex - 2 > 2 || num >= 200)
					{
						continue;
					}
					kind = ClassifyEnemy(((Component)val).GetComponent<CharacterBody>());
				}
				else
				{
					CharacterBody component = ((Component)val).GetComponent<CharacterBody>();
					if (!Object.op_Implicit((Object)(object)component))
					{
						continue;
					}
					if (component.isPlayerControlled)
					{
						kind = MapKind.OtherPlayer;
					}
					else
					{
						CharacterMaster master = component.master;
						MinionOwnership val2 = (Object.op_Implicit((Object)(object)master) ? ((Component)master).GetComponent<MinionOwnership>() : null);
						if (!Object.op_Implicit((Object)(object)val2) || (Object)(object)val2.ownerMaster == (Object)null)
						{
							continue;
						}
						kind = MapKind.Minion;
					}
				}
				seen.Add(((Object)val).GetInstanceID());
				TrackedMarker orCreate = GetOrCreate(((Object)val).GetInstanceID(), (Component)(object)val, kind);
				if (IsEnemyKind(kind))
				{
					num++;
				}
				orCreate.Body = ((Component)val).GetComponent<CharacterBody>();
			}
		}

		private static bool IsEnemyKind(MapKind kind)
		{
			if (kind != MapKind.Enemy && kind != MapKind.EnemyElite)
			{
				return kind == MapKind.EnemyBoss;
			}
			return true;
		}

		private static MapKind ClassifyEnemy(CharacterBody body)
		{
			if (Object.op_Implicit((Object)(object)body) && body.isBoss)
			{
				return MapKind.EnemyBoss;
			}
			if (Object.op_Implicit((Object)(object)body) && body.isElite)
			{
				return MapKind.EnemyElite;
			}
			return MapKind.Enemy;
		}

		private static void Refresh()
		{
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			VisibleList.Clear();
			StaleBuffer.Clear();
			foreach (TrackedMarker value in Markers.Values)
			{
				if (!Object.op_Implicit((Object)(object)value.Source))
				{
					StaleBuffer.Add(value);
					continue;
				}
				if ((Object)(object)value.Barrel != (Object)null && value.Barrel.Networkopened)
				{
					value.Hidden = true;
				}
				if ((Object)(object)value.Purchase != (Object)null)
				{
					if (value.Available = value.Purchase.available)
					{
						value.UnavailableSince = -1f;
						if (value.Hidden && (!((Object)(object)value.Barrel != (Object)null) || !value.Barrel.Networkopened))
						{
							value.Hidden = false;
						}
					}
					else
					{
						if (value.UnavailableSince < 0f)
						{
							value.UnavailableSince = Time.unscaledTime;
						}
						float num = ((value.Kind == MapKind.Shrine) ? 10f : 0.75f);
						if (Time.unscaledTime - value.UnavailableSince >= num)
						{
							value.Hidden = true;
						}
					}
				}
				if ((Object)(object)value.Body != (Object)null && IsEnemyKind(value.Kind))
				{
					MapKind mapKind = ClassifyEnemy(value.Body);
					if (mapKind != value.Kind)
					{
						value.Kind = mapKind;
					}
				}
				if ((Object)(object)value.Teleporter != (Object)null)
				{
					value.TintColor = IconLibrary.GetTeleporterTint(value.Teleporter);
				}
				if (!value.Hidden)
				{
					VisibleList.Add(value);
				}
			}
			foreach (TrackedMarker item in StaleBuffer)
			{
				Markers.Remove(item.Id);
				MapScanner.MarkerRemoved?.Invoke(item);
			}
		}

		private static bool IsPortalToken(string token)
		{
			if (!string.IsNullOrEmpty(token))
			{
				if (token.IndexOf("PORTAL", StringComparison.OrdinalIgnoreCase) < 0 && token.IndexOf("GOLDSHORE", StringComparison.OrdinalIgnoreCase) < 0)
				{
					return token.IndexOf("TOTEM", StringComparison.OrdinalIgnoreCase) >= 0;
				}
				return true;
			}
			return false;
		}

		private static MapKind Classify(PurchaseInteraction pi, out bool tinted)
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			tinted = false;
			GameObject gameObject = ((Component)pi).gameObject;
			StringComparison comparisonType = StringComparison.OrdinalIgnoreCase;
			if ((Object)(object)((Component)pi).GetComponent<BarrelInteraction>() != (Object)null)
			{
				string contextToken = pi.contextToken;
				if ((!string.IsNullOrEmpty(contextToken) && contextToken.IndexOf("EQUIPMENTBARREL", comparisonType) >= 0) || ((Object)gameObject).name.IndexOf("EquipmentBarrel", comparisonType) >= 0)
				{
					tinted = false;
					return MapKind.EquipmentBarrel;
				}
				return MapKind.Barrel;
			}
			if (Object.op_Implicit((Object)(object)((Component)pi).GetComponent<OptionChestBehavior>()))
			{
				if (((Object)gameObject).name.IndexOf("Potential", comparisonType) < 0)
				{
					return MapKind.CommandCube;
				}
				return MapKind.VoidPotential;
			}
			if (Object.op_Implicit((Object)(object)((Component)pi).GetComponent<ChestBehavior>()))
			{
				if (((Object)gameObject).name.IndexOf("GoldChest", comparisonType) >= 0)
				{
					return MapKind.GoldChest;
				}
				if (((Object)gameObject).name.IndexOf("CategoryChest", comparisonType) >= 0)
				{
					tinted = true;
					return MapKind.CategoryChest;
				}
				return MapKind.Chest;
			}
			if (Object.op_Implicit((Object)(object)((Component)pi).GetComponent<ShrineBehavior>()))
			{
				return MapKind.Shrine;
			}
			if (Object.op_Implicit((Object)(object)((Com