Decompiled source of Completionist Map v1.0.3

CompletionistMap/CompletionistMapMod.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
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 System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GenericVariableExtension;
using GlobalEnums;
using GlobalSettings;
using HarmonyLib;
using HutongGames.PlayMaker;
using InControl;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using TMProOld;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using Yorai.CompletionistMap.MapIcon;
using Yorai.CompletionistMap.Menu;

[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("CompletionistMapMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CompletionistMapMod")]
[assembly: AssemblyTitle("CompletionistMapMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Yorai.CompletionistMap
{
	public interface IMapFilter
	{
		string NameKey { get; }

		string DisplayNameSingle { get; }

		string DisplayNameCategory { get; }

		Stylizer Style { get; }

		bool OverridesTexture { get; }

		FilterCountingFunction CustomCounting { get; }
	}
	public class SimpleMapFilter : IMapFilter
	{
		public string NameKey { get; }

		public Stylizer Style { get; set; }

		public bool OverridesTexture { get; set; }

		public FilterCountingFunction CustomCounting { get; set; }

		public string DisplayNameSingle { get; set; }

		public string DisplayNameCategory { get; set; }

		public SimpleMapFilter(string NameKey)
		{
			this.NameKey = NameKey;
			DisplayNameSingle = NameKey;
		}
	}
	public delegate(int obtained, int max) FilterCountingFunction();
	public class MapMarkerHoverFeature : MonoBehaviour
	{
		public MapMarkerRenderer Renderer;

		private GameObject _holder;

		private TextMeshPro _tempText;

		private Vector3 _lastHoveredScale;

		private Transform _lastHoveredPin;

		private GameObject _hoverEverythingRoot;

		private void Start()
		{
			RecreateResources();
		}

		private void OnDestroy()
		{
			Object.Destroy((Object)(object)_holder);
			Object.Destroy((Object)(object)_hoverEverythingRoot);
			ResetHoveredVanillaPinScale();
		}

		private void Update()
		{
			if (Utils.TryGetMap(out var _))
			{
				bool value = ModOptions.ShowAllMapZoneNames.Value;
				_hoverEverythingRoot.SetActive(value && !MapPatches.LatestDisplayedMapZone.HasValue);
				ShowTextForNearestPoint();
			}
		}

		private void RecreateResources()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Expected O, but got Unknown
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			Object.Destroy((Object)(object)_holder);
			Object.Destroy((Object)(object)_hoverEverythingRoot);
			TextMeshPro originalText = Object.FindAnyObjectByType<MapMarkerMenu>((FindObjectsInactive)1).amounts[0];
			_holder = new GameObject("Mod Map Hover Text");
			_tempText = Utils.CreateText(originalText, _holder);
			_holder.SetActive(false);
			if (!Utils.TryGetMap(out var map))
			{
				return;
			}
			_hoverEverythingRoot = new GameObject("Mod Map Zone names");
			_hoverEverythingRoot.transform.SetParent(((Component)map).transform);
			_hoverEverythingRoot.SetActive(false);
			Bounds val = default(Bounds);
			foreach (KeyValuePair<string, List<MapCache>> mapCache in map.mapCaches)
			{
				foreach (MapCache item in mapCache.Value)
				{
					if (Object.op_Implicit((Object)(object)item.gameMapScene) && item.gameMapScene.TryGetSpriteBounds(ref val))
					{
						GameObject val2 = new GameObject(mapCache.Key);
						val2.transform.SetParent(_hoverEverythingRoot.transform, false);
						TextMeshPro obj = Utils.CreateText(originalText, val2);
						val2.SetActive(true);
						val2.transform.position = ((Bounds)(ref val)).center;
						((TMP_Text)obj).text = mapCache.Key;
					}
				}
			}
		}

		private void ResetHoveredVanillaPinScale()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)_lastHoveredPin))
			{
				_lastHoveredPin.localScale = _lastHoveredScale;
				_lastHoveredPin = null;
			}
		}

		private void ShowTextForNearestPoint()
		{
			//IL_003a: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ba: 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_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: 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_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0202: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: 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_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0221: 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_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: 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_0269: 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_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: 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_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: 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_0247: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_0256: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)_holder))
			{
				RecreateResources();
			}
			_holder.SetActive(false);
			ResetHoveredVanillaPinScale();
			if (!Utils.IsMapOpen() || !MapPatches.CanShowCursor)
			{
				return;
			}
			(Camera, Transform, Camera) mapCamera = MapUtils.GetMapCamera();
			Vector3 mousePosition = ActionHelpers.GetMousePosition();
			KeyValuePair<IMapIcon, MapMarkerRenderer.VisibleMapEntry>? closestEntry = null;
			float num = 500f / mapCamera.Item1.orthographicSize;
			foreach (KeyValuePair<IMapIcon, MapMarkerRenderer.VisibleMapEntry> marker in Renderer.Markers)
			{
				if (marker.Value.Root.activeSelf)
				{
					Vector2 val = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(marker.Value.Root.transform.position), mapCamera);
					Vector3 val2 = mousePosition - Vector2.op_Implicit(val);
					float magnitude = ((Vector3)(ref val2)).magnitude;
					if (!(num <= magnitude))
					{
						num = magnitude;
						closestEntry = marker;
					}
				}
			}
			Transform val3 = null;
			foreach (Transform vanillaPin in Renderer.VanillaPins)
			{
				if (((Component)vanillaPin).gameObject.activeSelf)
				{
					Vector2 val4 = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(vanillaPin.position), mapCamera);
					Vector3 val5 = mousePosition - Vector2.op_Implicit(val4);
					float magnitude2 = ((Vector3)(ref val5)).magnitude;
					if (!(num <= magnitude2))
					{
						num = magnitude2;
						closestEntry = null;
						val3 = vanillaPin;
					}
				}
			}
			bool flag = closestEntry.HasValue || Object.op_Implicit((Object)(object)val3);
			GameMapScene val6 = null;
			_ = Vector2.zero;
			if (Utils.TryGetMap(out var map))
			{
				Bounds val7 = default(Bounds);
				foreach (KeyValuePair<string, List<MapCache>> mapCache in map.mapCaches)
				{
					foreach (MapCache item in mapCache.Value)
					{
						if (!Object.op_Implicit((Object)(object)item.gameMapScene) || !item.gameMapScene.TryGetSpriteBounds(ref val7))
						{
							continue;
						}
						Vector2 val8 = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(((Bounds)(ref val7)).min), mapCamera);
						Vector2 val9 = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(((Bounds)(ref val7)).max), mapCamera);
						bool flag2 = mousePosition.x >= val8.x && mousePosition.y >= val8.y && mousePosition.x <= val9.x && mousePosition.y <= val9.y;
						Vector2 val10 = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(((Bounds)(ref val7)).center), mapCamera);
						Vector3 val11 = mousePosition - Vector2.op_Implicit(val10);
						float magnitude3 = ((Vector3)(ref val11)).magnitude;
						if (flag)
						{
							if (num <= magnitude3)
							{
								continue;
							}
						}
						else if (!flag2)
						{
							continue;
						}
						closestEntry = null;
						val3 = null;
						_ = mapCache.Key;
						num = magnitude3;
						val6 = item.gameMapScene;
						Vector2.op_Implicit(((Bounds)(ref val7)).center);
					}
				}
			}
			if (closestEntry.HasValue)
			{
				DisplayTextFor(closestEntry);
			}
			else if (Object.op_Implicit((Object)(object)val3))
			{
				DisplayTextFor(val3);
			}
			else if (Object.op_Implicit((Object)(object)val6))
			{
				TryDisplayingSceneName(mapCamera, mousePosition);
			}
		}

		private void TryDisplayingSceneName((Camera mapCamera, Transform mapFilter, Camera hudCamera) set, Vector3 mousePosition)
		{
			//IL_0064: 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_006f: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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_00fa: Unknown result type (might be due to invalid IL or missing references)
			if (!Utils.TryGetMap(out var map))
			{
				return;
			}
			Bounds val = default(Bounds);
			foreach (KeyValuePair<string, List<MapCache>> mapCache in map.mapCaches)
			{
				foreach (MapCache item in mapCache.Value)
				{
					if (!Object.op_Implicit((Object)(object)item.gameMapScene) || !item.gameMapScene.TryGetSpriteBounds(ref val))
					{
						continue;
					}
					Vector2 val2 = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(((Bounds)(ref val)).min), set);
					Vector2 val3 = MapUtils.MapCameraToScreenSpace(Vector2.op_Implicit(((Bounds)(ref val)).max), set);
					if (mousePosition.x >= val2.x && mousePosition.y >= val2.y && mousePosition.x <= val3.x && mousePosition.y <= val3.y)
					{
						UpdateTextFor(((Bounds)(ref val)).center, mapCache.Key, default(Vector3));
						if (ClickedTeleportKey())
						{
							Object.FindAnyObjectByType<MapTeleportMenu>().TryTeleportingTo(item.gameMapScene, ((Bounds)(ref val)).center, withPreciseTeleport: false);
						}
						return;
					}
				}
			}
		}

		private void DisplayTextFor(Transform closestVanillaEntry)
		{
			//IL_000e: 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_001f: 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)
			_lastHoveredPin = closestVanillaEntry;
			_lastHoveredScale = _lastHoveredPin.localScale;
			Transform lastHoveredPin = _lastHoveredPin;
			lastHoveredPin.localScale *= 1.5f;
			UpdateTextFor(closestVanillaEntry, ((Object)closestVanillaEntry).name);
			if (ClickedTeleportKey())
			{
				Object.FindAnyObjectByType<MapTeleportMenu>().TryTeleportingTo(closestVanillaEntry);
			}
		}

		private void UpdateTextFor(Transform entry, string text)
		{
			//IL_001e: 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)
			TextMeshPro tempText = _tempText;
			_holder.SetActive(true);
			_holder.transform.position = entry.position + new Vector3(0f, -0.3f, 0f);
			((TMP_Text)tempText).text = text;
		}

		private void UpdateTextFor(Vector3 position, string text, Vector3 offset)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			TextMeshPro tempText = _tempText;
			_holder.SetActive(true);
			_holder.transform.position = position + offset;
			((TMP_Text)tempText).text = text;
		}

		private void DisplayTextFor(KeyValuePair<IMapIcon, MapMarkerRenderer.VisibleMapEntry>? closestEntry)
		{
			//IL_004f: 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_0060: 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)
			MapMarkerRenderer.VisibleMapEntry value = closestEntry.Value.Value;
			IMapIcon key = closestEntry.Value.Key;
			MarkerAnimation markerAnimation = default(MarkerAnimation);
			if (value.Root.TryGetComponent<MarkerAnimation>(ref markerAnimation))
			{
				markerAnimation.ClearAnimation();
			}
			_lastHoveredPin = value.Root.transform;
			_lastHoveredScale = _lastHoveredPin.localScale;
			Transform lastHoveredPin = _lastHoveredPin;
			lastHoveredPin.localScale *= 1.5f;
			IKeyboardProvider keyboardProvider = InputManager.KeyboardProvider;
			bool num = keyboardProvider != null && keyboardProvider.GetKeyIsPressed((Key)5);
			string text = key.Id;
			if (num)
			{
				text = key.Hierarchy.ActualScenePath + "\n" + key.Hierarchy.CleanScenePath + "\n" + key.Id + "\n" + key.Details + "\n" + key.Localized;
			}
			else if (!string.IsNullOrEmpty(key.Localized))
			{
				text = key.Localized;
			}
			else if (!string.IsNullOrEmpty(key.Details))
			{
				text = key.Details;
			}
			UpdateTextFor(value.Root.transform, text);
			if (ClickedTeleportKey())
			{
				Object.FindAnyObjectByType<MapTeleportMenu>().TryTeleportingTo(key);
			}
		}

		private bool ClickedTeleportKey()
		{
			if (Object.op_Implicit((Object)(object)EventSystem.current) && EventSystem.current.IsPointerOverGameObject())
			{
				return false;
			}
			ConfigEntry<bool> allowTeleports = ModOptions.AllowTeleports;
			if (allowTeleports == null || !allowTeleports.Value)
			{
				return false;
			}
			IMouseProvider mouseProvider = InputManager.MouseProvider;
			if (mouseProvider != null && mouseProvider.GetButtonIsPressed((Mouse)2))
			{
				IMouseProvider mouseProvider2 = InputManager.MouseProvider;
				if (mouseProvider2 == null)
				{
					return false;
				}
				return !mouseProvider2.GetButtonWasPressed((Mouse)2);
			}
			return false;
		}
	}
	public class MapMarkerRenderer : MonoBehaviour
	{
		public struct VisibleMapEntry
		{
			public GameObject Root;

			public Vector3 OriginalWorldPosition;
		}

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

			private object <>2__current;

			public MapMarkerRenderer <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				MapMarkerRenderer mapMarkerRenderer = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!ModMapData.Ready)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				mapMarkerRenderer.DoSetup();
				ModOptions.SceneMapMarkersEnabled.SettingChanged += mapMarkerRenderer.WipeSceneMapMarkers;
				ModOptions.SizeForMapPins.SettingChanged += mapMarkerRenderer.ResizePins;
				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();
			}
		}

		public MapScanner Scanner;

		public List<IMapIcon> Rendered = new List<IMapIcon>();

		public Dictionary<IMapIcon, VisibleMapEntry> Markers = new Dictionary<IMapIcon, VisibleMapEntry>();

		public List<Transform> VanillaPins = new List<Transform>();

		private Sprite _whiteSprite;

		private int _lastScanVersion;

		private List<Transform> _benchPins = new List<Transform>();

		private List<Transform> _shopPins = new List<Transform>();

		private List<Transform> _tubePins = new List<Transform>();

		private List<Transform> _bellwayPins = new List<Transform>();

		private List<Transform> _fleaPins = new List<Transform>();

		private Transform _markersRoot;

		private bool _lastMapIsOpen;

		private int _lastFastScanVersion;

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

		private string _lastSceneName;

		private GameObject _markerTemplateRoot;

		private int _timesTriedToOpenMap;

		private int _lastTimesTriedToOpenMap;

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

		private void OnDestroy()
		{
			ModOptions.SizeForMapPins.SettingChanged -= ResizePins;
			ModOptions.SceneMapMarkersEnabled.SettingChanged -= WipeSceneMapMarkers;
			ClearDisplayedMarkers();
			ClearSceneArrows();
			Object.Destroy((Object)(object)_whiteSprite);
		}

		public void RequestInSceneMapIcons()
		{
			_timesTriedToOpenMap++;
		}

		private void Update()
		{
			bool flag = Utils.IsMapOpen();
			if ((Object)(object)InteractManager.BlockingInteractable != (Object)null)
			{
				ClearSceneArrows();
			}
			if (_lastFastScanVersion != Scanner.Version || (flag && !_lastMapIsOpen) || _timesTriedToOpenMap != _lastTimesTriedToOpenMap)
			{
				_lastFastScanVersion = Scanner.Version;
				_lastTimesTriedToOpenMap = _timesTriedToOpenMap;
				string sceneName = GameManager.instance.sceneName;
				bool num = !ModOptions.SceneMapMarkersWhenEnteringScene.Value && sceneName != _lastSceneName;
				_lastSceneName = sceneName;
				if (!num)
				{
					TryCreatingArrows();
				}
			}
			if (_lastScanVersion != Scanner.Version && flag)
			{
				Stopwatch stopwatch = Stopwatch.StartNew();
				stopwatch.Start();
				UpdateMarkers();
				stopwatch.Stop();
			}
			_lastMapIsOpen = flag;
		}

		private void TryCreatingArrows()
		{
			if (!ModOptions.SceneMapMarkersEnabled.Value || !PlayerData.HasInstance || !PlayerData.instance.HasAnyMap)
			{
				return;
			}
			ClearSceneArrows();
			foreach (IMapIcon fastScanEntry in Scanner.FastScanEntries)
			{
				if (Scanner.Visible.Contains(fastScanEntry))
				{
					_arrows.Add(SceneMapMarker.Create(fastScanEntry, _markerTemplateRoot));
				}
			}
		}

		private void WipeSceneMapMarkers(object sender, EventArgs e)
		{
			ClearSceneArrows();
		}

		private void ClearSceneArrows()
		{
			foreach (GameObject arrow in _arrows)
			{
				Object.Destroy((Object)(object)arrow);
			}
			_arrows.Clear();
		}

		private void UpdateMarkers()
		{
			if (!Utils.TryGetMap(out var map))
			{
				ClearDisplayedMarkers();
				return;
			}
			Rendered.Clear();
			_lastScanVersion = Scanner.Version;
			if (!Object.op_Implicit((Object)(object)map.mapMarkerTemplates[0]))
			{
				Mod.Log.LogError((object)"Can't create map markers, as there's no base markers!");
				return;
			}
			foreach (KeyValuePair<IMapIcon, VisibleMapEntry> marker in Markers)
			{
				bool flag = Scanner.Visible.Contains(marker.Key);
				marker.Value.Root.SetActive(flag);
				if (flag)
				{
					Rendered.Add(marker.Key);
				}
			}
			PushOverlappingMarkers();
		}

		public void PushOverlappingMarkers(bool doAllMarkers = false)
		{
			//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_0107: 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_011e: Unknown result type (might be due to invalid IL or missing references)
			IEnumerable<IMapIcon> source = Rendered;
			if (doAllMarkers)
			{
				source = Markers.Keys;
			}
			foreach (IGrouping<(string, string, Type, Vector2), IMapIcon> item in from x in source
				group x by (x.Id, x.Hierarchy.CleanScenePath, x.GetType(), x.WorldPosition()))
			{
				List<IMapIcon> list = item.ToList();
				float num = (float)(list.Count - 1) / 2f;
				int num2 = 0;
				float num3 = 0.2f;
				if (item.Key.Item3 == typeof(QuestMapIcon))
				{
					num3 = 0f;
				}
				bool flag = num3 == 0f;
				bool flag2 = true;
				foreach (IMapIcon item2 in list)
				{
					if (Markers.TryGetValue(item2, out var value))
					{
						if (!flag2 && flag)
						{
							value.Root.SetActive(false);
							continue;
						}
						value.Root.transform.localPosition = value.OriginalWorldPosition;
						Transform transform = value.Root.transform;
						transform.localPosition += Vector3.right * (((float)num2++ - num) * num3);
						flag2 = false;
					}
				}
			}
		}

		private void DoSetup()
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			if (Utils.TryGetMap(out var map))
			{
				ClearDisplayedMarkers();
				_whiteSprite = Sprite.Create(Texture2D.whiteTexture, new Rect(0f, 0f, 4f, 4f), new Vector2(0.5f, 0.5f));
				GameObject originalTemplateMarker = map.mapMarkerTemplates[0];
				PrepareMarkerTemplate(originalTemplateMarker);
				BuildAllMarkers();
				HuntVanillaPins();
			}
		}

		private void ResizePins(object sender, EventArgs e)
		{
			MarkerAnimation markerAnimation = default(MarkerAnimation);
			foreach (KeyValuePair<IMapIcon, VisibleMapEntry> marker in Markers)
			{
				if (marker.Value.Root.TryGetComponent<MarkerAnimation>(ref markerAnimation))
				{
					markerAnimation.ClearAnimation();
				}
			}
		}

		private void HuntVanillaPins()
		{
			_benchPins.Clear();
			_shopPins.Clear();
			_tubePins.Clear();
			_bellwayPins.Clear();
			_fleaPins.Clear();
			if (Utils.TryGetMap(out var map))
			{
				FindVanillaPinsIn(((Component)map).transform);
				VanillaPins.Clear();
				VanillaPins.AddRange(_benchPins);
				VanillaPins.AddRange(_tubePins);
				VanillaPins.AddRange(_shopPins);
				VanillaPins.AddRange(_bellwayPins);
				VanillaPins.AddRange(_fleaPins);
			}
		}

		private void FindVanillaPinsIn(Transform current)
		{
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			if (((Object)current).name.Contains("Bench Pin", StringComparison.InvariantCultureIgnoreCase))
			{
				_benchPins.Add(current);
			}
			if (((Object)current).name.Contains("Shop Pin", StringComparison.InvariantCultureIgnoreCase))
			{
				_shopPins.Add(current);
			}
			if (((Object)current).name.Contains("Tube Pin", StringComparison.InvariantCultureIgnoreCase))
			{
				_tubePins.Add(current);
			}
			if (((Object)current).name.Contains("Bellway Pin", StringComparison.InvariantCultureIgnoreCase))
			{
				_bellwayPins.Add(current);
			}
			if (((Object)current).name.Contains("SavedFlea_", StringComparison.InvariantCultureIgnoreCase))
			{
				_fleaPins.Add(current);
			}
			foreach (Transform item in current)
			{
				Transform current2 = item;
				FindVanillaPinsIn(current2);
			}
		}

		private void PrepareMarkerTemplate(GameObject originalTemplateMarker)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0013: 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_001a: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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)
			GameObject val = new GameObject("Holder");
			val.transform.SetLocalPositionAndRotation(default(Vector3), Quaternion.identity);
			Object.DontDestroyOnLoad((Object)(object)val);
			val.SetActive(false);
			GameObject obj = Object.Instantiate<GameObject>(originalTemplateMarker, val.transform);
			obj.transform.SetLocalPositionAndRotation(default(Vector3), Quaternion.identity);
			obj.SetActive(true);
			Transform transform = obj.transform;
			transform.localScale *= 2f;
			Object.Destroy((Object)(object)obj.GetComponent<InvMarkerCollide>());
			Object.Destroy((Object)(object)obj.GetComponent<InvMarker>());
			Object.DestroyImmediate((Object)(object)((Component)obj.transform.GetChild(0)).gameObject);
			obj.GetComponent<SpriteRenderer>().sprite = _whiteSprite;
			val.gameObject.AddComponent<MarkerAnimation>();
			_markerTemplateRoot = val;
		}

		private void BuildAllMarkers()
		{
			if (!Utils.TryGetMap(out var map))
			{
				return;
			}
			_markersRoot = map.spawnedMapMarkers[0, 0].transform.parent;
			foreach (IMapIcon icon in ModMapData.Icons)
			{
				TryCreateMarker(icon);
			}
			Mod.Log.LogInfo((object)$"Prepared {Markers.Count} markers!");
		}

		private void TryCreateMarker(IMapIcon coord)
		{
			//IL_00c1: 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_00c9: 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)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: 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)
			if (coord.HidesSelf)
			{
				return;
			}
			IHaveHierarchy haveHierarchy = coord;
			if (!MapUtils.TryGetMapPoint(coord, out var mapCache, out var mappedScene))
			{
				bool flag = false;
				Serialized.TransitionPointData oneCloserToRoot;
				int jumpsDistanceFromRoot;
				while (ModMapData.Navigator.TryGetOnePointCloserToRoot(haveHierarchy.Hierarchy.CleanScenePath, out oneCloserToRoot, out jumpsDistanceFromRoot))
				{
					haveHierarchy = oneCloserToRoot;
					if (MapUtils.TryGetMapPoint(haveHierarchy, out mapCache, out mappedScene))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					Mod.Log.LogWarning((object)("Failed TryGetMapPoint - " + coord.Id + " | " + coord.Hierarchy.CleanScenePath));
					return;
				}
			}
			if (!MapUtils.TryGetPosition(haveHierarchy, mapCache, mappedScene, out var mapPosition))
			{
				Mod.Log.LogWarning((object)("Failed TryGetPosition - " + coord.Id + " | " + coord.Hierarchy.CleanScenePath));
				return;
			}
			Rendered.Add(coord);
			GameObject val = Object.Instantiate<GameObject>(_markerTemplateRoot, default(Vector3), Quaternion.identity, _markersRoot);
			val.transform.SetLocalPositionAndRotation(Vector2.op_Implicit(mapPosition), Quaternion.identity);
			SpriteRenderer componentInChildren = val.GetComponentInChildren<SpriteRenderer>();
			coord.Stylize(((Component)componentInChildren).gameObject, componentInChildren);
			Markers.Add(coord, new VisibleMapEntry
			{
				Root = val,
				OriginalWorldPosition = Vector2.op_Implicit(mapPosition)
			});
		}

		public void ClearDisplayedMarkers()
		{
			Object.Destroy((Object)(object)_markerTemplateRoot);
			foreach (KeyValuePair<IMapIcon, VisibleMapEntry> marker in Markers)
			{
				Object.Destroy((Object)(object)marker.Value.Root);
			}
			Rendered.Clear();
			Markers.Clear();
		}
	}
	public class MapMovement : MonoBehaviour
	{
		private static class FocusedZoomUtils
		{
			public static Vector3 GetDeltaForFocusedZoom(Camera cam, Transform movingTransform, float newOrthoSize, Vector2 mouseScreenPos)
			{
				//IL_0001: 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_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_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: Unknown result type (might be due to invalid IL or missing references)
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: 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_004d: Unknown result type (might be due to invalid IL or missing references)
				float z = movingTransform.position.z - ((Component)cam).transform.position.z;
				Vector3 val = ScreenToWorldOrtho(cam, cam.orthographicSize, mouseScreenPos, z);
				Vector3 val2 = ScreenToWorldOrtho(cam, newOrthoSize, mouseScreenPos, z) - val;
				return new Vector3(val2.x, val2.y, 0f);
			}

			private static Vector3 ScreenToWorldOrtho(Camera cam, float orthoSize, Vector2 screen, float z)
			{
				//IL_0002: 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_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004c: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0058: Unknown result type (might be due to invalid IL or missing references)
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Unknown result type (might be due to invalid IL or missing references)
				//IL_006b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				Vector2 val = default(Vector2);
				((Vector2)(ref val))..ctor(screen.x - 0.5f * (float)Screen.width, screen.y - 0.5f * (float)Screen.height);
				float num = orthoSize * 2f / (float)Screen.height;
				Vector2 val2 = Vector2.op_Implicit(((Component)cam).transform.position) + val * num;
				return new Vector3(val2.x, val2.y, ((Component)cam).transform.position.z + z);
			}
		}

		private class VerybadOldSmoothMapDraggingUtils
		{
			private readonly bool _invertX = true;

			private readonly bool _invertY = true;

			private readonly bool _compensateForMapScale = true;

			private Vector2? _lastMouse;

			private Vector3 _lastDelta;

			private bool _lastHolding;

			public void DragMapExact(Transform gameMapTransform)
			{
				//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_0036: 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_006f: 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_0080: 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_00a5: 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_00d7: 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_00eb: 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_00f3: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0110: 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_0118: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0120: Unknown result type (might be due to invalid IL or missing references)
				//IL_0122: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_0128: Unknown result type (might be due to invalid IL or missing references)
				//IL_012d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0137: Unknown result type (might be due to invalid IL or missing references)
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_014e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0153: Unknown result type (might be due to invalid IL or missing references)
				//IL_015d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0161: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: 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_017e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0183: Unknown result type (might be due to invalid IL or missing references)
				//IL_0188: 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_0193: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a4: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0201: Unknown result type (might be due to invalid IL or missing references)
				//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
				//IL_0206: Unknown result type (might be due to invalid IL or missing references)
				//IL_0208: Unknown result type (might be due to invalid IL or missing references)
				//IL_020a: Unknown result type (might be due to invalid IL or missing references)
				//IL_020c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0211: Unknown result type (might be due to invalid IL or missing references)
				//IL_0213: Unknown result type (might be due to invalid IL or missing references)
				//IL_021f: Unknown result type (might be due to invalid IL or missing references)
				//IL_022c: 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_0245: Unknown result type (might be due to invalid IL or missing references)
				//IL_02c2: Unknown result type (might be due to invalid IL or missing references)
				//IL_0292: Unknown result type (might be due to invalid IL or missing references)
				//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
				//IL_0311: Unknown result type (might be due to invalid IL or missing references)
				//IL_0316: Unknown result type (might be due to invalid IL or missing references)
				//IL_031d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0323: Unknown result type (might be due to invalid IL or missing references)
				//IL_0328: Unknown result type (might be due to invalid IL or missing references)
				//IL_0333: Unknown result type (might be due to invalid IL or missing references)
				(Camera mapCamera, Transform mapFilter, Camera hudCamera) mapCamera = MapUtils.GetMapCamera();
				Camera item = mapCamera.mapCamera;
				Transform item2 = mapCamera.mapFilter;
				Camera item3 = mapCamera.hudCamera;
				IMouseProvider mouseProvider = InputManager.MouseProvider;
				bool flag = mouseProvider != null && mouseProvider.GetButtonIsPressed((Mouse)1);
				Vector2 val = Vector2.op_Implicit(ActionHelpers.GetMousePosition());
				if (flag && !_lastHolding && EventSystem.current.IsPointerOverGameObject())
				{
					flag = false;
				}
				if (!flag)
				{
					_lastHolding = false;
					_lastMouse = null;
					gameMapTransform.position -= _lastDelta;
					_lastDelta *= 0.96f;
				}
				else if (!_lastHolding)
				{
					_lastHolding = true;
					_lastMouse = val;
				}
				else if (_lastMouse.HasValue)
				{
					Ray val2 = item3.ScreenPointToRay(new Vector3(_lastMouse.Value.x, _lastMouse.Value.y, 0f));
					Ray val3 = item3.ScreenPointToRay(new Vector3(val.x, val.y, 0f));
					Vector3 forward = item2.forward;
					Vector3 position = item2.position;
					float num = Vector3.Dot(forward, position - ((Ray)(ref val2)).origin) / Vector3.Dot(forward, ((Ray)(ref val2)).direction);
					float num2 = Vector3.Dot(forward, position - ((Ray)(ref val3)).origin) / Vector3.Dot(forward, ((Ray)(ref val3)).direction);
					Vector3 val4 = ((Ray)(ref val2)).origin + ((Ray)(ref val2)).direction * num;
					Vector3 val5 = ((Ray)(ref val3)).origin + ((Ray)(ref val3)).direction * num2;
					Vector3 val6 = item2.InverseTransformPoint(val4);
					Vector3 val7 = item2.InverseTransformPoint(val5);
					MeshFilter component = ((Component)item2).GetComponent<MeshFilter>();
					Mesh val8 = (Object.op_Implicit((Object)(object)component) ? component.sharedMesh : null);
					? val9;
					if (!Object.op_Implicit((Object)(object)val8))
					{
						val9 = new Vector3(1f, 1f, 1f);
					}
					else
					{
						Bounds bounds = val8.bounds;
						val9 = ((Bounds)(ref bounds)).size;
					}
					Vector3 val10 = (Vector3)val9;
					Vector3 val11 = val7 - val6;
					Vector2 val12 = new Vector2(val11.x / Mathf.Max(0.0001f, val10.x), val11.y / Mathf.Max(0.0001f, val10.y));
					float num3 = 2f * item.orthographicSize * item.aspect;
					float num4 = 2f * item.orthographicSize;
					float num5 = 1f;
					float num6 = 1f;
					if (_compensateForMapScale)
					{
						num5 = 1f / Mathf.Max(0.0001f, gameMapTransform.lossyScale.x);
						num6 = 1f / Mathf.Max(0.0001f, gameMapTransform.lossyScale.y);
					}
					float num7 = val12.x * num3 * (_invertX ? (-1f) : 1f) * num5;
					float num8 = val12.y * num4 * (_invertY ? (-1f) : 1f) * num6;
					_lastDelta = new Vector3(num7, num8, 0f);
					gameMapTransform.position -= _lastDelta;
					_lastMouse = val;
				}
			}
		}

		private VerybadOldSmoothMapDraggingUtils _smoothDragging = new VerybadOldSmoothMapDraggingUtils();

		private const float _defaultZoom = 8.7f;

		private float _zoomMomentum;

		private void Update()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (Utils.TryGetMap(out var map) && Utils.IsMapOpen())
			{
				AllowZoomScrolling();
				_smoothDragging.DragMapExact(((Component)map).transform);
				map.UpdateMapPosition(Vector2.op_Implicit(GetGameMapTransform().localPosition));
			}
		}

		private void AllowZoomScrolling()
		{
			//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_008b: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			(Camera mapCamera, Transform mapFilter, Camera hudCamera) mapCamera = MapUtils.GetMapCamera();
			(Camera, Transform, Camera) decoratorCamera = MapUtils.GetDecoratorCamera();
			float num = 8.7f;
			num = mapCamera.mapCamera.orthographicSize;
			float num2 = 0f - Utils.Scroll();
			if (EventSystem.current.IsPointerOverGameObject())
			{
				num2 = 0f;
			}
			_zoomMomentum += num2;
			num *= 1f + 0.025f * _zoomMomentum;
			_zoomMomentum *= 0.94f;
			Transform transform = GameObject.Find("/_GameCameras/HudCamera/In-game/Game Map Rendering/Game_Map_Hornet(Clone)").transform;
			Camera item = mapCamera.mapCamera;
			Vector2 mouseScreenPos = Vector2.op_Implicit(ActionHelpers.GetMousePosition());
			Vector3 deltaForFocusedZoom = FocusedZoomUtils.GetDeltaForFocusedZoom(item, transform, num, mouseScreenPos);
			transform.localPosition += deltaForFocusedZoom;
			mapCamera.mapCamera.orthographicSize = num;
			decoratorCamera.Item1.orthographicSize = num;
		}

		private Transform GetGameMapTransform()
		{
			return GameObject.Find("/_GameCameras/HudCamera/In-game/Game Map Rendering/Game_Map_Hornet(Clone)").transform;
		}
	}
	public class MapScanner : MonoBehaviour
	{
		private static class ReasonedResults
		{
			public static ReasonedResult FilterIsDisabled = new ReasonedResult(passes: false, "Filter is disabled");

			public static ReasonedResult CoordinateIsCleared = new ReasonedResult(passes: false, "Coordinate is cleared");

			public static ReasonedResult DebugIgnoreHide = new ReasonedResult(passes: true, "Debug ignore hide");

			public static ReasonedResult PreferencesPrevented = new ReasonedResult(passes: false, "Preferences Prevented");

			public static ReasonedResult HidesSelf = new ReasonedResult(passes: false, "Hides Self");

			public static ReasonedResult AnyFsmFlagsTriggered = new ReasonedResult(passes: false, "Fsm flags triggered");

			public static ReasonedResult HierarchyHides = new ReasonedResult(passes: false, "Hierarchy hides");

			public static ReasonedResult ReasonToHide = new ReasonedResult(passes: false, "Reason to hide");

			public static ReasonedResult QuickMapDoesntAllow = new ReasonedResult(passes: false, "Quick map doesn't allow");

			public static ReasonedResult Success = new ReasonedResult(passes: true, "Incomplete Entry");
		}

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

			private object <>2__current;

			public MapScanner <>4__this;

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

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

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

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

			private bool MoveNext()
			{
				int num = <>1__state;
				MapScanner mapScanner = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!ModMapData.Ready)
				{
					<>2__current = null;
					<>1__state = 1;
					return true;
				}
				ModOptions.JournalEntryDisplayMode.SettingChanged += mapScanner.ForceUpdate;
				ModOptions.JournalEntryCompletionMode.SettingChanged += mapScanner.ForceUpdate;
				ModOptions.AreaDisplayLimitation.SettingChanged += mapScanner.ForceUpdate;
				ModOptions.AreaDisplayTiming.SettingChanged += mapScanner.ForceUpdate;
				foreach (KeyValuePair<string, ConfigEntry<bool>> toggle in ModOptions.Toggles)
				{
					toggle.Value.SettingChanged += mapScanner.ForceUpdate;
				}
				mapScanner.TryScan(forced: true);
				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();
			}
		}

		public List<IMapIcon> Visible = new List<IMapIcon>();

		public List<IMapIcon> FastScanEntries = new List<IMapIcon>();

		private bool _forceUpdate;

		private string _lastSceneName;

		private MapZone? _lastMapZone;

		private bool _respectMinimap;

		public int Version { get; private set; }

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

		private void OnDestroy()
		{
			ModOptions.JournalEntryDisplayMode.SettingChanged -= ForceUpdate;
			ModOptions.JournalEntryCompletionMode.SettingChanged -= ForceUpdate;
			ModOptions.AreaDisplayLimitation.SettingChanged -= ForceUpdate;
			ModOptions.AreaDisplayTiming.SettingChanged -= ForceUpdate;
			foreach (KeyValuePair<string, ConfigEntry<bool>> toggle in ModOptions.Toggles)
			{
				toggle.Value.SettingChanged -= ForceUpdate;
			}
		}

		private void ForceUpdate(object sender, EventArgs e)
		{
			_forceUpdate = true;
		}

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)GameManager.UnsafeInstance) && GameManager.instance.HasFinishedEnteringScene)
			{
				if (GameManager.instance.IsMenuScene())
				{
					_lastSceneName = null;
					return;
				}
				TryScan();
				ScanFastEntries();
			}
		}

		private void TryScan(bool forced = false)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			string sceneName = GameManager.instance.sceneName;
			MapZone? latestDisplayedMapZone = MapPatches.LatestDisplayedMapZone;
			if (_lastSceneName != sceneName || _forceUpdate || _lastMapZone != latestDisplayedMapZone || forced)
			{
				_respectMinimap = _lastMapZone != latestDisplayedMapZone;
				_lastSceneName = sceneName;
				_forceUpdate = false;
				_lastMapZone = latestDisplayedMapZone;
				Scan();
			}
		}

		private void ScanFastEntries()
		{
			for (int num = FastScanEntries.Count - 1; num >= 0; num--)
			{
				IMapIcon mapIcon = FastScanEntries[num];
				if (mapIcon.FastScanWhetherCoordinateIsComplete())
				{
					Visible.Remove(mapIcon);
					FastScanEntries.RemoveAt(num);
					Version++;
				}
				else if (mapIcon.CoordinateIsCleared())
				{
					Visible.Remove(mapIcon);
					FastScanEntries.RemoveAt(num);
					Version++;
				}
			}
		}

		public void Scan()
		{
			if (!ModMapData.Ready || !Utils.TryGetMap(out var _) || !Object.op_Implicit((Object)(object)GameManager.UnsafeInstance))
			{
				return;
			}
			Stopwatch stopwatch = new Stopwatch();
			stopwatch.Start();
			Visible.Clear();
			FastScanEntries.Clear();
			foreach (IMapIcon icon in ModMapData.Icons)
			{
				if (DisplayableLocation(icon, checkSelf: true))
				{
					Visible.Add(icon);
					if (icon.Hierarchy.CleanScenePath == GameManager.instance.sceneName)
					{
						FastScanEntries.Add(icon);
					}
				}
			}
			stopwatch.Stop();
			Mod.Log.LogInfo((object)$"Scanned coordinates, {Visible.Count} visible, took {stopwatch.ElapsedMilliseconds}ms");
			Version++;
		}

		public bool DisplayableLocation(IMapIcon coord, bool checkSelf, bool checkClear = true)
		{
			return DisplayableLocationVerbose(coord, checkSelf, checkClear).Passes;
		}

		public ReasonedResult DisplayableLocationVerbose(IMapIcon coord, bool checkSelf, bool checkClear = true)
		{
			if (coord.Filter != null && ModOptions.Toggles.TryGetValue(coord.Filter.NameKey, out var value) && !value.Value)
			{
				return ReasonedResults.FilterIsDisabled;
			}
			if (checkClear && coord.CoordinateIsCleared())
			{
				return ReasonedResults.CoordinateIsCleared;
			}
			if (ModOptions.DebugIgnoreHide.Value)
			{
				return ReasonedResults.DebugIgnoreHide;
			}
			if (!CanPreferencesDisplay(coord))
			{
				return ReasonedResults.PreferencesPrevented;
			}
			if (checkSelf && coord.HidesSelf)
			{
				return ReasonedResults.HidesSelf;
			}
			if (AnyFsmFlagsTriggered(coord))
			{
				return ReasonedResults.AnyFsmFlagsTriggered;
			}
			if (DoesHierarchyHaveReasonToHide(coord))
			{
				return ReasonedResults.HierarchyHides;
			}
			if (coord.HasReasonToHide())
			{
				return ReasonedResults.ReasonToHide;
			}
			if (!QuickMapAllows(coord))
			{
				return ReasonedResults.QuickMapDoesntAllow;
			}
			return ReasonedResults.Success;
		}

		private bool QuickMapAllows(IMapIcon coord)
		{
			if (!_respectMinimap)
			{
				return true;
			}
			if (_lastMapZone.HasValue && MapUtils.TryGetMapCache(coord, out var mapCache) && !mapCache[0].mapParent.Parent.activeSelf)
			{
				return false;
			}
			return true;
		}

		private bool CanPreferencesDisplay(IMapIcon coord)
		{
			Preferences.AreaDisplayTimingPreference value = ModOptions.AreaDisplayTiming.Value;
			bool flag = GameManager.UnsafeInstance.sceneName == coord.Hierarchy.CleanScenePath;
			bool flag2 = flag;
			switch (value)
			{
			case Preferences.AreaDisplayTimingPreference.Mapped:
				if (!flag2 && !PlayerData._instance.scenesMapped.Contains(coord.Hierarchy.CleanScenePath))
				{
					return false;
				}
				break;
			case Preferences.AreaDisplayTimingPreference.Sketched:
				if (!flag2 && !PlayerData._instance.scenesVisited.Contains(coord.Hierarchy.CleanScenePath))
				{
					return false;
				}
				break;
			}
			if (ModOptions.AreaDisplayLimitation.Value == Preferences.AreaDisplayLimitationPreference.CurrentArea && !flag)
			{
				return false;
			}
			return true;
		}

		private static bool AnyFsmFlagsTriggered(IMapIcon coord)
		{
			foreach (Serialized.FsmFlag flag2 in coord.Flags)
			{
				if (flag2.IsBool)
				{
					bool @bool = PlayerData.instance.GetBool(flag2.DataKey);
					bool flag = flag2.DataValue == "true";
					if (@bool == flag)
					{
						return true;
					}
				}
			}
			return false;
		}

		public bool DoHierarchyParentsHideIcon(IMapIcon coord, Serialized.Hierarchy hierarchy)
		{
			if (hierarchy.Transforms[0].Controls.Name == coord.Id)
			{
				foreach (IMapIcon relevantParent in coord.RelevantParents)
				{
					if (!DisplayableLocation(relevantParent, checkSelf: false))
					{
						return true;
					}
				}
			}
			return false;
		}

		public bool DoesHierarchyHaveReasonToHide(IMapIcon icon)
		{
			Serialized.Hierarchy hierarchy = icon.Hierarchy;
			bool checksSelfEnabled = icon.ChecksSelfEnabled;
			for (int num = hierarchy.Transforms.Count - 1; num >= 0; num--)
			{
				Serialized.Controls controls = hierarchy.Transforms[num].Controls;
				if (ActivatorHidesThis(hierarchy.Transforms, num))
				{
					return true;
				}
				if (!string.IsNullOrEmpty(controls.CustomIntFlag) && PlayerData.instance.GetInt(controls.CustomIntFlag) >= controls.CustomIntValue)
				{
					return true;
				}
				if (!string.IsNullOrEmpty(controls.DisableIfFalse) && !PlayerData.instance.GetBool(controls.DisableIfFalse))
				{
					return true;
				}
				if (!string.IsNullOrEmpty(controls.DisableIfTrue) && PlayerData.instance.GetBool(controls.DisableIfTrue))
				{
					return true;
				}
				if (!string.IsNullOrEmpty(controls.CustomBoolFlag) && PlayerData.instance.GetBool(controls.CustomBoolFlag))
				{
					return true;
				}
				if (checksSelfEnabled && !controls.Enabled)
				{
					return true;
				}
			}
			if (DoHierarchyParentsHideIcon(icon, hierarchy))
			{
				return true;
			}
			return false;
		}

		private bool ActivatorHidesThis(List<Serialized.TransformData> transforms, int startIndex)
		{
			Serialized.TransformData transformData = transforms[startIndex];
			for (int num = transforms.Count - 1; num >= startIndex; num--)
			{
				Serialized.Controls controls = transforms[num].Controls;
				foreach (Serialized.QuestTestData item in controls.Quest)
				{
					if (item.SetOff == transformData.Controls.Name && item.IsFulfilled)
					{
						return true;
					}
					if (item.SetOn == transformData.Controls.Name && !item.IsFulfilled)
					{
						return true;
					}
				}
				foreach (Serialized.PlayerDataTest playerDataTest in controls.PlayerDataTests)
				{
					if (playerDataTest.SetOff == transformData.Controls.Name && playerDataTest.IsFulfilled)
					{
						return true;
					}
					if (playerDataTest.SetOn == transformData.Controls.Name && !playerDataTest.IsFulfilled)
					{
						return true;
					}
				}
				foreach (Serialized.ToolTestData item2 in controls.Tool)
				{
					if (item2.SetOff == transformData.Controls.Name && item2.IsFulfilled)
					{
						return true;
					}
					if (item2.SetOn == transformData.Controls.Name && !item2.IsFulfilled)
					{
						return true;
					}
				}
			}
			return false;
		}
	}
	public class MapTeleportMenu : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <SetPositionAfterSceneLoadFinishes>d__13 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MapTeleportMenu <>4__this;

			public Vector2 positionInScene;

			public object sourceObject;

			private CameraController <cameraController>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 <SetPositionAfterSceneLoadFinishes>d__13(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

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

			private bool MoveNext()
			{
				//IL_007e: 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_0092: Unknown result type (might be due to invalid IL or missing references)
				//IL_024e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0253: Unknown result type (might be due to invalid IL or missing references)
				//IL_00af: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
				//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
				//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
				//IL_0202: Unknown result type (might be due to invalid IL or missing references)
				//IL_0106: Unknown result type (might be due to invalid IL or missing references)
				//IL_010b: Unknown result type (might be due to invalid IL or missing references)
				//IL_010f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0114: Unknown result type (might be due to invalid IL or missing references)
				//IL_0119: 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_016e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0173: 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_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_013f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0144: Unknown result type (might be due to invalid IL or missing references)
				//IL_0149: Unknown result type (might be due to invalid IL or missing references)
				//IL_0194: 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_019d: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				MapTeleportMenu mapTeleportMenu = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0046;
				case 1:
					<>1__state = -1;
					goto IL_0046;
				case 2:
					<>1__state = -1;
					goto IL_0067;
				case 3:
					{
						<>1__state = -1;
						<i>5__3++;
						goto IL_0286;
					}
					IL_0046:
					if (mapTeleportMenu.IsTeleporting)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					goto IL_0067;
					IL_0067:
					if (!GameManager.instance.HasFinishedEnteringScene)
					{
						<>2__current = null;
						<>1__state = 2;
						return true;
					}
					Extensions.SetPosition2D(HeroController.instance.transform, positionInScene + new Vector2(0f, 2.5f));
					if (sourceObject is IMapIcon hierarchyHolder)
					{
						Vector2 targetPosition = positionInScene;
						GameObject val = GameObject.Find(hierarchyHolder.FullPath());
						if ((Object)(object)val != (Object)null)
						{
							GameObject val2 = val;
							Transform val3 = val.transform.Find("Solid");
							if (Object.op_Implicit((Object)(object)val3))
							{
								val2 = ((Component)val3).gameObject;
							}
							BoxCollider2D val4 = default(BoxCollider2D);
							Bounds bounds;
							if (val2.TryGetComponent<BoxCollider2D>(ref val4))
							{
								bounds = ((Collider2D)val4).bounds;
								targetPosition = Vector2.op_Implicit(((Bounds)(ref bounds)).center);
							}
							Collider2D val5 = default(Collider2D);
							if (Object.op_Implicit((Object)(object)val.GetComponentInChildren<ReceivedDamageProxy>()) && val.TryGetComponent<Collider2D>(ref val5))
							{
								bounds = val5.bounds;
								targetPosition = Vector2.op_Implicit(((Bounds)(ref bounds)).center);
							}
							Transform val6 = val.transform.Find("explode rock");
							if (Object.op_Implicit((Object)(object)val6))
							{
								targetPosition = Vector2.op_Implicit(val6.position);
							}
							Lever componentInChildren = val.GetComponentInChildren<Lever>();
							if (Object.op_Implicit((Object)(object)componentInChildren) && ((Component)componentInChildren).TryGetComponent<Collider2D>(ref val5))
							{
								bounds = val5.bounds;
								targetPosition = Vector2.op_Implicit(((Bounds)(ref bounds)).center);
							}
						}
						Teleport2D.TeleportToNearestClearSpot(((Component)HeroController.instance).gameObject, targetPosition);
						if ((Object)(object)val != (Object)null)
						{
							Transform val7 = val.transform.Find("Dir Check");
							if ((Object)(object)val7 != (Object)null)
							{
								Transform transform = ((Component)HeroController.instance).gameObject.transform;
								transform.position += ((Component)val7).transform.localPosition;
							}
						}
					}
					<cameraController>5__2 = Object.FindFirstObjectByType<CameraController>();
					if (!Object.op_Implicit((Object)(object)<cameraController>5__2))
					{
						break;
					}
					<i>5__3 = 0;
					goto IL_0286;
					IL_0286:
					if (<i>5__3 < 10)
					{
						<cameraController>5__2.PositionToHeroInstant(true);
						Extensions.SetPosition2D(((Component)<cameraController>5__2).transform, Vector2.op_Implicit(HeroController.instance.transform.position));
						<>2__current = null;
						<>1__state = 3;
						return true;
					}
					break;
				}
				HeroController.instance.RegainControl(true);
				HeroController.instance.ResetVelocity();
				InventoryMapManager val8 = Object.FindFirstObjectByType<InventoryMapManager>((FindObjectsInactive)1);
				if (Object.op_Implicit((Object)(object)val8))
				{
					val8.LockedZoomUndo();
				}
				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 <StartRoutine_SwitchMap>d__9 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MapTeleportMenu <>4__this;

			public GameMap map;

			public string scenePath;

			public SceneInfo sceneInfo;

			private InventoryPaneList <inventory>5__2;

			private PlayMakerFSM <inventoryFsm>5__3;

			private InventoryMapManager <mapManager>5__4;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<inventory>5__2 = null;
				<inventoryFsm>5__3 = null;
				<mapManager>5__4 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0143: Unknown result type (might be due to invalid IL or missing references)
				//IL_0148: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_016b: 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_017d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0184: Unknown result type (might be due to invalid IL or missing references)
				//IL_018b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0197: Expected O, but got Unknown
				int num = <>1__state;
				MapTeleportMenu mapTeleportMenu = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
				{
					<>1__state = -1;
					mapTeleportMenu.IsTeleporting = true;
					<inventory>5__2 = Object.FindFirstObjectByType<InventoryPaneList>();
					<inventoryFsm>5__3 = PlayMakerFSM.FindFsmOnGameObject(((Component)<inventory>5__2).gameObject, "Inventory Control");
					InventoryMapManager obj = Object.FindFirstObjectByType<InventoryMapManager>();
					PlayMakerFSM.FindFsmOnGameObject(((Component)obj).gameObject, "Inventory Proxy");
					PlayMakerFSM.FindFsmOnGameObject(((Component)obj).gameObject, "UI Control").SetState("Zoom Out");
					<mapManager>5__4 = Object.FindFirstObjectByType<InventoryMapManager>((FindObjectsInactive)1);
					goto IL_00aa;
				}
				case 1:
					<>1__state = -1;
					goto IL_00aa;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_00aa:
					if (<mapManager>5__4.isZoomed)
					{
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					if (!Object.op_Implicit((Object)(object)<inventoryFsm>5__3))
					{
						Mod.Log.LogError((object)"Didn't find inventory?!");
					}
					<inventoryFsm>5__3.SetState("Close");
					map.CloseQuickMap();
					break;
				}
				if (Extensions.GetFsmBoolIfExists(<inventoryFsm>5__3, "Open"))
				{
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				Mod.Log.LogInfo((object)("Teleporting!: " + scenePath));
				GameManager.instance.SetPausedState(false);
				GameManager.instance.BeginSceneTransition(new SceneLoadInfo
				{
					SceneName = scenePath,
					EntryGateName = sceneInfo.TransitionGates[0],
					EntryDelay = 0f,
					PreventCameraFadeOut = true,
					WaitForSceneTransitionCameraFade = false,
					EntrySkip = true,
					IsFirstLevelForPlayer = false
				});
				GameManager.instance.SetPausedState(false);
				<inventory>5__2.allowSwapping = FsmBool.op_Implicit(true);
				<inventory>5__2.CloseBlocked = false;
				mapTeleportMenu.IsTeleporting = 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();
			}
		}

		public static bool ShowTeleportationMenu;

		public MapMarkerRenderer _mapMarkerRenderer;

		private Rect _windowSize = new Rect(0f, 0f, 500f, 1080f);

		private Vector2 _debugScrollPosition;

		public bool IsTeleporting;

		private IMapIcon _latestCoord;

		private void Update()
		{
			if (Object.op_Implicit((Object)(object)GameManager.UnsafeInstance))
			{
				ConfigEntry<bool> allowTeleports = ModOptions.AllowTeleports;
				if (allowTeleports == null || !allowTeleports.Value)
				{
					ShowTeleportationMenu = false;
				}
				else if (Utils.JustPressed((Key)15))
				{
					ShowTeleportationMenu = !ShowTeleportationMenu;
				}
			}
		}

		private void OnGUI()
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: 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_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			if (!ShowTeleportationMenu)
			{
				return;
			}
			List<IMapIcon> rendered = _mapMarkerRenderer.Rendered;
			Dictionary<string, ModMapData.MappedScene> scenes = ModMapData.Scenes;
			int num = 23;
			float num2 = rendered.Count * num;
			_debugScrollPosition = GUI.BeginScrollView(_windowSize, _debugScrollPosition, new Rect(0f, 0f, ((Rect)(ref _windowSize)).width + 30f, num2));
			int num3 = 0;
			if (!Utils.TryGetMap(out var map) || SceneData.instance == null)
			{
				GUI.EndScrollView();
				return;
			}
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.fontSize = 20;
			val.alignment = (TextAnchor)3;
			GameMapScene val3 = default(GameMapScene);
			GameObject val4 = default(GameObject);
			Vector2 val5 = default(Vector2);
			foreach (IMapIcon item in from x in rendered
				orderby x.Hierarchy.CleanScenePath, x.Id, x.Details
				select x)
			{
				if (GUI.Button(new Rect(0f, (float)(num3++ * num), ((Rect)(ref _windowSize)).width - 20f, (float)num), item.Hierarchy.CleanScenePath + " - " + item.Id, val) && MapUtils.TryGetMapCache(item, out var mapCache))
				{
					MapCache val2 = mapCache[0];
					map.GetSceneInfo(val2.sceneName, map.GetMapZoneFromSceneName(val2.sceneName), ref val3, ref val4, ref val5);
					if (scenes.TryGetValue(item.Hierarchy.MapScenePath ?? item.Hierarchy.ActualScenePath, out var value))
					{
						map.GetMapPosition(item.WorldPosition(), val3, val4, val5, value.Size);
						TryTeleportingTo(item);
					}
				}
			}
			GUI.EndScrollView();
		}

		public void TryTeleportingTo(IMapIcon coord)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (TryTeleportingToScene(coord.Hierarchy.CleanScenePath))
			{
				_latestCoord = coord;
				((MonoBehaviour)this).StartCoroutine(SetPositionAfterSceneLoadFinishes(coord.WorldPosition(), coord));
			}
		}

		public static bool TryTeleportingToScene(string scenePath)
		{
			if (!Utils.TryGetMap(out var map))
			{
				return false;
			}
			if (!SceneTeleportMap.GetTeleportMap().TryGetValue(scenePath, out var value))
			{
				Mod.Log.LogWarning((object)("Could not find scene: " + scenePath));
				return false;
			}
			MapTeleportMenu mapTeleportMenu = Object.FindFirstObjectByType<MapTeleportMenu>();
			((MonoBehaviour)mapTeleportMenu).StartCoroutine(mapTeleportMenu.StartRoutine_SwitchMap(scenePath, map, value));
			return true;
		}

		[IteratorStateMachine(typeof(<StartRoutine_SwitchMap>d__9))]
		private IEnumerator StartRoutine_SwitchMap(string scenePath, GameMap map, SceneInfo sceneInfo)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <StartRoutine_SwitchMap>d__9(0)
			{
				<>4__this = this,
				scenePath = scenePath,
				map = map,
				sceneInfo = sceneInfo
			};
		}

		private bool TryGetInScenePosition(Vector3 mapPosition, string scenePath, out Vector2 posInScene)
		{
			//IL_0001: 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_004b: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			posInScene = default(Vector2);
			if (!Utils.TryGetMap(out var map))
			{
				return false;
			}
			string key = "Assets/Scenes/Hornet/" + scenePath + ".unity";
			if (!ModMapData.Scenes.TryGetValue(key, out var value))
			{
				return false;
			}
			if (!SceneTeleportMap.GetTeleportMap().TryGetValue(scenePath, out var value2))
			{
				return false;
			}
			MapZone mapZone = value2.MapZone;
			GameMapScene val = default(GameMapScene);
			GameObject val2 = default(GameObject);
			Vector2 val3 = default(Vector2);
			map.GetSceneInfo(scenePath, mapZone, ref val, ref val2, ref val3);
			if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)val.BoundsSprite))
			{
				return false;
			}
			Vector3 val4 = ((Component)val).transform.InverseTransformPoint(mapPosition);
			Bounds bounds = val.BoundsSprite.bounds;
			Vector3 min = ((Bounds)(ref bounds)).min;
			Vector3 val5 = val4 - min;
			Vector2 val6 = default(Vector2);
			((Vector2)(ref val6))..ctor(val5.x / ((Bounds)(ref bounds)).size.x, val5.y / ((Bounds)(ref bounds)).size.y);
			posInScene = Extensions.MultiplyElements(val6, value.Size);
			return true;
		}

		public void TryTeleportingTo(Transform mapPin)
		{
			//IL_003c: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			if (!Utils.TryGetMap(out var _))
			{
				return;
			}
			if (((Object)mapPin).name.StartsWith("SavedFlea_"))
			{
				string scenePath = ((Object)mapPin).name.Substring("SavedFlea_".Length);
				if (TryTeleportingToScene(scenePath) && TryGetInScenePosition(mapPin.position, scenePath, out var posInScene))
				{
					((MonoBehaviour)this).StartCoroutine(SetPositionAfterSceneLoadFinishes(posInScene));
				}
				return;
			}
			GameMapScene val = null;
			Transform val2 = mapPin;
			while (Object.op_Implicit((Object)(object)val2) && !((Component)val2).TryGetComponent<GameMapScene>(ref val))
			{
				val2 = val2.parent;
			}
			if (Object.op_Implicit((Object)(object)val))
			{
				TryTeleportingTo(val, mapPin.position);
			}
		}

		public void TryTeleportingTo(GameMapScene mapScene, Vector3 mapPosition, bool withPreciseTeleport = true, object sourceObject = null)
		{
			//IL_0011: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			if (TryTeleportingToScene(mapScene.Name))
			{
				if (withPreciseTeleport && TryGetInScenePosition(mapPosition, mapScene.Name, out var posInScene))
				{
					((MonoBehaviour)this).StartCoroutine(SetPositionAfterSceneLoadFinishes(posInScene, sourceObject));
				}
				return;
			}
			string name = mapScene.Name;
			int num = name.LastIndexOf("_", StringComparison.InvariantCultureIgnoreCase);
			if (num == -1)
			{
				return;
			}
			name = name.Substring(0, num);
			if (TryTeleportingToScene(name))
			{
				if (withPreciseTeleport && TryGetInScenePosition(mapPosition, name, out var posInScene2))
				{
					((MonoBehaviour)this).StartCoroutine(SetPositionAfterSceneLoadFinishes(posInScene2, sourceObject));
				}
				return;
			}
			num = name.LastIndexOf("_", StringComparison.InvariantCultureIgnoreCase);
			if (num != -1)
			{
				name = name.Substring(0, num);
				if (TryTeleportingToScene(name) && withPreciseTeleport && TryGetInScenePosition(mapPosition, name, out var posInScene3))
				{
					((MonoBehaviour)this).StartCoroutine(SetPositionAfterSceneLoadFinishes(posInScene3, sourceObject));
				}
			}
		}

		[IteratorStateMachine(typeof(<SetPositionAfterSceneLoadFinishes>d__13))]
		private IEnumerator SetPositionAfterSceneLoadFinishes(Vector2 positionInScene, object sourceObject = null)
		{
			//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)
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <SetPositionAfterSceneLoadFinishes>d__13(0)
			{
				<>4__this = this,
				positionInScene = positionInScene,
				sourceObject = sourceObject
			};
		}

		private static bool TryGetClosestRespawnPoint(Vector2 positionInScene, out HazardRespawnMarker respawnPoint)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			respawnPoint = null;
			HazardRespawnMarker[] array = Object.FindObjectsByType<HazardRespawnMarker>((FindObjectsInactive)0, (FindObjectsSortMode)0);
			if (array.Length != 0)
			{
				respawnPoint = array.OrderBy((HazardRespawnMarker x) => Vector2.Distance(Vector2.op_Implicit(((Component)x).transform.position), positionInScene)).First();
				return true;
			}
			return false;
		}
	}
	public static class Teleport2D
	{
		private static readonly Collider2D[] _overlapBuffer = (Collider2D[])(object)new Collider2D[64];

		public static void TeleportToNearestClearSpot(GameObject myCharacter, Vector2 targetPosition)
		{
			//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_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_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: 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_0100: 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_010f: Unknown result type (might be due to invalid IL or missing references)
			Rigidbody2D rb2d = HeroController.instance.rb2d;
			Bounds bounds = HeroController.instance.Bounds;
			Vector3 val = default(Vector3);
			((Vector3)(ref val))..ctor(0.02f, 0.02f, 0f);
			Vector2 size = Vector2.op_Implicit(((Bounds)(ref bounds)).size + val);
			float z = myCharacter.transform.eulerAngles.z;
			Collider2D[] selfColliders = (Collider2D[])(object)new Collider2D[1] { HeroController.instance.col2d };
			if (IsClear(targetPosition, size, z, selfColliders))
			{
				ApplyTeleport(rb2d, targetPosition);
				return;
			}
			float num = Mathf.Max(new float[1] { 0.2f });
			int num2 = 50;
			int num3 = 0;
			for (int i = 1; i <= num2; i++)
			{
				float num4 = (float)i * num;
				int num5 = Mathf.Max(12, Mathf.CeilToInt(MathF.PI * 2f * num4 / num));
				float num6 = MathF.PI * 2f / (float)num5;
				for (int j = 0; j < num5; j++)
				{
					float num7 = num6 * (float)j;
					Vector2 val2 = targetPosition + new Vector2(Mathf.Cos(num7), Mathf.Sin(num7)) * num4;
					num3++;
					if (IsClear(val2, size, z, selfColliders))
					{
						ApplyTeleport(rb2d, val2);
						return;
					}
				}
			}
			static void ApplyTeleport(Rigidbody2D rigidbody, Vector2 target)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				Extensions.SetPosition2D(((Component)rigidbody).transform, target);
			}
		}

		private static bool IsClear(Vector2 position, Vector2 size, float angleZ, Collider2D[] selfColliders)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			int num = Physics2D.OverlapBoxNonAlloc(position, size, angleZ, _overlapBuffer);
			if (num == 0)
			{
				return true;
			}
			for (int i = 0; i < num; i++)
			{
				Collider2D val = _overlapBuffer[i];
				if ((Object)(object)val == (Object)null || val.isTrigger)
				{
					continue;
				}
				bool flag = false;
				foreach (Collider2D val2 in selfColliders)
				{
					if ((Object)(object)val == (Object)(object)val2)
					{
						flag = true;
						break;
					}
					Rigidbody2D attachedRigidbody = val.attachedRigidbody;
					Rigidbody2D attachedRigidbody2 = val2.attachedRigidbody;
					if ((Object)(object)attachedRigidbody != (Object)null && (Object)(object)attachedRigidbody2 != (Object)null && (Object)(object)attachedRigidbody == (Object)(object)attachedRigidbody2)
					{
						flag = true;
						break;
					}
					if (((Component)val).transform.IsChildOf(((Component)val2).transform) || ((Component)val2).transform.IsChildOf(((Component)val).transform))
					{
						flag = true;
						break;
					}
				}
				if (!flag)
				{
					return false;
				}
			}
			return true;
		}
	}
	public class MarkerAnimation : MonoBehaviour
	{
		[CompilerGenerated]
		private sealed class <DoAnimation>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public MarkerAnimation <>4__this;

			private float <duration1>5__2;

			private float <duration2>5__3;

			private float <time>5__4;

			private float <bigScale>5__5;

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

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

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

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

			private bool MoveNext()
			{
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
				//IL_011f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0154: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Unknown result type (might be due to invalid IL or missing references)
				int num = <>1__state;
				MarkerAnimation markerAnimation = <>4__this;
				switch (num)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<duration1>5__2 = 0.7f;
					<duration2>5__3 = 0.7f;
					<time>5__4 = 0f;
					<bigScale>5__5 = 10f;
					goto IL_00bb;
				case 1:
					<>1__state = -1;
					goto IL_00bb;
				case 2:
					{
						<>1__state = -1;
						break;
					}
					IL_00bb:
					if (<time>5__4 < <duration1>5__2)
					{
						<time>5__4 += Time.unscaledDeltaTime;
						float t = <time>5__4 / <duration1>5__2;
						((Component)markerAnimation).transform.localScale = Vector3.one * Mathf.Lerp(markerAnimation.GetDesiredScale(), <bigScale>5__5, markerAnimation.PunchyFallEase(t));
						<>2__current = null;
						<>1__state = 1;
						return true;
					}
					<time>5__4 = 0f;
					break;
				}
				if (<time>5__4 < <duration2>5__3)
				{
					<time>5__4 += Time.unscaledDeltaTime;
					float t2 = <time>5__4 / <duration2>5__3;
					((Component)markerAnimation).transform.localScale = Vector3.one * Mathf.Lerp(markerAnimation.GetDesiredScale(), <bigScale>5__5, 1f - markerAnimation.PunchyFallEase(t2));
					<>2__current = null;
					<>1__state = 2;
					return true;
				}
				((Component)markerAnimation).transform.localScale = Vector3.one * markerAnimation.GetDesiredScale();
				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 Coroutine _activeAnimation;

		public bool IsHUDPin;

		private void OnEnable()
		{
			_activeAnimation = ((MonoBehaviour)this).StartCoroutine(DoAnimation());
		}

		private void OnDisable()
		{
			if (_activeAnimation != null)
			{
				((MonoBehaviour)this).StopCoroutine(_activeAnimation);
			}
		}

		public void DoAnimationRoutine()
		{
			if (_activeAnimation != null)
			{
				((MonoBehaviour)this).StopCoroutine(_activeAnimation);
			}
			_activeAnimation = ((MonoBehaviour)this).StartCoroutine(DoAnimation());
		}

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

		private float PunchyFallEase(float t)
		{
			t = Mathf.Clamp01(t);
			return 1f - Mathf.Pow(1f - t, 5f);
		}

		public void ClearAnimation()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			if (_activeAnimation != null)
			{
				((MonoBehaviour)this).StopCoroutine(_activeAnimation);
			}
			((Component)this).transform.localScale = Vector3.one * GetDesiredScale();
		}

		private float GetDesiredScale()
		{
			if (IsHUDPin)
			{
				return 1f;
			}
			return ModOptions.SizeForMapPins.Value;
		}
	}
	public class SceneMapMarker : MonoBehaviour
	{
		public Vector3 InSceneMarkerPosition;

		public float RemainingTime;

		public static GameObject Create(IMapIcon icon, GameObject template)
		{
			//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_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_006f: Unknown result type (might be due to invalid IL or missing references)
			GameObject obj = Object.Instantiate<GameObject>(template, Vector3.zero, Quaternion.identity);
			((Object)obj).name = "Scene Map Marker Arrow";
			obj.SetActive(true);
			SpriteRenderer componentInChildren = obj.GetComponentInChildren<SpriteRenderer>();
			((Component)componentInChildren).gameObject.layer = 0;
			icon.Stylize(((Component)componentInChildren).gameObject, componentInChildren);
			Transform transform = ((Component)componentInChildren).transform;
			transform.localScale *= 2f;
			SceneMapMarker sceneMapMarker = obj.AddComponent<SceneMapMarker>();
			sceneMapMarker.InSceneMarkerPosition = Vector2.op_Implicit(icon.WorldPosition());
			sceneMapMarker.RemainingTime = ModOptions.TimeForSceneMapMarkers.Value;
			MarkerAnimation markerAnimation = default(MarkerAnimation);
			if (obj.TryGetComponent<MarkerAnimation>(ref markerAnimation))
			{
				markerAnimation.IsHUDPin = true;
				markerAnimation.ClearAnimation();
			}
			return obj;
		}

		private void LateUpdate()
		{
			//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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)HeroController.UnsafeInstance))
			{
				return;
			}
			Vector3 position = HeroController.UnsafeInstance.transform.position;
			Vector3 val = position;
			val.z = InSceneMarkerPosition.z;
			float num = 2f;
			float num2 = 1.5f;
			float num3 = num + num2;
			float num4 = num + num2 * Mathf.Sin(Time.unscaledTime * 2f * MathF.PI);
			ConfigEntry<bool> sceneMapMarkersAnimate = ModOptions.SceneMapMarkersAnimate;
			if (sceneMapMarkersAnimate == null || !sceneMapMarkersAnimate.Value)
			{
				num4 = num;
			}
			float num5 = Vector3.Distance(InSceneMarkerPosition, position);
			float num6 = Mathf.InverseLerp(num3 * 3f, num3, num5);
			num4 = Mathf.Lerp(num4, num3, num6);
			Vector3 position2 = Vector3.MoveTowards(position, InSceneMarkerPosition, num4);
			position2.z = position.z;
			((Component)this).transform.position = position2;
			if (RemainingTime > 0f && !Utils.IsMapOpen())
			{
				RemainingTime -= Time.deltaTime;
				float num7 = RemainingTime / 2f;
				float num8 = Mathf.InverseLerp(0f, 0.3f, num7);
				((Component)this).transform.localScale = Vector3.one * num8;
				if (RemainingTime <= 0f)
				{
					Object.Destroy((Object)(object)((Component)this).gameObject);
				}
			}
		}
	}
	public class MapFilters
	{
		public static IMapFilter Geo = new SimpleMapFilter("Geo")
		{
			DisplayNameSingle = "Rosaries",
			DisplayNameCategory = "Rosaries",
			Style = MapStyles.Geo
		};

		public static IMapFilter MossBerry = new SimpleMapFilter("MossBerry")
		{
			DisplayNameSingle = "Moss berry",
			DisplayNameCategory = "Moss berries",
			Style = MapStyles.MossBerry,
			OverridesTexture = true
		};

		public static IMapFilter PickupItem = new SimpleMapFilter("PickupItem")
		{
			DisplayNameSingle = "Item",
			DisplayNameCategory = "Items",
			Style = MapStyles.Keys
		};

		public static IMapFilter PickupItem_ToolMetal = new SimpleMapFilter("PickupItemToolMetal")
		{
			DisplayNameSingle = "Craft metal",
			DisplayNameCategory = "Craft metal",
			Style = MapStyles.CraftMetal
		};

		public static IMapFilter PickupItem_Relic = new SimpleMapFilter("PickupItemRelic")
		{
			DisplayNameSingle = "Relic",
			DisplayNameCategory = "Relics",
			Style = MapStyles.Relic
		};

		public static IMapFilter PickupItem_Collectable = new SimpleMapFilter("PickupItemCollectable")
		{
			DisplayNameSingle = "Collectable",
			DisplayNameCategory = "Collectables",
			Style = MapStyles.Secret
		};

		public static IMapFilter PickupItem_Lockets = new SimpleMapFilter("PickupItemLockets")
		{
			DisplayNameSingle = "Memory locket",
			DisplayNameCategory = "Memory lockets",
			Style = MapStyles.Locket
		};

		public static IMapFilter PickupItem_ToolPouchUpgrades = new SimpleMapFilter("PickupItemToolkitUpgrades")
		{
			DisplayNameSingle = "Toolkit upgrade",
			DisplayNameCategory = "Toolkit upgrades",
			Style = MapStyles.Toolkit
		};

		public static IMapFilter PickupItem_Tool = new SimpleMapFilter("PickupItemTool")
		{
			DisplayNameSingle = "Tool",
			DisplayNameCategory = "Tools",
			Style = MapStyles.Tools
		};

		public static IMapFilter PickupItem_Memento = new SimpleMapFilter("PickupItemMemento")
		{
			DisplayNameSingle = "Memento",
			DisplayNameCategory = "Mementos",
			Style = MapStyles.Memento
		};

		public static IMapFilter PickupItem_Materium = new SimpleMapFilter("PickupItemMaterium")
		{
			DisplayNameSingle = "Materium",
			DisplayNameCategory = "Materium",
			Style = MapStyles.Secret
		};

		public static IMapFilter Secret = new SimpleMapFilter("Secret")
		{
			DisplayNameSingle = "Secret",
			DisplayNameCategory = "Secrets",
			Style = new EmbeddedResourceBasedIconStyle("Resources/Secret.png", 0.5f).Show
		};

		public static IMapFilter HeartPiece = new SimpleMapFilter("HeartPiece")
		{
			DisplayNameSingle = "Mask piece",
			DisplayNameCategory = "Mask pieces",
			Style = MapStyles.HeartPiece,
			OverridesTexture = true
		};

		public static IMapFilter BreakableWall = new SimpleMapFilter("BreakableWall")
		{
			DisplayNameSingle = "Breakable Wall",
			DisplayNameCategory = "Breakable wall",
			Style = new EmbeddedResourceBasedIconStyle("Resources/BreakableWall.png", 0.5f).Show
		};

		public static IMapFilter Lock = new SimpleMapFilter("Lock")
		{
			DisplayNameSingle = "Lock",
			DisplayNameCategory = "Locks",
			Style = new EmbeddedResourceBasedIconStyle("Resources/Lock.png", 0.5f).Show
		};

		public static IMapFilter Battle = new SimpleMapFilter("Battle")
		{
			DisplayNameSingle = "Battle",
			DisplayNameCategory = "Battles",
			Style = new EmbeddedResourceBasedIconStyle("Resources/Battle.png", 0.75f).Show
		};

		public static IMapFilter ExplodeWall = new SimpleMapFilter("ExplodeWall")
		{
			DisplayNameSingle = "Explodable Wall",
			DisplayNameCategory = "Explodable walls",
			Style = new EmbeddedResourceBasedIconStyle("Resources/ExplodeWall.png", 0.5f).Show
		};

		public static IMapFilter Collapser = new SimpleMapFilter("Collapser")
		{
			DisplayNameSingle = "Collapser",
			DisplayNameCategory = "Collapsers",
			Style = new EmbeddedResourceBasedIconStyle("Resources/Collapser.png", 0.5f).Show
		};

		public static IMapFilter Misc = new SimpleMapFilter("Misc")
		{
			DisplayNameSingle = "Misc",
			DisplayNameCategory = "Misc",
			Style = new EmbeddedResourceBasedIconStyle("Resources/Misc.png", 0.75f).Show
		};

		public static IMapFilter SpoolPiece = new SimpleMapFilter("SpoolPiece")
		{
			DisplayNameSingle = "Spool fragment",
			DisplayNameCategory = "Spool fragments",
			Style = MapStyles.SpoolPiece,
			OverridesTexture = true
		};

		public static IMapFilter Lever = new SimpleMapFilter("Lever")
		{
			DisplayNameSingle = "Lever",
			DisplayNameCategory = "levers",
			Style = new EmbeddedResourceBasedIconStyle("Resources/Lever.png", 0.5f).Show
		};

		public static IMapFilter PollipHeart = new SimpleMapFilter("PollipHeart")
		{
			DisplayNameSingle = "Pollip heart",
			DisplayNameCategory = "Pollip hearts",
			Style = new EmbeddedResourceBasedIconStyle("Resources/PollipHeart.png", 0.65f).Show
		};

		public static IMapFilter ShellShard = new SimpleMapFilter("ShellShard")
		{
			DisplayNameSingle = "Shell shards",
			DisplayNameCategory = "Shell shards",
			Style = new AssetBundleBasedIconStyle("Shell_shard_icon", 1.5f).Show
		};

		public static IMapFilter RingLineSwitch = new SimpleMapFilter("RingLineSwitch")
		{
			DisplayNameSingle = "Ring lever",
			DisplayNameCategory = "Ring