Decompiled source of ErenshorMiniMap v2.0.2

Drizzlx.Erenshor.MiniMap.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
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("Drizzlx.Erenshor.MiniMap")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("2.0.1.0")]
[assembly: AssemblyInformationalVersion("2.0.1+062678672febb6906af1d123edf47f00a620384e")]
[assembly: AssemblyProduct("MiniMap")]
[assembly: AssemblyTitle("Drizzlx.Erenshor.MiniMap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MiniMap
{
	[BepInPlugin("Drizzlx.Erenshor.MiniMap", "MiniMap", "2.0.1")]
	public class MiniMapPlugin : BaseUnityPlugin
	{
		[CompilerGenerated]
		private sealed class <LateLoadZoneLines>d__27 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MiniMapPlugin <>4__this;

			private int <tries>5__2;

			private int <i>5__3;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LateLoadZoneLines>d__27(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				int num = <>1__state;
				MiniMapPlugin miniMapPlugin = <>4__this;
				if (num != 0)
				{
					if (num != 1)
					{
						return false;
					}
					<>1__state = -1;
					<i>5__3++;
					goto IL_0083;
				}
				<>1__state = -1;
				<tries>5__2 = 0;
				goto IL_008d;
				IL_0083:
				if (<i>5__3 < 60)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				goto IL_008d;
				IL_008d:
				if (<tries>5__2 < 10)
				{
					miniMapPlugin._allZonelines = Object.FindObjectsOfType<Zoneline>();
					if (miniMapPlugin._allZonelines == null || miniMapPlugin._allZonelines.Length == 0)
					{
						<tries>5__2++;
						<i>5__3 = 0;
						goto IL_0083;
					}
				}
				miniMapPlugin._zoneLineMarkers.RemoveAll((GameObject m) => (Object)(object)m == (Object)null || ((object)m).Equals((object?)null));
				miniMapPlugin._canLoadZoneLines = false;
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		[CompilerGenerated]
		private sealed class <LatePlaceMinimap>d__31 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MiniMapPlugin <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <LatePlaceMinimap>d__31(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_007b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0090: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0064: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				MiniMapPlugin miniMapPlugin = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<>2__current = null;
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -1;
					if ((Object)(object)miniMapPlugin._minimapUIRoot != (Object)null)
					{
						RectTransform component = miniMapPlugin._minimapUIRoot.GetComponent<RectTransform>();
						if (_savedMinimapPosition != Vector2.zero)
						{
							component.anchoredPosition = _savedMinimapPosition;
						}
						else
						{
							component.anchorMin = new Vector2(1f, 1f);
							component.anchorMax = new Vector2(1f, 1f);
							component.pivot = new Vector2(1f, 1f);
							float num2 = (float)(-Screen.width) * 0.05f;
							float num3 = (float)(-Screen.height) * 0.12f;
							component.anchoredPosition = new Vector2(num2, num3);
						}
					}
					return false;
				}
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private GameObject _minimapCamObj;

		private Camera _minimapCamera;

		private RenderTexture _minimapRenderTexture;

		private float _zoomLevel = 65f;

		private readonly string[] _bankNpcs = new string[4] { "Prestigio Valusha", "Validus Greencent", "Comstock Retalio", "Summoned: Pocket Rift" };

		private readonly string[] _otherNpcs = new string[2] { "Thella Steepleton", "Goldie Retalio" };

		private Texture2D _arrowTexture;

		private Texture2D _mapZoneBgTexture;

		private Texture2D _mapCoordsBgTexture;

		private Texture2D _mapZoneLineTexture;

		private string _assetDirectory;

		private GameObject _minimapUIRoot;

		private RectTransform _playerArrowRect;

		private RectTransform _npcMarkerContainer;

		private readonly List<GameObject> _npcMarkers = new List<GameObject>();

		private TextMeshProUGUI _zoneLabel;

		private TextMeshProUGUI _coordsLabel;

		private readonly float _minimapUISize = 250f;

		private Transform _miniMapPanelGoTransform;

		private static Vector2 _savedMinimapPosition;

		public static Vector2 SavedMinimapSize;

		private Zoneline[] _allZonelines;

		private List<GameObject> _zoneLineMarkers = new List<GameObject>();

		private bool _canLoadZoneLines;

		private void Awake()
		{
			string location = ((BaseUnityPlugin)this).Info.Location;
			if (location != null)
			{
				_assetDirectory = Path.GetDirectoryName(location);
			}
			else
			{
				_assetDirectory = Path.Combine(Paths.PluginPath, "drizzlx-ErenshorMiniMap");
			}
			LoadCoordsBgTexture();
			LoadZoneBgTexture();
			LoadArrowTexture();
			LoadZoneLineTexture();
			_canLoadZoneLines = true;
		}

		private void OnDestroy()
		{
			try
			{
				if ((Object)(object)_minimapCamObj != (Object)null)
				{
					Object.Destroy((Object)(object)_minimapCamObj);
					_minimapCamObj = null;
				}
				if ((Object)(object)_minimapRenderTexture != (Object)null)
				{
					_minimapRenderTexture.Release();
					Object.Destroy((Object)(object)_minimapRenderTexture);
					_minimapRenderTexture = null;
				}
				if ((Object)(object)_minimapUIRoot != (Object)null)
				{
					Object.Destroy((Object)(object)_minimapUIRoot);
					_minimapUIRoot = null;
				}
				foreach (GameObject npcMarker in _npcMarkers)
				{
					if ((Object)(object)npcMarker != (Object)null)
					{
						Object.Destroy((Object)(object)npcMarker);
					}
				}
				_npcMarkers.Clear();
			}
			catch (Exception arg)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)$"Error during minimap cleanup: {arg}");
			}
		}

		private void Update()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: 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_0146: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameData.PlayerControl == (Object)null || GameData.InCharSelect)
			{
				return;
			}
			if (GameData.Zoning)
			{
				_canLoadZoneLines = true;
				return;
			}
			if (_canLoadZoneLines)
			{
				_allZonelines = null;
				((MonoBehaviour)this).StartCoroutine(LateLoadZoneLines());
			}
			if ((Object)(object)_minimapCamera == (Object)null)
			{
				CreateMinimapCamera();
				if ((Object)(object)_minimapUIRoot == (Object)null)
				{
					CreateMinimapUI();
				}
			}
			if ((Object)(object)_miniMapPanelGoTransform != (Object)null)
			{
				_savedMinimapPosition = ((Component)_miniMapPanelGoTransform).GetComponent<RectTransform>().anchoredPosition;
			}
			if ((Object)(object)_zoneLabel != (Object)null)
			{
				string sceneName = GameData.SceneName;
				if (string.IsNullOrEmpty(sceneName))
				{
					((TMP_Text)_zoneLabel).text = "Unknown Location";
				}
				else if (!string.Equals(sceneName, ((TMP_Text)_zoneLabel).text, StringComparison.Ordinal))
				{
					((TMP_Text)_zoneLabel).text = sceneName;
				}
				((TMP_Text)_zoneLabel).ForceMeshUpdate(false, false);
				LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)((Transform)((TMP_Text)_zoneLabel).rectTransform).parent).GetComponent<RectTransform>());
			}
			if ((Object)(object)_coordsLabel != (Object)null && (Object)(object)GameData.PlayerControl != (Object)null)
			{
				Vector3 position = ((Component)GameData.PlayerControl).transform.position;
				((TMP_Text)_coordsLabel).text = $"{Mathf.FloorToInt(position.x)}, {Mathf.FloorToInt(position.z)}";
				((TMP_Text)_coordsLabel).ForceMeshUpdate(false, false);
				LayoutRebuilder.ForceRebuildLayoutImmediate(((Component)((Transform)((TMP_Text)_coordsLabel).rectTransform).parent).GetComponent<RectTransform>());
			}
			if (IsMouseOverMinimap())
			{
				float y = Input.mouseScrollDelta.y;
				if (y > 0f)
				{
					_zoomLevel = Mathf.Clamp(_zoomLevel - 5f, 50f, 80f);
					_minimapCamera.orthographicSize = _zoomLevel;
				}
				else if (y < 0f)
				{
					_zoomLevel = Mathf.Clamp(_zoomLevel + 5f, 50f, 80f);
					_minimapCamera.orthographicSize = _zoomLevel;
				}
			}
			UpdateMinimapCamera();
			UpdatePlayerArrowOnMinimap();
			UpdateNpcMarkers();
			UpdateZoneLineMarkers();
		}

		[IteratorStateMachine(typeof(<LateLoadZoneLines>d__27))]
		private IEnumerator LateLoadZoneLines()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LateLoadZoneLines>d__27(0)
			{
				<>4__this = this
			};
		}

		private void CreateMinimapCamera()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			_minimapCamObj = new GameObject("MinimapCamera");
			_minimapCamera = _minimapCamObj.AddComponent<Camera>();
			_minimapCamera.cullingMask = 1 << LayerMask.NameToLayer("Default");
			_minimapCamera.orthographic = true;
			_minimapCamera.orthographicSize = _zoomLevel;
			_minimapCamera.clearFlags = (CameraClearFlags)2;
			_minimapCamera.backgroundColor = new Color(0f, 0f, 0f, 0f);
			int num = Mathf.RoundToInt(256f);
			_minimapRenderTexture = new RenderTexture(num, num, 16);
			_minimapCamera.targetTexture = _minimapRenderTexture;
		}

		private void UpdateMinimapCamera()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			ZoneAnnounce currentZoneAnnounce = GameData.CurrentZoneAnnounce;
			if (!((Object)(object)currentZoneAnnounce == (Object)null) && !((Object)(object)((Component)currentZoneAnnounce).transform == (Object)null))
			{
				Quaternion rotation = ((Component)currentZoneAnnounce).transform.rotation;
				float y = ((Quaternion)(ref rotation)).eulerAngles.y;
				((Component)_minimapCamera).transform.position = ((Component)GameData.PlayerControl).transform.position + Vector3.up * 100f;
				((Component)_minimapCamera).transform.rotation = Quaternion.Euler(90f, (y + 180f) % 360f, 0f);
			}
		}

		private void CreateMinimapUI()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Expected O, but got Unknown
			//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0242: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028a: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Unknown result type (might be due to invalid IL or missing references)
			//IL_031a: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0367: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_0470: Expected O, but got Unknown
			//IL_049a: Unknown result type (might be due to invalid IL or missing references)
			//IL_04af: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_051d: Unknown result type (might be due to invalid IL or missing references)
			//IL_052c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: 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_059e: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05dc: Expected O, but got Unknown
			//IL_0618: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Expected O, but got Unknown
			//IL_0645: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_066f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0683: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: 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_075c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0773: Unknown result type (might be due to invalid IL or missing references)
			//IL_0784: Unknown result type (might be due to invalid IL or missing references)
			//IL_0799: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0849: Unknown result type (might be due to invalid IL or missing references)
			//IL_084e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0865: Unknown result type (might be due to invalid IL or missing references)
			//IL_0876: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_093b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0957: Unknown result type (might be due to invalid IL or missing references)
			//IL_0968: Unknown result type (might be due to invalid IL or missing references)
			//IL_097d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0992: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a34: Expected O, but got Unknown
			//IL_0a69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b52: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b6a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bbf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bc4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bf8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c02: Expected O, but got Unknown
			//IL_0c3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c45: Expected O, but got Unknown
			//IL_0c77: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ca1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d26: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d6f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d74: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d96: Unknown result type (might be due to invalid IL or missing references)
			//IL_0da7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dd1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0de6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dfa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e20: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e69: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e7e: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("MinimapCanvas", new Type[3]
			{
				typeof(Canvas),
				typeof(CanvasScaler),
				typeof(GraphicRaycaster)
			});
			Canvas component = val.GetComponent<Canvas>();
			component.renderMode = (RenderMode)0;
			component.overrideSorting = true;
			component.sortingOrder = 0;
			GameObject panelGo = new GameObject("MinimapPanel", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(RawImage)
			});
			panelGo.transform.SetParent(val.transform, false);
			RectTransform component2 = panelGo.GetComponent<RectTransform>();
			if (SavedMinimapSize != Vector2.zero)
			{
				component2.sizeDelta = SavedMinimapSize;
			}
			else
			{
				component2.sizeDelta = new Vector2(_minimapUISize, _minimapUISize);
			}
			component2.anchorMin = new Vector2(1f, 1f);
			component2.anchorMax = new Vector2(1f, 1f);
			component2.pivot = new Vector2(1f, 1f);
			if (_savedMinimapPosition != Vector2.zero)
			{
				component2.anchoredPosition = _savedMinimapPosition;
			}
			else
			{
				float num = (float)(-Screen.width) * 0.05f;
				float num2 = (float)(-Screen.height) * 0.12f;
				component2.anchoredPosition = new Vector2(num, num2);
			}
			GameObject val2 = new GameObject("ZoneLabelBG", new Type[6]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image),
				typeof(ContentSizeFitter),
				typeof(LayoutElement),
				typeof(VerticalLayoutGroup)
			});
			val2.transform.SetParent(panelGo.transform, false);
			RectTransform component3 = val2.GetComponent<RectTransform>();
			component3.anchorMin = new Vector2(0f, 1f);
			component3.anchorMax = new Vector2(1f, 1f);
			component3.pivot = new Vector2(0.5f, 0.21f);
			component3.anchoredPosition = new Vector2(0f, 0f);
			component3.sizeDelta = Vector2.zero;
			Image component4 = val2.GetComponent<Image>();
			component4.sprite = Sprite.Create(_mapZoneBgTexture, new Rect(0f, 0f, (float)((Texture)_mapZoneBgTexture).width, (float)((Texture)_mapZoneBgTexture).height), new Vector2(0.5f, 0.5f));
			((Graphic)component4).color = new Color(0.3f, 0.3f, 0.3f, 0.7f);
			component4.type = (Type)1;
			RawImage component5 = panelGo.GetComponent<RawImage>();
			component5.texture = (Texture)(object)_minimapRenderTexture;
			((Graphic)component5).color = new Color(1f, 1f, 1f, 0.9f);
			_minimapUIRoot = panelGo;
			Color borderColor = new Color(0.274f, 0.196f, 0.118f, 0.8f);
			CreateBorder("BorderTop", new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, 2f));
			CreateBorder("BorderBottom", new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 2f));
			CreateBorder("BorderLeft", new Vector2(0f, 0f), new Vector2(0f, 1f), new Vector2(2f, 0f));
			CreateBorder("BorderRight", new Vector2(1f, 0f), new Vector2(1f, 1f), new Vector2(2f, 0f));
			((MonoBehaviour)this).StartCoroutine(LatePlaceMinimap());
			GameObject val3 = new GameObject("CoordsLabelBG", new Type[6]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image),
				typeof(ContentSizeFitter),
				typeof(LayoutElement),
				typeof(VerticalLayoutGroup)
			});
			val3.transform.SetParent(panelGo.transform, false);
			RectTransform component6 = val3.GetComponent<RectTransform>();
			component6.anchorMin = new Vector2(0.5f, 0f);
			component6.anchorMax = new Vector2(0.5f, 0f);
			component6.pivot = new Vector2(0.5f, 0.22f);
			component6.anchoredPosition = new Vector2(0f, 0f);
			component6.sizeDelta = Vector2.zero;
			Image component7 = val3.GetComponent<Image>();
			component7.sprite = Sprite.Create(_mapCoordsBgTexture, new Rect(0f, 0f, (float)((Texture)_mapCoordsBgTexture).width, (float)((Texture)_mapCoordsBgTexture).height), new Vector2(0.5f, 0.5f));
			((Graphic)component7).color = new Color(1f, 1f, 1f, 0.7f);
			component7.type = (Type)1;
			ContentSizeFitter component8 = val3.GetComponent<ContentSizeFitter>();
			component8.horizontalFit = (FitMode)2;
			component8.verticalFit = (FitMode)2;
			VerticalLayoutGroup component9 = val3.GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component9).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component9).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)component9).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)component9).childForceExpandHeight = false;
			Rect rect = component2.rect;
			int num3 = (int)((double)((Rect)(ref rect)).width * 0.08);
			rect = component2.rect;
			((LayoutGroup)component9).padding = new RectOffset(num3, (int)((double)((Rect)(ref rect)).width * 0.08), 16, 16);
			((HorizontalOrVerticalLayoutGroup)component9).spacing = 0f;
			GameObject val4 = new GameObject("PlayerCoords", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(TextMeshProUGUI)
			});
			val4.transform.SetParent(val3.transform, false);
			RectTransform component10 = val4.GetComponent<RectTransform>();
			component10.anchorMin = new Vector2(0.5f, 0.5f);
			component10.anchorMax = new Vector2(0.5f, 0.5f);
			component10.pivot = new Vector2(0.5f, 0.5f);
			component10.anchoredPosition = new Vector2(0f, 0f);
			_coordsLabel = val4.GetComponent<TextMeshProUGUI>();
			((TMP_Text)_coordsLabel).fontSize = 12f;
			((TMP_Text)_coordsLabel).alignment = (TextAlignmentOptions)514;
			((Graphic)_coordsLabel).color = new Color(1f, 1f, 1f, 1f);
			((TMP_Text)_coordsLabel).text = "(0, 0)";
			((TMP_Text)_coordsLabel).enableAutoSizing = false;
			((TMP_Text)_coordsLabel).enableWordWrapping = false;
			((TMP_Text)_coordsLabel).rectTransform.sizeDelta = new Vector2(0f, 0f);
			GameObject val5 = new GameObject("MinimapResizeHandle", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val5.transform.SetParent(panelGo.transform, false);
			RectTransform component11 = val5.GetComponent<RectTransform>();
			component11.sizeDelta = new Vector2(32f, 32f);
			component11.anchorMin = new Vector2(0f, 1f);
			component11.anchorMax = new Vector2(0f, 1f);
			component11.pivot = new Vector2(0f, 1f);
			component11.anchoredPosition = Vector2.zero;
			Image component12 = ((Component)component11).GetComponent<Image>();
			((Graphic)component12).color = new Color(0.75f, 0.75f, 0.75f, 0f);
			((Graphic)component12).raycastTarget = true;
			val5.AddComponent<ResizeUIBottomLeft>().target = panelGo.GetComponent<RectTransform>();
			GameObject val6 = new GameObject("MinimapResizeHandle", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val6.transform.SetParent(panelGo.transform, false);
			RectTransform component13 = val6.GetComponent<RectTransform>();
			component13.sizeDelta = new Vector2(32f, 32f);
			component13.anchorMin = new Vector2(0f, 0f);
			component13.anchorMax = new Vector2(0f, 0f);
			component13.pivot = new Vector2(0f, 0f);
			component13.anchoredPosition = Vector2.zero;
			Image component14 = val6.GetComponent<Image>();
			((Graphic)component14).color = new Color(0.75f, 0.75f, 0.75f, 0f);
			((Graphic)component14).raycastTarget = true;
			val6.AddComponent<ResizeUIBottomLeft>().target = panelGo.GetComponent<RectTransform>();
			GameObject val7 = new GameObject("MinimapResizeHandle", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val7.transform.SetParent(panelGo.transform, false);
			RectTransform component15 = val7.GetComponent<RectTransform>();
			component15.sizeDelta = new Vector2(32f, 32f);
			component15.anchorMin = new Vector2(1f, 0f);
			component15.anchorMax = new Vector2(1f, 0f);
			component15.pivot = new Vector2(1f, 0f);
			component15.anchoredPosition = Vector2.zero;
			Image component16 = val7.GetComponent<Image>();
			((Graphic)component16).color = new Color(0.75f, 0.75f, 0.75f, 0f);
			((Graphic)component16).raycastTarget = true;
			val7.AddComponent<ResizeUIBottomRight>().target = panelGo.GetComponent<RectTransform>();
			GameObject val8 = new GameObject("PlayerArrow", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			val8.transform.SetParent(panelGo.transform, false);
			_playerArrowRect = val8.GetComponent<RectTransform>();
			_playerArrowRect.sizeDelta = new Vector2(24f, 24f);
			Image component17 = val8.GetComponent<Image>();
			component17.sprite = Sprite.Create(_arrowTexture, new Rect(0f, 0f, (float)((Texture)_arrowTexture).width, (float)((Texture)_arrowTexture).height), new Vector2(0.5f, 0.5f));
			((Graphic)component17).color = new Color(1f, 1f, 1f, 0.7f);
			GameObject val9 = new GameObject("MarkerContainer", new Type[1] { typeof(RectTransform) });
			val9.transform.SetParent(panelGo.transform, false);
			RectTransform component18 = val9.GetComponent<RectTransform>();
			component18.anchorMin = new Vector2(0.5f, 0.5f);
			component18.anchorMax = new Vector2(0.5f, 0.5f);
			component18.pivot = new Vector2(0.5f, 0.5f);
			component18.anchoredPosition = Vector2.zero;
			component18.sizeDelta = Vector2.zero;
			_npcMarkerContainer = component18;
			val3.transform.SetAsLastSibling();
			ContentSizeFitter component19 = val2.GetComponent<ContentSizeFitter>();
			component19.horizontalFit = (FitMode)2;
			component19.verticalFit = (FitMode)2;
			VerticalLayoutGroup component20 = val2.GetComponent<VerticalLayoutGroup>();
			((HorizontalOrVerticalLayoutGroup)component20).childControlWidth = true;
			((HorizontalOrVerticalLayoutGroup)component20).childControlHeight = true;
			((HorizontalOrVerticalLayoutGroup)component20).childForceExpandWidth = false;
			((HorizontalOrVerticalLayoutGroup)component20).childForceExpandHeight = false;
			rect = component2.rect;
			int num4 = (int)((double)((Rect)(ref rect)).width * 0.2);
			rect = component2.rect;
			((LayoutGroup)component20).padding = new RectOffset(num4, (int)((double)((Rect)(ref rect)).width * 0.2), 16, 16);
			((HorizontalOrVerticalLayoutGroup)component20).spacing = 0f;
			GameObject val10 = new GameObject("ZoneLabel", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(TextMeshProUGUI)
			});
			val10.transform.SetParent(val2.transform, false);
			_zoneLabel = val10.GetComponent<TextMeshProUGUI>();
			RectTransform component21 = val10.GetComponent<RectTransform>();
			component21.anchorMin = new Vector2(0.5f, 0.5f);
			component21.anchorMax = new Vector2(0.5f, 0.5f);
			component21.pivot = new Vector2(0.5f, 0.5f);
			component21.anchoredPosition = Vector2.zero;
			((TMP_Text)_zoneLabel).fontSize = 18f;
			((TMP_Text)_zoneLabel).alignment = (TextAlignmentOptions)514;
			((Graphic)_zoneLabel).color = new Color(0.35f, 0.78f, 1f, 1f);
			((TMP_Text)_zoneLabel).enableAutoSizing = false;
			((TMP_Text)_zoneLabel).enableWordWrapping = false;
			((TMP_Text)_zoneLabel).rectTransform.sizeDelta = new Vector2(0f, 0f);
			GameObject val11 = new GameObject("MinimapDragHandle", new Type[4]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image),
				typeof(DragUI)
			})
			{
				name = "DiamondDragHandle"
			};
			val11.transform.SetParent(panelGo.transform, false);
			RectTransform component22 = val11.GetComponent<RectTransform>();
			component22.sizeDelta = new Vector2(14f, 14f);
			component22.anchorMin = new Vector2(1f, 1f);
			component22.anchorMax = new Vector2(1f, 1f);
			component22.pivot = new Vector2(0.5f, 0.5f);
			component22.anchoredPosition = new Vector2(0f, 0f);
			Image component23 = val11.GetComponent<Image>();
			component23.sprite = Sprite.Create(MakeDiamondGradientTexture(new Color(0.0667f, 0.5333f, 0.7529f, 0.9f)), new Rect(0f, 0f, 2f, 2f), new Vector2(0.5f, 0.5f));
			component23.type = (Type)0;
			((Graphic)component23).raycastTarget = true;
			val11.transform.localRotation = Quaternion.Euler(0f, 0f, 45f);
			DragUI component24 = val11.GetComponent<DragUI>();
			component24.Parent = panelGo.transform;
			component24.isInv = false;
			_miniMapPanelGoTransform = component24.Parent;
			void CreateBorder(string name, Vector2 anchorMin, Vector2 anchorMax, Vector2 size)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0052: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: 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_0075: 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_008c: Unknown result type (might be due to invalid IL or missing references)
				GameObject val12 = new GameObject(name, new Type[3]
				{
					typeof(RectTransform),
					typeof(CanvasRenderer),
					typeof(Image)
				});
				val12.transform.SetParent(panelGo.transform, false);
				RectTransform component25 = val12.GetComponent<RectTransform>();
				component25.anchorMin = anchorMin;
				component25.anchorMax = anchorMax;
				component25.pivot = new Vector2(0.5f, 0.5f);
				component25.anchoredPosition = Vector2.zero;
				component25.sizeDelta = size;
				((Graphic)val12.GetComponent<Image>()).color = borderColor;
			}
		}

		[IteratorStateMachine(typeof(<LatePlaceMinimap>d__31))]
		private IEnumerator LatePlaceMinimap()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <LatePlaceMinimap>d__31(0)
			{
				<>4__this = this
			};
		}

		private void UpdatePlayerArrowOnMinimap()
		{
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: 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_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_playerArrowRect == (Object)null) && !((Object)(object)GameData.PlayerControl == (Object)null) && !((Object)(object)((Component)GameData.PlayerControl).transform == (Object)null) && !((Object)(object)GameData.CurrentZoneAnnounce == (Object)null) && !((Object)(object)((Component)GameData.CurrentZoneAnnounce).transform == (Object)null) && !((Object)(object)_minimapCamera == (Object)null))
			{
				Vector3 position = ((Component)GameData.PlayerControl).transform.position;
				Vector3 val = _minimapCamera.WorldToViewportPoint(position);
				RectTransform playerArrowRect = _playerArrowRect;
				RectTransform component = _minimapUIRoot.GetComponent<RectTransform>();
				Rect rect = component.rect;
				float width = ((Rect)(ref rect)).width;
				rect = component.rect;
				float height = ((Rect)(ref rect)).height;
				float num = (val.x - 0.5f) * width;
				float num2 = (0.5f - val.y) * height;
				playerArrowRect.anchoredPosition = new Vector2(num, num2);
				Vector3 forward = ((Component)GameData.PlayerControl).transform.forward;
				Quaternion rotation = ((Component)GameData.CurrentZoneAnnounce).transform.rotation;
				float y = ((Quaternion)(ref rotation)).eulerAngles.y;
				float num3 = Mathf.Atan2(forward.x, forward.z) * 57.29578f - (y + 180f) % 360f;
				((Transform)playerArrowRect).localRotation = Quaternion.Euler(0f, 0f, 0f - num3);
			}
		}

		private void UpdateNpcMarkers()
		{
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_016b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0484: Unknown result type (might be due to invalid IL or missing references)
			//IL_0491: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cb: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_npcMarkerContainer == (Object)null || (Object)(object)_minimapCamera == (Object)null || (Object)(object)GameData.PlayerControl == (Object)null || (Object)(object)_minimapUIRoot == (Object)null)
			{
				return;
			}
			foreach (GameObject npcMarker in _npcMarkers)
			{
				if ((Object)(object)npcMarker != (Object)null)
				{
					npcMarker.SetActive(false);
				}
			}
			Vector3 position = ((Component)GameData.PlayerControl).transform.position;
			int num = 1 << LayerMask.NameToLayer("NPC");
			Collider[] array = Physics.OverlapSphere(position, _zoomLevel, num);
			if (array == null || array.Length == 0)
			{
				return;
			}
			Collider[] array2 = array;
			Color val3 = default(Color);
			foreach (Collider val in array2)
			{
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Character component = ((Component)val).GetComponent<Character>();
				if ((Object)(object)component == (Object)null || (Object)(object)component.MyNPC == (Object)null || (!component.Alive && !component.MiningNode && !component.MyNPC.SimPlayer) || (!component.isNPC && !component.MiningNode) || (!component.Alive && component.MyNPC.SimPlayer && !component.MyNPC.InGroup) || (Object)(object)((Component)component).transform == (Object)null)
				{
					continue;
				}
				Vector3 position2 = ((Component)component).transform.position;
				Vector3 val2 = _minimapCamera.WorldToViewportPoint(position2);
				float num2 = 0.05f;
				if (val2.z <= 0f || val2.x < num2 || val2.x > 1f - num2 || val2.y < num2 || val2.y > 1f - num2)
				{
					continue;
				}
				if (component.MyNPC.SimPlayer)
				{
					val3 = (component.MyNPC.InGroup ? new Color(0f, 1f, 0f, 0.75f) : new Color(0f, 0.5f, 1f, 0.85f));
				}
				else if (component.isVendor || (!string.IsNullOrEmpty(component.MyNPC.NPCName) && (_bankNpcs.Contains(component.MyNPC.NPCName) || _otherNpcs.Contains(component.MyNPC.NPCName))))
				{
					((Color)(ref val3))..ctor(1f, 1f, 0f, 0.75f);
				}
				else if (component.MiningNode)
				{
					((Color)(ref val3))..ctor(0.65f, 0.3f, 1f, 0.95f);
				}
				else if ((Object)(object)GameData.PlayerControl.Myself == (Object)null || component.AggressiveTowards == null || !component.AggressiveTowards.Contains(GameData.PlayerControl.Myself.MyFaction))
				{
					((Color)(ref val3))..ctor(0.6f, 0.6f, 0.6f, 0.75f);
				}
				else
				{
					((Color)(ref val3))..ctor(1f, 0f, 0f, 0.75f);
				}
				if (component.MiningNode && (!component.MiningNode || !((Behaviour)component).enabled))
				{
					continue;
				}
				bool isTarget = (Object)(object)GameData.PlayerControl.CurrentTarget != (Object)null && (Object)(object)GameData.PlayerControl.CurrentTarget == (Object)(object)component;
				GameObject val4 = ((IEnumerable<GameObject>)_npcMarkers).FirstOrDefault((Func<GameObject, bool>)((GameObject m) => (Object)(object)m != (Object)null && !m.activeSelf && ((Object)m).name == (isTarget ? "NPCMarkerSolid" : "NPCMarker")));
				if ((Object)(object)val4 == (Object)null)
				{
					if ((Object)(object)_npcMarkerContainer == (Object)null)
					{
						continue;
					}
					val4 = (isTarget ? CreateSolidMarker(val3) : CreateMarker(val3));
					val4.transform.SetParent((Transform)(object)_npcMarkerContainer, false);
					_npcMarkers.Add(val4);
				}
				else
				{
					Image[] componentsInChildren = val4.GetComponentsInChildren<Image>();
					foreach (Image val5 in componentsInChildren)
					{
						if ((Object)(object)val5 != (Object)null)
						{
							((Graphic)val5).color = val3;
						}
					}
					val4.SetActive(true);
				}
				if (!((Object)(object)val4 == (Object)null))
				{
					RectTransform component2 = val4.GetComponent<RectTransform>();
					GameObject minimapUIRoot = _minimapUIRoot;
					RectTransform val6 = ((minimapUIRoot != null) ? minimapUIRoot.GetComponent<RectTransform>() : null);
					if (!((Object)(object)component2 == (Object)null) && !((Object)(object)val6 == (Object)null))
					{
						Rect rect = val6.rect;
						float width = ((Rect)(ref rect)).width;
						rect = val6.rect;
						float height = ((Rect)(ref rect)).height;
						float num3 = (val2.x - 0.5f) * width;
						float num4 = (val2.y - 0.5f) * height;
						component2.anchoredPosition = new Vector2(num3, num4);
					}
				}
			}
		}

		private void UpdateZoneLineMarkers()
		{
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_013b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_015d: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_021d: 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_024f: Unknown result type (might be due to invalid IL or missing references)
			if (_zoneLineMarkers == null || (Object)(object)_minimapCamera == (Object)null || _allZonelines == null || (Object)(object)_npcMarkerContainer == (Object)null || (Object)(object)_minimapUIRoot == (Object)null)
			{
				return;
			}
			_zoneLineMarkers.RemoveAll((GameObject m) => (Object)(object)m == (Object)null || ((object)m).Equals((object?)null));
			foreach (GameObject zoneLineMarker in _zoneLineMarkers)
			{
				if (!((Object)(object)zoneLineMarker == (Object)null) && !((object)zoneLineMarker).Equals((object?)null))
				{
					zoneLineMarker.SetActive(false);
				}
			}
			RectTransform component = _minimapUIRoot.GetComponent<RectTransform>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			Rect rect = component.rect;
			float width = ((Rect)(ref rect)).width;
			rect = component.rect;
			float height = ((Rect)(ref rect)).height;
			Zoneline[] allZonelines = _allZonelines;
			foreach (Zoneline val in allZonelines)
			{
				if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).transform == (Object)null)
				{
					continue;
				}
				Vector3 position = ((Component)val).transform.position;
				Vector3 val2 = _minimapCamera.WorldToViewportPoint(position);
				if (val2.z <= 0f || val2.x < 0.05f || val2.x > 0.95f || val2.y < 0.05f || val2.y > 0.95f)
				{
					continue;
				}
				GameObject val3 = ((IEnumerable<GameObject>)_zoneLineMarkers).FirstOrDefault((Func<GameObject, bool>)((GameObject m) => (Object)(object)m != (Object)null && !m.activeSelf));
				if ((Object)(object)val3 == (Object)null)
				{
					val3 = CreateZoneLineMarker();
					if ((Object)(object)val3 != (Object)null)
					{
						val3.transform.SetParent((Transform)(object)_npcMarkerContainer, false);
						_zoneLineMarkers.Add(val3);
					}
				}
				if (!((Object)(object)val3 == (Object)null))
				{
					val3.SetActive(true);
					RectTransform component2 = val3.GetComponent<RectTransform>();
					if (!((Object)(object)component2 == (Object)null))
					{
						float num = (val2.x - 0.5f) * width;
						float num2 = (val2.y - 0.5f) * height;
						component2.anchoredPosition = new Vector2(Mathf.Round(num), Mathf.Round(num2));
					}
				}
			}
		}

		private GameObject CreateSolidMarker(Color color)
		{
			//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_0048: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			GameObject val = new GameObject("NPCMarkerSolid", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(8f, 8f);
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0f, 0f);
			component.pivot = new Vector2(0.5f, 0.5f);
			Image component2 = val.GetComponent<Image>();
			Texture2D whiteTexture = Texture2D.whiteTexture;
			component2.sprite = Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f));
			((Graphic)component2).color = color;
			return val;
		}

		private GameObject CreateMarker(Color borderColor)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			GameObject marker = new GameObject("NPCMarker", new Type[1] { typeof(RectTransform) });
			RectTransform component = marker.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(8f, 8f);
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0f, 0f);
			component.pivot = new Vector2(0.5f, 0.5f);
			float num = 1f;
			float num2 = component.sizeDelta.x / 2f;
			CreateLine("Top", new Vector2(8f, num), new Vector2(0f, num2 - num / 2f));
			CreateLine("Bottom", new Vector2(8f, num), new Vector2(0f, 0f - num2 + num / 2f));
			CreateLine("Left", new Vector2(num, 8f), new Vector2(0f - num2 + num / 2f, 0f));
			CreateLine("Right", new Vector2(num, 8f), new Vector2(num2 - num / 2f, 0f));
			return marker;
			void CreateLine(string name, Vector2 size, Vector2 position)
			{
				//IL_002e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				//IL_0057: Unknown result type (might be due to invalid IL or missing references)
				//IL_0063: Unknown result type (might be due to invalid IL or missing references)
				GameObject val = new GameObject(name, new Type[3]
				{
					typeof(RectTransform),
					typeof(CanvasRenderer),
					typeof(Image)
				});
				val.transform.SetParent(marker.transform, false);
				RectTransform component2 = val.GetComponent<RectTransform>();
				component2.sizeDelta = size;
				component2.anchoredPosition = position;
				((Graphic)val.GetComponent<Image>()).color = borderColor;
			}
		}

		private GameObject CreateZoneLineMarker()
		{
			//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_0048: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			GameObject val = new GameObject("ZonelineMarker", new Type[3]
			{
				typeof(RectTransform),
				typeof(CanvasRenderer),
				typeof(Image)
			});
			RectTransform component = val.GetComponent<RectTransform>();
			component.sizeDelta = new Vector2(48f, 48f);
			component.anchorMin = new Vector2(0f, 0f);
			component.anchorMax = new Vector2(0f, 0f);
			component.pivot = new Vector2(0.5f, 0.5f);
			Image component2 = val.GetComponent<Image>();
			if ((Object)(object)_mapZoneLineTexture != (Object)null)
			{
				component2.sprite = Sprite.Create(_mapZoneLineTexture, new Rect(0f, 0f, (float)((Texture)_mapZoneLineTexture).width, (float)((Texture)_mapZoneLineTexture).height), new Vector2(0.5f, 0.5f));
			}
			else
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"_mapZoneLineTexture is null, cannot assign sprite to zoneline marker.");
			}
			((Graphic)component2).color = new Color(1f, 1f, 1f, 0.7f);
			return val;
		}

		private bool IsMouseOverMinimap()
		{
			//IL_001c: 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_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)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_minimapUIRoot == (Object)null)
			{
				return false;
			}
			RectTransform component = _minimapUIRoot.GetComponent<RectTransform>();
			Vector2 zero = Vector2.zero;
			if (RectTransformUtility.ScreenPointToLocalPointInRectangle(component, Vector2.op_Implicit(Input.mousePosition), (Camera)null, ref zero))
			{
				Rect rect = component.rect;
				return ((Rect)(ref rect)).Contains(zero);
			}
			return false;
		}

		private Texture2D MakeDiamondGradientTexture(Color topColor)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			int num = 32;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			Color val2 = default(Color);
			((Color)(ref val2))..ctor(0.5f, 0.5f, 0.5f, 1f);
			for (int i = 0; i < num; i++)
			{
				float num2 = Mathf.Clamp(Mathf.Pow((float)(num - 1 - i) / (float)(num - 1), 5.5f), 0.7f, 1f);
				Color val3 = Color.Lerp(val2, topColor, num2);
				for (int j = 0; j < num; j++)
				{
					val.SetPixel(j, i, val3);
				}
			}
			val.Apply();
			return val;
		}

		private void LoadZoneBgTexture()
		{
			_mapZoneBgTexture = LoadImageTexture(Path.Combine(_assetDirectory, "zone_bg.png"));
		}

		private void LoadZoneLineTexture()
		{
			_mapZoneLineTexture = LoadImageTexture(Path.Combine(_assetDirectory, "zone_line.png"));
		}

		private void LoadCoordsBgTexture()
		{
			_mapCoordsBgTexture = LoadImageTexture(Path.Combine(_assetDirectory, "coords_bg.png"));
		}

		private void LoadArrowTexture()
		{
			_arrowTexture = LoadImageTexture(Path.Combine(_assetDirectory, "arrow.png"));
		}

		private Texture2D LoadImageTexture(string assetPath)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Expected O, but got Unknown
			//IL_007a: Expected O, but got Unknown
			if (!Directory.Exists(_assetDirectory))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Plugin directory not found " + _assetDirectory));
				return null;
			}
			if (!File.Exists(assetPath))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Texture not found " + assetPath));
				return null;
			}
			byte[] array = File.ReadAllBytes(assetPath);
			Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false);
			if (!ImageConversion.LoadImage(val, array))
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Failed to load texture from " + assetPath));
			}
			return val;
		}
	}
	public class ResizeUIBottomLeft : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
	{
		public RectTransform target;

		public float minSize = 200f;

		public float maxSize = 350f;

		private Vector2 _startMouse;

		private Vector2 _startSize;

		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_0008: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			GameData.DraggingUIElement = true;
			_startMouse = eventData.position;
			_startSize = target.sizeDelta;
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			GameData.DraggingUIElement = false;
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = eventData.position - _startMouse;
			float num = Mathf.Clamp(_startSize.x - val.x, minSize, maxSize);
			target.sizeDelta = new Vector2(num, num);
			MiniMapPlugin.SavedMinimapSize = new Vector2(num, num);
		}
	}
	public class ResizeUIBottomRight : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
	{
		public RectTransform target;

		public float minSize = 200f;

		public float maxSize = 350f;

		private Vector2 _startMouse;

		private Vector2 _startSize;

		public void OnPointerDown(PointerEventData eventData)
		{
			//IL_0008: 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_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			GameData.DraggingUIElement = true;
			_startMouse = eventData.position;
			_startSize = target.sizeDelta;
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			GameData.DraggingUIElement = false;
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = eventData.position - _startMouse;
			float num = Mathf.Clamp(_startSize.x + val.x, minSize, maxSize);
			target.sizeDelta = new Vector2(num, num);
			MiniMapPlugin.SavedMinimapSize = new Vector2(num, num);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Drizzlx.Erenshor.MiniMap";

		public const string PLUGIN_NAME = "MiniMap";

		public const string PLUGIN_VERSION = "2.0.1";
	}
}