Decompiled source of SilksongMinimapWithCocoonCompass v0.8.0

SkongMinimap.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GlobalEnums;
using HarmonyLib;
using SkongMinimap.MonoBehaviours;
using SkongMinimap.Properties;
using SkongMinimap.Utils;
using TeamCherry.Localization;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a4c3d649-767e-4f96-a728-b07682e6c00f")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace SkongMinimap
{
	[BepInPlugin("com.Wagyu.SkongMinimap", "SkongMinimap", "0.8.0")]
	public class SkongMinimapPlugin : BaseUnityPlugin
	{
		public static bool IsInCutscene = false;

		public static bool IsInConversation = false;

		public static NPCControlBase CurrentConversingNPC;

		private const string MyGUID = "com.Wagyu.SkongMinimap";

		private const string PluginName = "SkongMinimap";

		private const string VersionString = "0.8.0";

		public static string ActiveKey = "Is Minimap Active";

		public static string ToggleMinimapButtonKey = "Toggle Minimap Button";

		public static string ReloadConfigButtonKey = "Reload Config Button";

		public static string AreaNameFontSizeKey = "Minimap Font Size";

		public static string MinimapPositionXKey = "Minimap X Position";

		public static string MinimapPositionYKey = "Minimap Y Position";

		public static string MinimapOffsetXKey = "Area Name X Offset";

		public static string MinimapOffsetYKey = "Area Name Y Offset";

		public static string AreaNameDefaultColorKey = "Area Name Default Color";

		public static string MinimapOutlineColorKey = "Minimap Outline Color";

		public static string MinimapBackgroundColorKey = "Minimap Background Color";

		public static string UseFallbackFontKey = "Use Fallback Font";

		public static string AlwaysVisibleKey = "Always Visible";

		public static string MinimapFormatKey = "Minimap Format";

		public static string MinimapZoomKey = "Minimap Zoom";

		public static string MinimapOpacityKey = "Minimap Opacity";

		public static string MinimapShowBGKey = "Minimap Show Background";

		public static string MinimapUseOutlineKey = "Minimap Use Outline";

		public static string MinimapOutlineTypeKey = "Minimap Outline Type";

		public static string MinimapFillShapeKey = "Minimap Shape";

		public static string DebugShowPosKey = "Debug Show Pos";

		public static string MinimapFrameTypeKey = "Minimap Frame Type";

		public static string MinimapScaleKey = "Minimap Scale";

		public static string CocoonCompassOffsetXKey = "Cocoon Compass X Offset";

		public static string CocoonCompassOffsetYKey = "Cocoon Compass Y Offset";

		public static string CocoonCompassScaleKey = "Cocoon Compass Scale";

		public static string CocoonCompassOpacityKey = "Cocoon Compass Opacity";

		public static string ZoomInButtonKey = "Zoom In Button";

		public static string ZoomOutButtonKey = "Zoom Out Button";

		public static string ZoomSpeedKey = "Zoom Speed";

		public static string IsCustomMarkersEnabledKey = "Enable Custom Markers";

		public static string IsCocoonCompassEnabledKey = "Enable Cocoon Compass";

		public static ConfigEntry<bool> Active;

		public static ConfigEntry<KeyCode> ToggleMinimapButton;

		public static ConfigEntry<KeyCode> ReloadConfigButton;

		public static ConfigEntry<int> AreaNameFontSize;

		public static ConfigEntry<float> MinimapPositionX;

		public static ConfigEntry<float> MinimapPositionY;

		public static ConfigEntry<float> AreaNameOffsetX;

		public static ConfigEntry<float> AreaNameOffsetY;

		public static ConfigEntry<Color> AreaNameDefaultColor;

		public static ConfigEntry<Color> MinimapOutlineColor;

		public static ConfigEntry<Color> MinimapBackgroundColor;

		public static ConfigEntry<bool> UseFallbackFont;

		public static ConfigEntry<bool> AlwaysVisible;

		public static ConfigEntry<float> MinimapZoom;

		public static ConfigEntry<float> MinimapOpacity;

		public static ConfigEntry<bool> MinimapShowBG;

		public static ConfigEntry<bool> MinimapUseOutline;

		public static ConfigEntry<MinimapShape> MinimapFillShape;

		public static ConfigEntry<MinimapOutline> MinimapOutlineType;

		public static ConfigEntry<bool> DebugShowPos;

		public static ConfigEntry<MinimapFrame> MinimapFrameType;

		public static ConfigEntry<float> MinimapScale;

		public static ConfigEntry<float> CocoonCompassOffsetX;

		public static ConfigEntry<float> CocoonCompassOffsetY;

		public static ConfigEntry<float> CocoonCompassScale;

		public static ConfigEntry<float> CocoonCompassOpacity;

		public static ConfigEntry<KeyCode> ZoomInButton;

		public static ConfigEntry<KeyCode> ZoomOutButton;

		public static ConfigEntry<float> ZoomSpeed;

		public static ConfigEntry<bool> IsCustomMarkersEnabled;

		public static ConfigEntry<bool> IsCocoonCompassEnabled;

		private static readonly Harmony Harmony = new Harmony("com.Wagyu.SkongMinimap");

		public static ManualLogSource Log = new ManualLogSource("SkongMinimap");

		private static Text areaNameDisplay;

		private static bool isPaused = false;

		public static Font silksongFont;

		public static Font fallbackFont;

		public static MapTextureBank textureBank;

		public static string location;

		public static string directoryName;

		private static Canvas canvas;

		private static RectTransform backgroundRect;

		private static Image backgroundImage;

		public static RectTransform areaNameRect;

		public static MinimapViewportComponent minimapViewport;

		private static RadarManagerComponent radar;

		private static CanvasGroup compassCG;

		private static RectTransform compassRotatorRect;

		public static GameObject compassScalerObject;

		public static RectTransform compassScalerRect;

		private static Image compassImage;

		private static RectTransform compassRect;

		private static RectTransform cocoonRect;

		private static Sprite compassBGSprite;

		private static Sprite compassCocoonSprite;

		private const float COMPASS_Y_OFFSET = 13f;

		public static bool isTrackingCocoon = false;

		private static CocoonCompassComponent compassComponent;

		public static bool IsInGame = false;

		public static void UpdateCustomMarkers()
		{
			if ((Object)(object)minimapViewport != (Object)null)
			{
				minimapViewport.UpdateMarkers();
			}
		}

		private void Awake()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Expected O, but got Unknown
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Expected O, but got Unknown
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Expected O, but got Unknown
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Expected O, but got Unknown
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Expected O, but got Unknown
			//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Expected O, but got Unknown
			//IL_0230: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0246: Expected O, but got Unknown
			//IL_0268: 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_027e: Expected O, but got Unknown
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Expected O, but got Unknown
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Expected O, but got Unknown
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Expected O, but got Unknown
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Expected O, but got Unknown
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Expected O, but got Unknown
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Expected O, but got Unknown
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fa: Expected O, but got Unknown
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0425: Expected O, but got Unknown
			//IL_0446: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Expected O, but got Unknown
			//IL_0483: Unknown result type (might be due to invalid IL or missing references)
			//IL_048d: Expected O, but got Unknown
			//IL_04c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ca: Expected O, but got Unknown
			//IL_04fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0507: Expected O, but got Unknown
			//IL_053a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0544: Expected O, but got Unknown
			//IL_0577: Unknown result type (might be due to invalid IL or missing references)
			//IL_0581: Expected O, but got Unknown
			//IL_05b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05be: Expected O, but got Unknown
			//IL_05e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ea: Expected O, but got Unknown
			//IL_060c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0616: Expected O, but got Unknown
			//IL_0637: Unknown result type (might be due to invalid IL or missing references)
			//IL_0641: Expected O, but got Unknown
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_066c: Expected O, but got Unknown
			location = Assembly.GetExecutingAssembly().Location;
			directoryName = Path.GetDirectoryName(location);
			Log = ((BaseUnityPlugin)this).Logger;
			textureBank = new MapTextureBank();
			Active = ((BaseUnityPlugin)this).Config.Bind<bool>("1.Core", ActiveKey, true, new ConfigDescription("Minimap UI active state", (AcceptableValueBase)null, Array.Empty<object>()));
			ReloadConfigButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Key Bindings", ReloadConfigButtonKey, (KeyCode)286, new ConfigDescription("Button to reload config file from disk", (AcceptableValueBase)null, Array.Empty<object>()));
			ToggleMinimapButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Key Bindings", ToggleMinimapButtonKey, (KeyCode)98, new ConfigDescription("Button to toggle the Minimap UI visibility", (AcceptableValueBase)null, Array.Empty<object>()));
			AreaNameFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Area Name Font", AreaNameFontSizeKey, 22, new ConfigDescription("Area Name Font Size", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 128), Array.Empty<object>()));
			MinimapPositionX = ((BaseUnityPlugin)this).Config.Bind<float>("Minimap Position", MinimapPositionXKey, 0.82f, new ConfigDescription("Minimap X Position", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			MinimapPositionY = ((BaseUnityPlugin)this).Config.Bind<float>("Minimap Position", MinimapPositionYKey, 0.7f, new ConfigDescription("Minimap Y Position", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			AreaNameOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Area Name Offset", MinimapOffsetXKey, 0f, new ConfigDescription("Area Name X Offset", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-300f, 300f), Array.Empty<object>()));
			AreaNameOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Area Name Offset", MinimapOffsetYKey, -155f, new ConfigDescription("Area Name Y Offset", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-300f, 300f), Array.Empty<object>()));
			AreaNameDefaultColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Area Name Color", AreaNameDefaultColorKey, Color.white, new ConfigDescription("Area Name Default Color", (AcceptableValueBase)null, Array.Empty<object>()));
			Color val = default(Color);
			ColorUtility.TryParseHtmlString("#FFFFFFFF", ref val);
			MinimapOutlineColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Minimap Color", MinimapOutlineColorKey, val, new ConfigDescription("Minimap Outline Color", (AcceptableValueBase)null, Array.Empty<object>()));
			Color val2 = default(Color);
			ColorUtility.TryParseHtmlString("#00000040", ref val2);
			MinimapBackgroundColor = ((BaseUnityPlugin)this).Config.Bind<Color>("Minimap Color", MinimapBackgroundColorKey, val2, new ConfigDescription("Minimap Background Color", (AcceptableValueBase)null, Array.Empty<object>()));
			UseFallbackFont = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap Font", UseFallbackFontKey, false, new ConfigDescription("Use fallback font (Arial)", (AcceptableValueBase)null, Array.Empty<object>()));
			AlwaysVisible = ((BaseUnityPlugin)this).Config.Bind<bool>("1.Core", AlwaysVisibleKey, false, new ConfigDescription("Always show timer even on the Main Menu", (AcceptableValueBase)null, Array.Empty<object>()));
			MinimapZoom = ((BaseUnityPlugin)this).Config.Bind<float>("Zooming", MinimapZoomKey, 1f, new ConfigDescription("Minimap Zoom", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), Array.Empty<object>()));
			MinimapOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Minimap Opacity", MinimapOpacityKey, 0.95f, new ConfigDescription("Minimap Opacity", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			MinimapShowBG = ((BaseUnityPlugin)this).Config.Bind<bool>("Minimap", MinimapShowBGKey, true, new ConfigDescription("Show Minimap Background", (AcceptableValueBase)null, Array.Empty<object>()));
			MinimapUseOutline = ((BaseUnityPlugin)this).Config.Bind<bool>("Style", MinimapUseOutlineKey, false, new ConfigDescription("Show minimap outline", (AcceptableValueBase)null, Array.Empty<object>()));
			MinimapFillShape = ((BaseUnityPlugin)this).Config.Bind<MinimapShape>("Style", MinimapFillShapeKey, MinimapShape.Square, new ConfigDescription("Choose minimap shape", (AcceptableValueBase)null, Array.Empty<object>()));
			DebugShowPos = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", DebugShowPosKey, false, new ConfigDescription("Show player position coords (Square map only)", (AcceptableValueBase)null, Array.Empty<object>()));
			MinimapOutlineType = ((BaseUnityPlugin)this).Config.Bind<MinimapOutline>("Style", MinimapOutlineTypeKey, MinimapOutline.Line, new ConfigDescription("Choose minimap outline type", (AcceptableValueBase)null, Array.Empty<object>()));
			MinimapFrameType = ((BaseUnityPlugin)this).Config.Bind<MinimapFrame>("Style", MinimapFrameTypeKey, MinimapFrame.Default, new ConfigDescription("Choose minimap frame type (Square map only)", (AcceptableValueBase)null, Array.Empty<object>()));
			MinimapScale = ((BaseUnityPlugin)this).Config.Bind<float>("Minimap Scale", MinimapScaleKey, 1f, new ConfigDescription("Minimap Scale", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 2f), Array.Empty<object>()));
			CocoonCompassOffsetX = ((BaseUnityPlugin)this).Config.Bind<float>("Cocoon Compass", CocoonCompassOffsetXKey, 150f, new ConfigDescription("Cocoon Compass X", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-300f, 300f), Array.Empty<object>()));
			CocoonCompassOffsetY = ((BaseUnityPlugin)this).Config.Bind<float>("Cocoon Compass", CocoonCompassOffsetYKey, -32f, new ConfigDescription("Cocoon Compass Y Offset", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-300f, 300f), Array.Empty<object>()));
			CocoonCompassScale = ((BaseUnityPlugin)this).Config.Bind<float>("Cocoon Compass", CocoonCompassScaleKey, 1f, new ConfigDescription("Cocoon Compass Scale", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>()));
			CocoonCompassOpacity = ((BaseUnityPlugin)this).Config.Bind<float>("Cocoon Compass", CocoonCompassOpacityKey, 0.8f, new ConfigDescription("Cocoon Compass Opacity", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
			ZoomSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Zooming", ZoomSpeedKey, 1f, new ConfigDescription("Minimap Zoom Speed", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>()));
			ZoomInButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Key Bindings", ZoomInButtonKey, (KeyCode)99, new ConfigDescription("Minimap zoom in button", (AcceptableValueBase)null, Array.Empty<object>()));
			ZoomOutButton = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Key Bindings", ZoomOutButtonKey, (KeyCode)120, new ConfigDescription("Minimap zoom out button", (AcceptableValueBase)null, Array.Empty<object>()));
			IsCustomMarkersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1.Core", IsCustomMarkersEnabledKey, true, new ConfigDescription("Enable Custom Markers (Map Pins placed by the player)", (AcceptableValueBase)null, Array.Empty<object>()));
			IsCocoonCompassEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("1.Core", IsCocoonCompassEnabledKey, true, new ConfigDescription("Enable Cocoon Compass (Points to the player's last death position)", (AcceptableValueBase)null, Array.Empty<object>()));
			Active.SettingChanged += ConfigSettingChanged;
			((BaseUnityPlugin)this).Config.ConfigReloaded += Config_ConfigReloaded;
			AreaNameFontSize.SettingChanged += ConfigSettingChanged;
			MinimapPositionX.SettingChanged += ConfigSettingChanged;
			MinimapPositionY.SettingChanged += ConfigSettingChanged;
			AreaNameOffsetX.SettingChanged += ConfigSettingChanged;
			AreaNameOffsetY.SettingChanged += ConfigSettingChanged;
			AreaNameDefaultColor.SettingChanged += ConfigSettingChanged;
			MinimapOutlineColor.SettingChanged += ConfigSettingChanged;
			MinimapBackgroundColor.SettingChanged += ConfigSettingChanged;
			UseFallbackFont.SettingChanged += ConfigSettingChanged;
			AlwaysVisible.SettingChanged += ConfigSettingChanged;
			MinimapOutlineColor.SettingChanged += ConfigSettingChanged;
			MinimapZoom.SettingChanged += ConfigSettingChanged;
			MinimapOpacity.SettingChanged += ConfigSettingChanged;
			MinimapShowBG.SettingChanged += ConfigSettingChanged;
			MinimapUseOutline.SettingChanged += ConfigSettingChanged;
			MinimapFillShape.SettingChanged += ConfigSettingChanged;
			MinimapOutlineType.SettingChanged += ConfigSettingChanged;
			DebugShowPos.SettingChanged += ConfigSettingChanged;
			MinimapFrameType.SettingChanged += ConfigSettingChanged;
			MinimapScale.SettingChanged += ConfigSettingChanged;
			CocoonCompassOffsetX.SettingChanged += ConfigSettingChanged;
			CocoonCompassOffsetY.SettingChanged += ConfigSettingChanged;
			CocoonCompassScale.SettingChanged += ConfigSettingChanged;
			CocoonCompassOpacity.SettingChanged += ConfigSettingChanged;
			IsCustomMarkersEnabled.SettingChanged += ConfigSettingChanged;
			IsCocoonCompassEnabled.SettingChanged += ConfigSettingChanged;
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SkongMinimap 0.8.0 is loading...");
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"SkongMinimap 0.8.0 is loaded.");
			InitCanvas();
		}

		private void InitCanvas()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Skong Minimap Canvas");
			Object.DontDestroyOnLoad((Object)(object)val);
			canvas = val.AddComponent<Canvas>();
			CanvasScaler val2 = val.AddComponent<CanvasScaler>();
			val2.referenceResolution = new Vector2((float)Screen.width, (float)Screen.height);
			canvas.renderMode = (RenderMode)0;
			val2.uiScaleMode = (ScaleMode)1;
			canvas.sortingOrder = 1000;
		}

		public static void UpdateEnemyList()
		{
			radar.UpdateSceneEnemyList();
		}

		public static void InitMinimap()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: 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_00b0: 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_00f1: Expected O, but got Unknown
			//IL_0143: 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_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Minimap Background");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.transform.SetParent(((Component)canvas).transform);
			backgroundImage = val.AddComponent<Image>();
			backgroundRect = ((Graphic)backgroundImage).rectTransform;
			backgroundRect.anchorMin = new Vector2(0f, 0f);
			backgroundRect.anchorMax = new Vector2(0f, 0f);
			backgroundRect.pivot = new Vector2(0f, 0f);
			backgroundRect.sizeDelta = new Vector2(256f, 256f);
			SetBackgroundColor(MinimapBackgroundColor.Value);
			radar = val.AddComponent<RadarManagerComponent>();
			minimapViewport = val.AddComponent<MinimapViewportComponent>();
			minimapViewport.ChangeZoom(MinimapZoom.Value);
			GameObject val2 = new GameObject("Minimap");
			Object.DontDestroyOnLoad((Object)(object)val2);
			val2.transform.SetParent(((Component)backgroundRect).transform);
			areaNameDisplay = val2.AddComponent<Text>();
			((MaskableGraphic)areaNameDisplay).maskable = false;
			areaNameRect = ((Graphic)areaNameDisplay).rectTransform;
			areaNameRect.anchorMin = new Vector2(0f, 0f);
			areaNameRect.anchorMax = new Vector2(1f, 1f);
			areaNameRect.pivot = new Vector2(0.5f, 0.5f);
			areaNameRect.pivot = new Vector2(0.5f, 0.5f);
			UpdateAreaNameOffset();
			SetAreaNameColor(AreaNameDefaultColor.Value);
			silksongFont = ((IEnumerable<Font>)Resources.FindObjectsOfTypeAll<Font>()).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name == "TrajanPro-Bold"));
			fallbackFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
			UpdateFont();
			areaNameDisplay.fontStyle = (FontStyle)1;
			areaNameDisplay.alignment = (TextAnchor)4;
			areaNameDisplay.horizontalOverflow = (HorizontalWrapMode)1;
			areaNameDisplay.verticalOverflow = (VerticalWrapMode)1;
			Outline val3 = val2.AddComponent<Outline>();
			UpdateMinimapPosition();
			InitCocoonCompass();
			UpdateAreaNameFontSize(updateText: true);
			UpdateModVisible();
			SetMinimapVisible(value: false);
		}

		private static void InitCocoonCompass()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0053: 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_0087: 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)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			//IL_0108: 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_013c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: 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_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Expected O, but got Unknown
			//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: 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_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_023c: 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_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Expected O, but got Unknown
			//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0314: Unknown result type (might be due to invalid IL or missing references)
			//IL_032e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			compassScalerObject = new GameObject("Cocoon Compass Scaler");
			Object.DontDestroyOnLoad((Object)(object)compassScalerObject);
			compassScalerObject.transform.SetParent(((Component)backgroundRect).transform);
			compassScalerRect = compassScalerObject.AddComponent<RectTransform>();
			compassScalerRect.anchorMin = new Vector2(0.5f, 0.5f);
			compassScalerRect.anchorMax = new Vector2(0.5f, 0.5f);
			compassScalerRect.pivot = new Vector2(0.5f, 0.5f);
			compassScalerRect.pivot = new Vector2(0.5f, 0.5f);
			compassScalerRect.sizeDelta = new Vector2(128f, 128f);
			GameObject val = new GameObject("Cocoon Compass Rotator");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.transform.SetParent(compassScalerObject.transform);
			compassRotatorRect = val.AddComponent<RectTransform>();
			compassRotatorRect.anchorMin = new Vector2(0.5f, 0.5f);
			compassRotatorRect.anchorMax = new Vector2(0.5f, 0.5f);
			compassRotatorRect.pivot = new Vector2(0.5f, 0.5f);
			compassRotatorRect.pivot = new Vector2(0.5f, 0.5f);
			compassRotatorRect.sizeDelta = new Vector2(128f, 128f);
			GameObject val2 = new GameObject("Cocoon Compass BG");
			Object.DontDestroyOnLoad((Object)(object)val2);
			val2.transform.SetParent(val.transform);
			compassImage = val2.AddComponent<Image>();
			((MaskableGraphic)compassImage).maskable = false;
			compassRect = ((Graphic)compassImage).rectTransform;
			compassRect.anchorMin = new Vector2(0.5f, 0.5f);
			compassRect.anchorMax = new Vector2(0.5f, 0.5f);
			compassRect.pivot = new Vector2(0.5f, 0.5f);
			compassRect.pivot = new Vector2(0.5f, 0.5f);
			compassRect.sizeDelta = new Vector2(128f, 128f);
			compassRect.anchoredPosition = new Vector2(0f, 13f);
			compassBGSprite = IMG2Sprite.LoadSprite("compass-bg");
			compassImage.sprite = compassBGSprite;
			compassCocoonSprite = IMG2Sprite.LoadSprite("compass-cocoon");
			GameObject val3 = new GameObject("Cocoon Icon");
			Object.DontDestroyOnLoad((Object)(object)val3);
			val3.transform.SetParent(compassScalerObject.transform);
			Image val4 = val3.AddComponent<Image>();
			((MaskableGraphic)val4).maskable = false;
			cocoonRect = ((Graphic)val4).rectTransform;
			cocoonRect.anchorMin = new Vector2(0.5f, 0.5f);
			cocoonRect.anchorMax = new Vector2(0.5f, 0.5f);
			cocoonRect.pivot = new Vector2(0.5f, 0.5f);
			cocoonRect.pivot = new Vector2(0.5f, 0.5f);
			cocoonRect.sizeDelta = new Vector2(128f, 128f);
			((Transform)cocoonRect).position = ((Transform)compassRect).position;
			compassCocoonSprite = IMG2Sprite.LoadSprite("compass-cocoon");
			val4.sprite = compassCocoonSprite;
			UpdateCompassOffset();
			UpdateCompassRotation();
			UpdateCompassScale();
			compassCG = compassScalerObject.AddComponent<CanvasGroup>();
			UpdateCompassOpacity();
			compassComponent = val.AddComponent<CocoonCompassComponent>();
			compassScalerObject.SetActive(false);
		}

		public static void SetMinimapOutlineColor(Color color)
		{
			minimapViewport.UpdateOutlineColor();
		}

		public static void SetMinimapOutlineDistance(Vector2 distance)
		{
		}

		public static void UpdateFont()
		{
			areaNameDisplay.font = (UseFallbackFont.Value ? fallbackFont : silksongFont);
			UpdateAreaNameOffset();
		}

		public static void UpdateMinimapPosition()
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			backgroundRect.anchoredPosition = new Vector2(MinimapPositionX.Value * (float)Screen.width, MinimapPositionY.Value * (float)Screen.height);
		}

		public static void UpdateAreaNameOffset()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: 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)
			areaNameRect.anchoredPosition = Vector2.op_Implicit(Vector3.up * AreaNameOffsetY.Value + Vector3.right * AreaNameOffsetX.Value + Vector3.down * (float)((!UseFallbackFont.Value) ? 3 : 0));
		}

		public static void UpdateCompassOffset()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			compassScalerRect.anchoredPosition = Vector2.op_Implicit(Vector3.up * CocoonCompassOffsetY.Value + Vector3.right * CocoonCompassOffsetX.Value);
		}

		public static void UpdateCompassScale()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			((Transform)compassScalerRect).localScale = Vector3.one * (CocoonCompassScale.Value / 2f);
		}

		public static void UpdateCompassRotation()
		{
		}

		public static void UpdateAreaNameFontSize(bool updateText = false)
		{
			areaNameDisplay.fontSize = AreaNameFontSize.Value;
		}

		private static void ShowAreaName()
		{
			((Behaviour)areaNameDisplay).enabled = true;
		}

		private static void HideAreaName()
		{
			((Behaviour)areaNameDisplay).enabled = false;
		}

		private void Update()
		{
			//IL_000b: 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_0064: 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)
			if (UnityInput.Current.GetKeyDown(ToggleMinimapButton.Value))
			{
				((ConfigEntryBase)Active).SetSerializedValue((!Active.Value).ToString());
			}
			if (IsInGame && Active.Value)
			{
				if (UnityInput.Current.GetKey(ZoomInButton.Value))
				{
					float value = MinimapZoom.Value;
					((ConfigEntryBase)MinimapZoom).SetSerializedValue((value + ZoomSpeed.Value * Time.deltaTime).ToString());
				}
				else if (UnityInput.Current.GetKey(ZoomOutButton.Value))
				{
					float value2 = MinimapZoom.Value;
					((ConfigEntryBase)MinimapZoom).SetSerializedValue((value2 - ZoomSpeed.Value * Time.deltaTime).ToString());
				}
			}
			if (UnityInput.Current.GetKeyDown(ReloadConfigButton.Value))
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Reloading config from disk...");
				((BaseUnityPlugin)this).Config.Reload();
			}
		}

		private void ConfigSettingChanged(object sender, EventArgs e)
		{
			//IL_012b: 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_01e7: Unknown result type (might be due to invalid IL or missing references)
			SettingChangedEventArgs val = (SettingChangedEventArgs)(object)((e is SettingChangedEventArgs) ? e : null);
			if (val != null)
			{
				if (val.ChangedSetting.Definition.Key == ActiveKey)
				{
					UpdateModVisible();
				}
				if (val.ChangedSetting.Definition.Key == AreaNameFontSizeKey)
				{
					UpdateAreaNameFontSize(!IsInGame);
				}
				if (val.ChangedSetting.Definition.Key == MinimapPositionXKey || val.ChangedSetting.Definition.Key == MinimapPositionYKey)
				{
					UpdateMinimapPosition();
				}
				if (val.ChangedSetting.Definition.Key == MinimapOffsetXKey || val.ChangedSetting.Definition.Key == MinimapOffsetYKey)
				{
					UpdateAreaNameOffset();
				}
				if (val.ChangedSetting.Definition.Key == AreaNameDefaultColorKey && !isPaused)
				{
					SetAreaNameColor(AreaNameDefaultColor.Value);
				}
				if (val.ChangedSetting.Definition.Key == MinimapBackgroundColorKey)
				{
					SetBackgroundColor(MinimapBackgroundColor.Value);
				}
				if (val.ChangedSetting.Definition.Key == UseFallbackFontKey)
				{
					UpdateFont();
				}
				if (val.ChangedSetting.Definition.Key == MinimapFormatKey)
				{
					UpdateAreaNameFontSize(!IsInGame);
				}
				if (val.ChangedSetting.Definition.Key == MinimapOutlineColorKey)
				{
					SetMinimapOutlineColor(MinimapOutlineColor.Value);
				}
				if (val.ChangedSetting.Definition.Key == MinimapZoomKey)
				{
					UpdateMinimapZoom();
				}
				if (val.ChangedSetting.Definition.Key == MinimapOpacityKey)
				{
					UpdateMinimapOpacity();
				}
				if (val.ChangedSetting.Definition.Key == MinimapShowBGKey)
				{
					UpdateMinimapShowBG();
				}
				if (val.ChangedSetting.Definition.Key == MinimapUseOutlineKey)
				{
					minimapViewport.ChangeUseOutline(MinimapUseOutline.Value);
					minimapViewport.UpdateUseOutline();
				}
				if (val.ChangedSetting.Definition.Key == MinimapFillShapeKey)
				{
					minimapViewport.ChangeShape(MinimapFillShape.Value);
					minimapViewport.UpdateShape();
					UpdatePosDisplayDebug();
				}
				if (val.ChangedSetting.Definition.Key == DebugShowPosKey)
				{
					UpdatePosDisplayDebug();
					UpdateAreaNameValue();
				}
				if (val.ChangedSetting.Definition.Key == MinimapOutlineTypeKey)
				{
					UpdateMinimapOutlineType();
				}
				if (val.ChangedSetting.Definition.Key == MinimapFrameTypeKey)
				{
					UpdateMinimapFrameType();
				}
				if (val.ChangedSetting.Definition.Key == MinimapScaleKey)
				{
					UpdateMinimapScale();
				}
				if (val.ChangedSetting.Definition.Key == CocoonCompassOffsetXKey || val.ChangedSetting.Definition.Key == CocoonCompassOffsetYKey)
				{
					UpdateCompassOffset();
				}
				if (val.ChangedSetting.Definition.Key == CocoonCompassScaleKey)
				{
					UpdateCompassScale();
				}
				if (val.ChangedSetting.Definition.Key == CocoonCompassOpacityKey)
				{
					UpdateCompassOpacity();
				}
				if (val.ChangedSetting.Definition.Key == IsCocoonCompassEnabledKey)
				{
					SetCocoonCompassActive();
				}
				if (val.ChangedSetting.Definition.Key == IsCustomMarkersEnabledKey)
				{
					SetCustomMarkersActive();
				}
			}
		}

		public static void SetCustomMarkersActive()
		{
			minimapViewport.UpdateMarkersActive();
		}

		public static void SetCocoonCompassActive()
		{
			minimapViewport.UpdateCocoonActive();
		}

		public static void UpdateMinimapScale()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)backgroundRect != (Object)null)
			{
				((Component)backgroundRect).transform.localScale = Vector2.op_Implicit(Vector2.one * MinimapScale.Value);
			}
		}

		public static void UpdateMinimapFrameType()
		{
			if ((Object)(object)minimapViewport != (Object)null)
			{
				minimapViewport.UpdateShape();
			}
		}

		public static void UpdateMinimapOutlineType()
		{
			minimapViewport.ChangeOutlineType(MinimapOutlineType.Value);
			minimapViewport.UpdateOutlineSprite();
		}

		public static void UpdatePosDisplayDebug()
		{
			areaNameDisplay.lineSpacing = (DebugShowPos.Value ? 0.65f : 1f);
			((Behaviour)minimapViewport.posDisplay).enabled = DebugShowPos.Value && MinimapFillShape.Value == MinimapShape.Square;
		}

		private void UpdateMinimapShowBG()
		{
			minimapViewport.ChangeShowBG(MinimapShowBG.Value);
			minimapViewport.UpdateShowBG();
		}

		private void UpdateMinimapOpacity()
		{
			minimapViewport.ChangeOpacity(MinimapOpacity.Value);
			minimapViewport.UpdateOpacity();
		}

		private void UpdateMinimapZoom()
		{
			minimapViewport.ChangeZoom(MinimapZoom.Value);
			minimapViewport.UpdateZoom();
		}

		public static void UpdateModVisible()
		{
			((Component)canvas).gameObject.SetActive(Active.Value);
		}

		public static void SetMinimapVisible(bool value)
		{
			((Component)backgroundRect).gameObject.SetActive(value || AlwaysVisible.Value);
			((Behaviour)areaNameDisplay).enabled = value || AlwaysVisible.Value;
		}

		private void Config_ConfigReloaded(object sender, EventArgs e)
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Config reloaded from disk");
		}

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

		public static void SetAreaNameColor(Color color)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)areaNameDisplay).color = color;
		}

		public static void UpdateAreaNameValue()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			GameMap gameMap = GameManager.instance.gameMap;
			if (Object.op_Implicit((Object)(object)gameMap))
			{
				MapZone currentMapZone = gameMap.GetCurrentMapZone();
				bool flag = gameMap.HasAnyMapForZone(currentMapZone);
				string text = Language.Get(((object)(MapZone)(ref currentMapZone)).ToString(), "Map Zones").Replace("<br>", string.Empty);
				areaNameDisplay.text = (flag ? text : "");
				if (DebugShowPos.Value)
				{
					Text obj = areaNameDisplay;
					obj.text += $"\n <size={areaNameDisplay.fontSize / 2}>{((object)(MapZone)(ref currentMapZone)).ToString()}</size>";
				}
				minimapViewport.ChangeZone(flag, text, GameManager.instance.sceneName, currentMapZone);
			}
		}

		public static void PauseMinimap(float duration)
		{
			if (Object.op_Implicit((Object)(object)minimapViewport))
			{
				minimapViewport.PauseMinimap(duration);
			}
		}

		private static void UpdateCompassOpacity()
		{
			compassCG.alpha = CocoonCompassOpacity.Value;
		}

		public static void ResumeMinimap(float duration, float delay)
		{
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00fd: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)minimapViewport))
			{
				return;
			}
			minimapViewport.ResumeMinimap(duration, delay);
			PlayerData playerData = GameManager.instance.playerData;
			if (playerData.HeroCorpseScene != string.Empty)
			{
				if (!((Component)compassScalerRect).gameObject.activeInHierarchy && playerData.HeroDeathScenePos != Vector2.zero && IsCocoonCompassEnabled.Value)
				{
					ManualLogSource log = Log;
					Vector2 heroDeathScenePos = playerData.HeroDeathScenePos;
					log.LogWarning((object)("FOUND COCOON AT " + ((object)(Vector2)(ref heroDeathScenePos)).ToString()));
					((Component)compassScalerRect).gameObject.SetActive(true);
					isTrackingCocoon = true;
					if ((Object)(object)minimapViewport != (Object)null && (Object)(object)GameManager.instance.gameMap != (Object)null)
					{
						minimapViewport.CreateCocoonObject(GameManager.instance.gameMap.GetCorpsePosition());
					}
				}
			}
			else
			{
				Log.LogWarning((object)"NO COCOON");
				((Component)compassScalerRect).gameObject.SetActive(false);
				minimapViewport.DeleteCocoonObject();
				isTrackingCocoon = false;
			}
		}
	}
	public enum MinimapShape
	{
		Square,
		Circle
	}
	public enum MinimapOutline
	{
		Line,
		Dotted
	}
	public enum MinimapFrame
	{
		Default,
		Default4x,
		Variant,
		Variant4x,
		None
	}
}
namespace SkongMinimap.Utils
{
	public class IMG2Sprite
	{
		public static Sprite Tex2DToSprite(Texture2D tex, float PixelsPerUnit = 100f)
		{
			//IL_001a: 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)
			return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0f, 0f), PixelsPerUnit);
		}

		public static Sprite LoadSprite(string name)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				Texture2D val = LoadTexture("sprites", name, "png");
				return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.one * 0.5f);
			}
			catch (Exception ex)
			{
				SkongMinimapPlugin.Log.LogError((object)("Failed loading sprite: " + ex.Message));
				return null;
			}
		}

		public static Texture2D LoadTexture(string subfolder, string name, string extension)
		{
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			Texture2D result = null;
			try
			{
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				string text = executingAssembly.GetName().Name + "." + subfolder + "." + name + "." + extension;
				Stream manifestResourceStream = executingAssembly.GetManifestResourceStream(text);
				if (manifestResourceStream != null)
				{
					byte[] array = new byte[manifestResourceStream.Length];
					manifestResourceStream.Read(array, 0, array.Length);
					Texture2D val = new Texture2D(2, 2);
					ImageConversion.LoadImage(val, array);
					result = val;
					SkongMinimapPlugin.Log.LogInfo((object)("Loaded: " + text));
				}
			}
			catch (Exception ex)
			{
				SkongMinimapPlugin.Log.LogError((object)("Failed loading texture: " + ex.Message));
				result = null;
			}
			return result;
		}

		public static Texture2D LoadTextureFromBundle(string textureName)
		{
			Stopwatch stopwatch = new Stopwatch();
			stopwatch.Start();
			string directoryName = SkongMinimapPlugin.directoryName;
			string text = Path.Combine(directoryName, "maptextures");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				SkongMinimapPlugin.Log.LogError((object)"Failed to load AssetBundle!");
				return null;
			}
			SkongMinimapPlugin.Log.LogInfo((object)("Loading area map: " + text + "." + textureName));
			Texture2D result = val.LoadAsset<Texture2D>(textureName);
			val.Unload(false);
			stopwatch.Stop();
			SkongMinimapPlugin.Log.LogWarning((object)$"Loaded {textureName} map in {stopwatch.ElapsedMilliseconds} ms");
			return result;
		}
	}
	public class MapTextureBank
	{
		public Texture2D map_MossGrotto = null;

		public Texture2D map_BoneBottom = null;

		public Texture2D map_Wormways = null;

		public Texture2D map_TheMarrow = null;

		public Texture2D map_DeepDocks = null;

		public Texture2D map_HuntersMarch = null;

		public Texture2D map_FarFields = null;

		public Texture2D map_Shellwood = null;

		public Texture2D map_Bellhart = null;

		public Texture2D map_SinnersRoad = null;

		public Texture2D map_WispThicket = null;

		public Texture2D map_BlastedSteps = null;

		public Texture2D map_PutrifiedDucts = null;

		public Texture2D map_GrandGate = null;

		public Texture2D map_Underworks = null;

		public Texture2D map_Bilewater = null;

		public Texture2D map_TheCitadel = null;

		public Texture2D map_WhisperingVaults = null;

		public Texture2D map_TheSlab = null;

		public Texture2D map_MountFay = null;

		public Texture2D map_HighHalls = null;

		public Texture2D map_CogworkCore = null;

		public Texture2D map_SandsOfKarak = null;

		public Texture2D map_Memorium = null;

		public Texture2D map_TheCradle = null;

		public Texture2D map_Whiteward = null;

		public Texture2D map_WeavenestAtla = null;

		public Texture2D map_TheAbyss = null;

		public Texture2D map_Verdania = null;

		public Texture2D map_Greymoor = null;

		public Texture2D GetMapTextureByZone(string areaName, string sceneName, MapZone zone)
		{
			//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)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Expected I4, but got Unknown
			SkongMinimapPlugin.Log.LogInfo((object)("Trying to find which map to load: " + areaName + " - " + sceneName));
			Texture2D result;
			switch (zone - 2)
			{
			case 11:
				if ((Object)(object)map_MossGrotto == (Object)null)
				{
					map_MossGrotto = IMG2Sprite.LoadTextureFromBundle("mossgrotto");
				}
				result = map_MossGrotto;
				break;
			case 10:
				if ((Object)(object)map_BoneBottom == (Object)null)
				{
					map_BoneBottom = IMG2Sprite.LoadTextureFromBundle("bonebottom");
				}
				result = map_BoneBottom;
				break;
			case 32:
				if ((Object)(object)map_Wormways == (Object)null)
				{
					map_Wormways = IMG2Sprite.LoadTextureFromBundle("wormways");
				}
				result = map_Wormways;
				break;
			case 0:
				if ((Object)(object)map_TheMarrow == (Object)null)
				{
					map_TheMarrow = IMG2Sprite.LoadTextureFromBundle("themarrow");
				}
				result = map_TheMarrow;
				break;
			case 13:
				if ((Object)(object)map_DeepDocks == (Object)null)
				{
					map_DeepDocks = IMG2Sprite.LoadTextureFromBundle("deepdocks");
				}
				result = map_DeepDocks;
				break;
			case 9:
				if ((Object)(object)map_HuntersMarch == (Object)null)
				{
					map_HuntersMarch = IMG2Sprite.LoadTextureFromBundle("huntersmarch");
				}
				result = map_HuntersMarch;
				break;
			case 14:
				if ((Object)(object)map_FarFields == (Object)null)
				{
					map_FarFields = IMG2Sprite.LoadTextureFromBundle("farfields");
				}
				result = map_FarFields;
				break;
			case 2:
				if ((Object)(object)map_Shellwood == (Object)null)
				{
					map_Shellwood = IMG2Sprite.LoadTextureFromBundle("shellwood");
				}
				result = map_Shellwood;
				break;
			case 8:
				if ((Object)(object)map_Bellhart == (Object)null)
				{
					map_Bellhart = IMG2Sprite.LoadTextureFromBundle("bellhart");
				}
				result = map_Bellhart;
				break;
			case 7:
				if ((Object)(object)map_SinnersRoad == (Object)null)
				{
					map_SinnersRoad = IMG2Sprite.LoadTextureFromBundle("sinnersroad");
				}
				result = map_SinnersRoad;
				break;
			case 33:
				if ((Object)(object)map_WispThicket == (Object)null)
				{
					map_WispThicket = IMG2Sprite.LoadTextureFromBundle("wispthicket");
				}
				result = map_WispThicket;
				break;
			case 30:
				if ((Object)(object)map_BlastedSteps == (Object)null)
				{
					map_BlastedSteps = IMG2Sprite.LoadTextureFromBundle("blastedsteps");
				}
				result = map_BlastedSteps;
				break;
			case 36:
				if ((Object)(object)map_PutrifiedDucts == (Object)null)
				{
					map_PutrifiedDucts = IMG2Sprite.LoadTextureFromBundle("putrifiedducts");
				}
				result = map_PutrifiedDucts;
				break;
			case 38:
				if ((Object)(object)map_GrandGate == (Object)null)
				{
					map_GrandGate = IMG2Sprite.LoadTextureFromBundle("grandgate");
				}
				result = map_GrandGate;
				break;
			case 20:
				if ((Object)(object)map_Underworks == (Object)null)
				{
					map_Underworks = IMG2Sprite.LoadTextureFromBundle("underworks");
				}
				result = map_Underworks;
				break;
			case 34:
				if ((Object)(object)map_Bilewater == (Object)null)
				{
					map_Bilewater = IMG2Sprite.LoadTextureFromBundle("bilewater");
				}
				result = map_Bilewater;
				break;
			case 4:
				if ((Object)(object)map_TheCitadel == (Object)null)
				{
					map_TheCitadel = IMG2Sprite.LoadTextureFromBundle("thecitadel");
				}
				result = map_TheCitadel;
				break;
			case 18:
				if ((Object)(object)map_WhisperingVaults == (Object)null)
				{
					map_WhisperingVaults = IMG2Sprite.LoadTextureFromBundle("whisperingvaults");
				}
				result = ((sceneName.ToLower() == "library_02") ? map_TheCitadel : map_WhisperingVaults);
				break;
			case 5:
				if ((Object)(object)map_TheSlab == (Object)null)
				{
					map_TheSlab = IMG2Sprite.LoadTextureFromBundle("theslab");
				}
				result = map_TheSlab;
				break;
			case 22:
				if ((Object)(object)map_MountFay == (Object)null)
				{
					map_MountFay = IMG2Sprite.LoadTextureFromBundle("mountfay");
				}
				result = map_MountFay;
				break;
			case 25:
				if ((Object)(object)map_HighHalls == (Object)null)
				{
					map_HighHalls = IMG2Sprite.LoadTextureFromBundle("highhalls");
				}
				result = map_HighHalls;
				break;
			case 21:
				if ((Object)(object)map_CogworkCore == (Object)null)
				{
					map_CogworkCore = IMG2Sprite.LoadTextureFromBundle("cogwork");
				}
				result = map_CogworkCore;
				break;
			case 3:
				if ((Object)(object)map_SandsOfKarak == (Object)null)
				{
					map_SandsOfKarak = IMG2Sprite.LoadTextureFromBundle("sandsofkarak");
				}
				result = map_SandsOfKarak;
				break;
			case 26:
				if ((Object)(object)map_Memorium == (Object)null)
				{
					map_Memorium = IMG2Sprite.LoadTextureFromBundle("memorium");
				}
				result = map_Memorium;
				break;
			case 27:
				if ((Object)(object)map_TheCradle == (Object)null)
				{
					map_TheCradle = IMG2Sprite.LoadTextureFromBundle("thecradle");
				}
				result = map_TheCradle;
				break;
			case 24:
				if ((Object)(object)map_Whiteward == (Object)null)
				{
					map_Whiteward = IMG2Sprite.LoadTextureFromBundle("whiteward");
				}
				result = map_Whiteward;
				break;
			case 15:
				if ((Object)(object)map_WeavenestAtla == (Object)null)
				{
					map_WeavenestAtla = IMG2Sprite.LoadTextureFromBundle("weavenestatla");
				}
				result = map_WeavenestAtla;
				break;
			case 19:
				if ((Object)(object)map_Verdania == (Object)null)
				{
					map_Verdania = IMG2Sprite.LoadTextureFromBundle("verdania");
				}
				result = map_Verdania;
				break;
			case 35:
				if ((Object)(object)map_TheAbyss == (Object)null)
				{
					map_TheAbyss = IMG2Sprite.LoadTextureFromBundle("theabyss");
				}
				result = map_TheAbyss;
				break;
			case 1:
				if ((Object)(object)map_Greymoor == (Object)null)
				{
					map_Greymoor = IMG2Sprite.LoadTextureFromBundle("greymoor");
				}
				result = map_Greymoor;
				break;
			default:
				SkongMinimapPlugin.Log.LogInfo((object)("Can't find area map: " + areaName + " - " + sceneName));
				result = null;
				break;
			}
			SkongMinimapPlugin.Log.LogInfo((object)("Returning area map: " + areaName + " - " + sceneName));
			return result;
		}
	}
	internal class MinimapPlayerPositionHandler
	{
		private static MethodInfo GameMap_GetMapPosition;

		private static FieldInfo GameMap_CurrentScene;

		private static FieldInfo GameMap_CurrentSceneObj;

		private static FieldInfo GameMap_CurrentScenePos;

		private static FieldInfo GameMap_CurrentSceneSize;

		private static FieldInfo GameMap_MapZoneInfo;

		public static void UpdatePrivateFieldsFromGameMap()
		{
			if (GameMap_GetMapPosition == null)
			{
				Type typeFromHandle = typeof(GameMap);
				BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.NonPublic;
				GameMap_GetMapPosition = typeFromHandle.GetMethod("GetMapPosition", bindingAttr, null, new Type[5]
				{
					typeof(Vector2),
					typeof(GameMapScene),
					typeof(GameObject),
					typeof(Vector2),
					typeof(Vector2)
				}, null);
				GameMap_CurrentScene = typeFromHandle.GetField("currentScene", bindingAttr);
				GameMap_CurrentScenePos = typeFromHandle.GetField("currentScenePos", bindingAttr);
				GameMap_CurrentSceneObj = typeFromHandle.GetField("currentSceneObj", bindingAttr);
				GameMap_CurrentSceneSize = typeFromHandle.GetField("currentSceneSize", bindingAttr);
				GameMap_MapZoneInfo = typeFromHandle.GetField("mapZoneInfo", bindingAttr);
			}
		}

		public static Vector2 GetPlayerMapPosition()
		{
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: 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_0087: 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_00b3: Expected O, but got Unknown
			//IL_00c0: 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_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			UpdatePrivateFieldsFromGameMap();
			if (SkongMinimapPlugin.IsInGame && GameMap_GetMapPosition != null && GameMap_CurrentScene != null && GameMap_CurrentScenePos != null && GameMap_CurrentSceneObj != null && GameMap_CurrentSceneSize != null)
			{
				GameMap gameMap = GameManager.instance.gameMap;
				gameMap.UpdateCurrentScene();
				return (Vector2)GameMap_GetMapPosition.Invoke(gameMap, new object[5]
				{
					Vector2.op_Implicit(((Component)HeroController.instance).transform.position),
					GameMap_CurrentScene.GetValue(gameMap),
					(object)(GameObject)GameMap_CurrentSceneObj.GetValue(gameMap),
					(object)(Vector2)GameMap_CurrentScenePos.GetValue(gameMap),
					(object)(Vector2)GameMap_CurrentSceneSize.GetValue(gameMap)
				});
			}
			return Vector2.zero;
		}

		public static Vector2 GetMapPosition(Vector2 pos)
		{
			//IL_00dd: 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_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_00e5: Unknown result type (might be due to invalid IL or missing references)
			UpdatePrivateFieldsFromGameMap();
			if (SkongMinimapPlugin.IsInGame && GameMap_GetMapPosition != null && GameMap_CurrentScene != null && GameMap_CurrentScenePos != null && GameMap_CurrentSceneObj != null && GameMap_CurrentSceneSize != null)
			{
				GameMap gameMap = GameManager.instance.gameMap;
				gameMap.UpdateCurrentScene();
				return (Vector2)GameMap_GetMapPosition.Invoke(gameMap, new object[5]
				{
					pos,
					GameMap_CurrentScene.GetValue(gameMap),
					(object)(GameObject)GameMap_CurrentSceneObj.GetValue(gameMap),
					(object)(Vector2)GameMap_CurrentScenePos.GetValue(gameMap),
					(object)(Vector2)GameMap_CurrentSceneSize.GetValue(gameMap)
				});
			}
			return Vector2.zero;
		}

		public static Vector2 GetBoundSize()
		{
			//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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Expected O, but got Unknown
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0058: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GameMap gameMap = GameManager.instance.gameMap;
				GameMapScene val = (GameMapScene)GameMap_CurrentScene.GetValue(gameMap);
				Bounds bounds = val.BoundsSprite.bounds;
				return Vector2.op_Implicit(((Bounds)(ref bounds)).size) * Vector2.op_Implicit(((Component)val).transform.localScale);
			}
			catch (Exception)
			{
				return Vector2.zero;
			}
		}

		public static Vector2 WorldToMinimap(Vector2 worldPos)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			float num = worldPos.x * -196.2f - 222.3f;
			float num2 = worldPos.y * -155.75f - 416.5f;
			return new Vector2(num, num2);
		}
	}
	internal class TweenHelper
	{
		public static void TweenFloat(MonoBehaviour caller, Func<float> getter, Action<float> setter, float endValue, float duration)
		{
			caller.StartCoroutine(TweenFloatRoutine(getter, setter, endValue, duration));
		}

		public static IEnumerator TweenFloatRoutine(Func<float> getter, Action<float> setter, float endValue, float duration)
		{
			float t = 0f;
			float startValue = getter();
			int iteration = 0;
			while (t < duration && iteration < 1000)
			{
				setter(Mathf.Lerp(startValue, endValue, t / duration));
				t += Time.unscaledDeltaTime;
				iteration++;
				if (iteration >= 1000)
				{
					SkongMinimapPlugin.Log.LogError((object)"TWEEN TIMEOUT");
					setter(endValue);
				}
				yield return null;
			}
			setter(endValue);
			yield return null;
		}

		public static IEnumerator TweenFloatRoutineWithDelay(Func<float> getter, Action<float> setter, float endValue, float duration, float delay)
		{
			int iteration = 0;
			yield return (object)new WaitForSecondsRealtime(delay);
			float t = 0f;
			float startValue = getter();
			while (t < duration && iteration < 1000)
			{
				setter(Mathf.Lerp(startValue, endValue, t / duration));
				t += Time.unscaledDeltaTime;
				iteration++;
				if (iteration >= 1000)
				{
					SkongMinimapPlugin.Log.LogError((object)"TWEEN TIMEOUT");
					setter(endValue);
				}
				yield return null;
			}
			setter(endValue);
			yield return null;
		}
	}
}
namespace SkongMinimap.Properties
{
	internal class BenchPositions
	{
		public static Dictionary<MapZone, Vector2[]> list = new Dictionary<MapZone, Vector2[]>
		{
			{
				(MapZone)13,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(-14.6f, -11.9f)
				}
			},
			{
				(MapZone)12,
				(Vector2[])(object)new Vector2[2]
				{
					new Vector2(-9.9f, -8.7f),
					new Vector2(-12.3f, -11.3f)
				}
			},
			{
				(MapZone)4,
				(Vector2[])(object)new Vector2[4]
				{
					new Vector2(-8.5f, -8f),
					new Vector2(-10.9f, -4.6f),
					new Vector2(-5f, -5f),
					new Vector2(-12.7f, -6.3f)
				}
			},
			{
				(MapZone)34,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(-18.4f, -7.6f)
				}
			},
			{
				(MapZone)10,
				(Vector2[])(object)new Vector2[3]
				{
					new Vector2(-1.2f, -6.5f),
					new Vector2(-1.2f, -5.3f),
					new Vector2(-1.4f, -5.9f)
				}
			},
			{
				(MapZone)24,
				(Vector2[])(object)new Vector2[4]
				{
					new Vector2(-20.8f, 6.1f),
					new Vector2(-13.8f, 4.8f),
					new Vector2(-13f, 8.8f),
					new Vector2(-12.6f, 12.4f)
				}
			},
			{
				(MapZone)16,
				(Vector2[])(object)new Vector2[7]
				{
					new Vector2(13.7f, -11.2f),
					new Vector2(14f, -9.5f),
					new Vector2(8.1f, -10.3f),
					new Vector2(22.5f, -12.8f),
					new Vector2(16.2f, -12.3f),
					new Vector2(23.3f, -9f),
					new Vector2(17.6f, -7.1f)
				}
			},
			{
				(MapZone)32,
				(Vector2[])(object)new Vector2[3]
				{
					new Vector2(-14.3f, -0.5f),
					new Vector2(-14.8f, -3.9f),
					new Vector2(-19.6f, -1.7f)
				}
			},
			{
				(MapZone)6,
				(Vector2[])(object)new Vector2[7]
				{
					new Vector2(6.7f, 4f),
					new Vector2(8.7f, 7.8f),
					new Vector2(-3.2f, 2.7f),
					new Vector2(-2.9f, 5.4f),
					new Vector2(0.7f, 5.8f),
					new Vector2(8.2f, 7.8f),
					new Vector2(4f, 8f)
				}
			},
			{
				(MapZone)36,
				(Vector2[])(object)new Vector2[4]
				{
					new Vector2(12.9f, -0.1f),
					new Vector2(10.1f, 0.2f),
					new Vector2(16.7f, 6.2f),
					new Vector2(20f, 4.2f)
				}
			},
			{
				(MapZone)38,
				(Vector2[])(object)new Vector2[2]
				{
					new Vector2(17f, 8.9f),
					new Vector2(14.1f, 7.2f)
				}
			},
			{
				(MapZone)2,
				(Vector2[])(object)new Vector2[4]
				{
					new Vector2(-7.1f, -9.2f),
					new Vector2(-7.7f, -11.3f),
					new Vector2(-10.6f, -9.4f),
					new Vector2(-1.8f, -10.3f)
				}
			},
			{
				(MapZone)3,
				(Vector2[])(object)new Vector2[3]
				{
					new Vector2(13.7f, -4.8f),
					new Vector2(7.3f, -5f),
					new Vector2(14.5f, -5.3f)
				}
			},
			{
				(MapZone)15,
				(Vector2[])(object)new Vector2[6]
				{
					new Vector2(6.6f, -11.6f),
					new Vector2(2.6f, -10.4f),
					new Vector2(2.2f, -14.2f),
					new Vector2(3.8f, -14.1f),
					new Vector2(4.5f, -12.3f),
					new Vector2(7.4f, -14.9f)
				}
			},
			{
				(MapZone)5,
				(Vector2[])(object)new Vector2[2]
				{
					new Vector2(-9.1f, 2.3f),
					new Vector2(-20f, 3.8f)
				}
			},
			{
				(MapZone)11,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(7f, 8.3f)
				}
			},
			{
				(MapZone)9,
				(Vector2[])(object)new Vector2[2]
				{
					new Vector2(9.9f, -2.2f),
					new Vector2(16.4f, -2.8f)
				}
			},
			{
				(MapZone)35,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(4.1f, -2.5f)
				}
			},
			{
				(MapZone)22,
				(Vector2[])(object)new Vector2[3]
				{
					new Vector2(-5f, -1.2f),
					new Vector2(-1.1f, 1.3f),
					new Vector2(3.4f, 1.2f)
				}
			},
			{
				(MapZone)29,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(4.8f, 13.1f)
				}
			},
			{
				(MapZone)26,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(1.4f, 4.3f)
				}
			},
			{
				(MapZone)20,
				(Vector2[])(object)new Vector2[2]
				{
					new Vector2(10.2f, 6.4f),
					new Vector2(11.4f, 4.1f)
				}
			},
			{
				(MapZone)27,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(1.2f, 8.5f)
				}
			},
			{
				(MapZone)28,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(5.4f, 8.6f)
				}
			},
			{
				(MapZone)23,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(2.3f, 7.7f)
				}
			},
			{
				(MapZone)7,
				(Vector2[])(object)new Vector2[4]
				{
					new Vector2(-10.1f, 4.8f),
					new Vector2(-11.3f, 8.8f),
					new Vector2(-10.5f, 8.2f),
					new Vector2(-8.8f, 7f)
				}
			},
			{
				(MapZone)17,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(-10.6f, -13.7f)
				}
			},
			{
				(MapZone)21,
				(Vector2[])(object)new Vector2[1]
				{
					new Vector2(23.9f, -4.8f)
				}
			},
			{
				(MapZone)37,
				(Vector2[])(object)new Vector2[3]
				{
					new Vector2(2.1f, -16.6f),
					new Vector2(1.8f, -20.5f),
					new Vector2(7.4f, -17.8f)
				}
			}
		};
	}
}
namespace SkongMinimap.Patches
{
	[HarmonyPatch(typeof(DialogueBox))]
	internal class DialogueBoxPatches
	{
		[HarmonyPatch("StartConversation", new Type[]
		{
			typeof(LocalisedString),
			typeof(NPCControlBase),
			typeof(bool)
		})]
		[HarmonyPostfix]
		public static void StartConversation_Postfix()
		{
			SkongMinimapPlugin.Log.LogWarning((object)"Conversation started 1");
			SkongMinimapPlugin.PauseMinimap(0.25f);
		}

		[HarmonyPatch("StartConversation", new Type[]
		{
			typeof(LocalisedString),
			typeof(NPCControlBase),
			typeof(bool),
			typeof(DisplayOptions),
			typeof(Action)
		})]
		[HarmonyPostfix]
		public static void StartConversation_Postfix2()
		{
			SkongMinimapPlugin.Log.LogWarning((object)"Conversation started 2");
			SkongMinimapPlugin.PauseMinimap(0.25f);
		}

		[HarmonyPatch("StartConversation", new Type[]
		{
			typeof(string),
			typeof(NPCControlBase),
			typeof(bool),
			typeof(DisplayOptions),
			typeof(Action),
			typeof(Action)
		})]
		[HarmonyPostfix]
		public static void StartConversation_Postfix3()
		{
			SkongMinimapPlugin.PauseMinimap(0.25f);
		}
	}
	[HarmonyPatch(typeof(GameCameras))]
	internal class GameCamerasPatches
	{
		[HarmonyPatch("OnCinematicBegin")]
		[HarmonyPostfix]
		public static void OnCinematicBegin_Postfix()
		{
			SkongMinimapPlugin.Log.LogInfo((object)"Cinematic Started");
			SkongMinimapPlugin.IsInCutscene = true;
			SkongMinimapPlugin.PauseMinimap(0.25f);
		}

		[HarmonyPatch("OnCinematicEnd")]
		[HarmonyPostfix]
		public static void OnCinematicEnd_Postfix()
		{
			SkongMinimapPlugin.IsInCutscene = false;
			SkongMinimapPlugin.ResumeMinimap(0.25f, 0f);
			SkongMinimapPlugin.Log.LogInfo((object)"Cinematic Ended");
		}
	}
	[HarmonyPatch(typeof(GameManager))]
	internal class GameManagerPatches
	{
		private static bool isNewGame;

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		public static void Awake_Postfix(GameManager __instance)
		{
			SkongMinimapPlugin.Log.LogInfo((object)"Minimap initiated");
			SkongMinimapPlugin.InitMinimap();
		}

		[HarmonyPatch("LoadGameFromUI", new Type[]
		{
			typeof(int),
			typeof(SaveGameData)
		})]
		[HarmonyPostfix]
		public static void LoadGameFromUI_Postfix(int saveSlot, SaveGameData saveGameData)
		{
			isNewGame = false;
			float playTime = saveGameData.playerData.playTime;
			SkongMinimapPlugin.IsInGame = true;
			SkongMinimapPlugin.UpdateAreaNameValue();
			SkongMinimapPlugin.SetMinimapVisible(value: false);
		}

		[HarmonyPatch("StartNewGame")]
		[HarmonyPostfix]
		public static void StartNewGame_Postfix()
		{
			isNewGame = true;
			SkongMinimapPlugin.IsInGame = true;
			SkongMinimapPlugin.UpdateAreaNameValue();
			SkongMinimapPlugin.SetMinimapVisible(value: false);
			SkongMinimapPlugin.PauseMinimap(0f);
		}

		[HarmonyPatch("SetPausedState")]
		[HarmonyPostfix]
		public static void SetPausedState_Postfix(bool value)
		{
			if (value)
			{
				SkongMinimapPlugin.PauseMinimap(0.25f);
			}
			else
			{
				SkongMinimapPlugin.ResumeMinimap(0.25f, 0f);
			}
		}

		[HarmonyPatch("SetState")]
		[HarmonyPostfix]
		public static void SetState_Postfix(GameState newState)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			if ((int)newState != 6)
			{
				if ((int)newState == 7)
				{
					SkongMinimapPlugin.PauseMinimap(0.25f);
				}
			}
			else
			{
				SkongMinimapPlugin.PauseMinimap(0.25f);
			}
		}

		[HarmonyPatch("PlayerDead")]
		[HarmonyPostfix]
		public static void PlayerDead_Postfix()
		{
			SkongMinimapPlugin.PauseMinimap(0.25f);
		}

		[HarmonyPatch("OnNextLevelReady")]
		[HarmonyPostfix]
		public static void OnNextLevelReady_Postfix()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Invalid comparison between Unknown and I4
			SkongMinimapPlugin.UpdateEnemyList();
			if (SkongMinimapPlugin.IsInGame && (int)GameManager.instance.GameState != 7 && !(GameManager.instance.sceneName == "Cinematic_Stag_Travel"))
			{
				if (isNewGame && GameManager.instance.lastSceneName == "Opening_Sequence")
				{
					isNewGame = false;
					return;
				}
				if (SkongMinimapPlugin.IsInCutscene)
				{
					SkongMinimapPlugin.UpdateAreaNameValue();
					return;
				}
				SkongMinimapPlugin.SetMinimapVisible(value: true);
				SkongMinimapPlugin.ResumeMinimap(0.25f, 0.25f);
				SkongMinimapPlugin.UpdateAreaNameValue();
			}
		}

		[HarmonyPatch("DoShopCloseGameMapUpdate")]
		[HarmonyPrefix]
		public static void DoShopCloseGameMapUpdate_Prefix()
		{
			if (GameManager.instance.DidPurchaseMap)
			{
				SkongMinimapPlugin.UpdateAreaNameValue();
			}
		}

		[HarmonyPatch("CheckMapAchievements")]
		[HarmonyPrefix]
		public static void CheckMapAchievements_Prefix()
		{
			SkongMinimapPlugin.UpdateAreaNameValue();
			if ((Object)(object)SkongMinimapPlugin.CurrentConversingNPC != (Object)null && ((Object)SkongMinimapPlugin.CurrentConversingNPC).name.Contains("Map Machine"))
			{
				SkongMinimapPlugin.Log.LogWarning((object)"Interacted with a Map Machine");
				SkongMinimapPlugin.ResumeMinimap(0.25f, 0.25f);
			}
		}

		[HarmonyPatch("AddToBenchList")]
		[HarmonyPrefix]
		public static void AddToBenchList_Prefix()
		{
			SkongMinimapPlugin.Log.LogWarning((object)"ADD TO BENCH LIST");
		}
	}
	[HarmonyPatch(typeof(GameMap))]
	internal class GameMapPatches
	{
		[HarmonyPatch("TryOpenQuickMap")]
		[HarmonyPostfix]
		public static void TryOpenQuickMap_Postfix()
		{
			SkongMinimapPlugin.PauseMinimap(0.25f);
		}

		[HarmonyPatch("CloseQuickMap")]
		[HarmonyPostfix]
		public static void CloseQuickMap_Postfix()
		{
			if (!GameManager.instance.playerData.isInventoryOpen)
			{
				SkongMinimapPlugin.ResumeMinimap(0.25f, 0.1f);
			}
		}
	}
	[HarmonyPatch(typeof(HeroController))]
	internal class HeroControllerPatches
	{
		[HarmonyPatch("CocoonBroken", new Type[]
		{
			typeof(bool),
			typeof(bool)
		})]
		[HarmonyPostfix]
		public static void CocoonBroken_Postfix()
		{
			SkongMinimapPlugin.Log.LogWarning((object)"Cocoon broken!");
			((Component)SkongMinimapPlugin.compassScalerRect).gameObject.SetActive(false);
			SkongMinimapPlugin.minimapViewport.DeleteCocoonObject();
		}
	}
	[HarmonyPatch(typeof(HeroTalkAnimation))]
	internal class HeroTalkAnimationPatches
	{
		[HarmonyPatch("EnterConversation")]
		[HarmonyPostfix]
		public static void EnterConversation_Postfix(NPCControlBase sourceNpc)
		{
			SkongMinimapPlugin.IsInConversation = true;
			SkongMinimapPlugin.CurrentConversingNPC = sourceNpc;
			SkongMinimapPlugin.Log.LogInfo((object)("STARTED CONVERSATION WITH: " + ((Object)sourceNpc).name));
		}

		[HarmonyPatch("ExitConversation")]
		[HarmonyPostfix]
		public static void ExitConversation_Postfix()
		{
			SkongMinimapPlugin.ResumeMinimap(0.25f, 0f);
			SkongMinimapPlugin.IsInConversation = false;
		}
	}
	[HarmonyPatch(typeof(InventoryMapManager))]
	internal class InventoryMapManagerPatches
	{
		[HarmonyPatch("OnPaneStart")]
		[HarmonyPostfix]
		public static void OnPaneStart_Postfix()
		{
			SkongMinimapPlugin.PauseMinimap(0.1f);
		}
	}
	[HarmonyPatch(typeof(MapMarkerMenu))]
	internal class MapMarkerMenuPatches
	{
		[HarmonyPatch("PlaceMarker")]
		[HarmonyPostfix]
		public static void PlaceMarker_Postfix()
		{
			SkongMinimapPlugin.UpdateCustomMarkers();
			SkongMinimapPlugin.Log.LogWarning((object)"Placed a custom marker");
		}

		[HarmonyPatch("RemoveMarker")]
		[HarmonyPostfix]
		public static void RemoveMarker_Postfix()
		{
			SkongMinimapPlugin.UpdateCustomMarkers();
			SkongMinimapPlugin.Log.LogWarning((object)"Removed a custom marker");
		}
	}
	[HarmonyPatch(typeof(MapPin))]
	internal class MapPinPatches
	{
		[HarmonyPatch("AddPin")]
		[HarmonyPostfix]
		public static void AddPin_Postfix()
		{
		}
	}
	[HarmonyPatch(typeof(QuitToMenu))]
	internal class QuitToMenuPatches
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void Start_Postfix()
		{
			SkongMinimapPlugin.Log.LogInfo((object)"Minimap hidden");
			SkongMinimapPlugin.IsInGame = false;
			SkongMinimapPlugin.SetMinimapVisible(value: false);
		}
	}
}
namespace SkongMinimap.MonoBehaviours
{
	internal class CocoonCompassComponent : MonoBehaviour
	{
		public void LateUpdate()
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			if (SkongMinimapPlugin.IsInGame && SkongMinimapPlugin.isTrackingCocoon)
			{
				Vector2 playerMapPosition = MinimapPlayerPositionHandler.GetPlayerMapPosition();
				Vector2 val = GameManager.instance.gameMap.GetCorpsePosition() - playerMapPosition;
				Vector2 normalized = ((Vector2)(ref val)).normalized;
				float num = Mathf.Atan2(normalized.y, normalized.x) * 57.29578f;
				((Component)this).transform.localRotation = Quaternion.Euler(0f, 0f, num - 90f);
			}
		}
	}
	public class MinimapViewportComponent : MonoBehaviour
	{
		private Image viewportImage;

		private Sprite playerIcon;

		private Sprite noMapIcon;

		private Texture2D fullMapTex;

		private string location;

		private string directoryName;

		private CanvasGroup minimapCG;

		private Sprite squareFillSprite;

		private Sprite circleFillSprite;

		private Sprite defaultFrameSprite;

		private Sprite defaultFrameAllSprite;

		private Sprite variantFrameSprite;

		private Sprite variantFrameAllSprite;

		private Sprite redMarkerSprite;

		private Sprite yellowMarkerSprite;

		private Sprite silverMarkerSprite;

		private Sprite blackMarkerSprite;

		private Sprite brownMarkerSprite;

		private Sprite cocoonSprite;

		private Sprite benchSprite;

		private RadarManagerComponent radar;

		public GameObject cocoonParentObject;

		private GameObject pinsParentObject;

		private GameObject markersParentObject;

		private List<Image> markerImages = new List<Image>();

		private List<RectTransform> markerRects = new List<RectTransform>();

		private Dictionary<RectTransform, Vector2> markerPosPairs = new Dictionary<RectTransform, Vector2>();

		private static GameObject cocoonObject;

		private static RectTransform cocoonRect;

		private static Vector2 cocoonPos;

		private List<Image> dotImages = new List<Image>();

		private List<RectTransform> dotRects = new List<RectTransform>();

		private Image outlineImage;

		private RectTransform outlineRect;

		private Sprite outlineSquareSprite;

		private Sprite outlineSquareDottedSprite;

		private Sprite outlineCircleSprite;

		private Sprite outlineCircleDottedSprite;

		private Sprite radarDotSprite;

		private Image framesImage;

		private RectTransform framesRect;

		private MinimapShape shape;

		private bool useOutline;

		public Text posDisplay;

		private RectTransform posRect;

		private Mask mask;

		private bool showBG = false;

		private MinimapOutline outlineType;

		private RawImage mapImage;

		private RectTransform mapRect;

		private Image playerIconImage;

		private RectTransform playerIconRect;

		private static float currentZoomMult = 1f;

		private float currentOpacity = 1f;

		private Coroutine minimapRoutine;

		private const float POS_COEFFICIENT = 150f;

		private const float OFFSET_X_COEFFICIENT = -390f;

		private const float OFFSET_Y_COEFFICIENT = 345f;

		public static MapZone lastZone = (MapZone)0;

		private Dictionary<RectTransform, Vector2> benchPosPairs = new Dictionary<RectTransform, Vector2>();

		private float coefficient = 1f;

		private float xOffset;

		private float yOffset;

		private void LoadSprites()
		{
			squareFillSprite = IMG2Sprite.LoadSprite("fill");
			circleFillSprite = IMG2Sprite.LoadSprite("fill-circle");
			defaultFrameSprite = IMG2Sprite.LoadSprite("frames-default");
			defaultFrameAllSprite = IMG2Sprite.LoadSprite("frames-default-allcorners");
			variantFrameSprite = IMG2Sprite.LoadSprite("frames-variant");
			variantFrameAllSprite = IMG2Sprite.LoadSprite("frames-variant-allcorners");
			radarDotSprite = IMG2Sprite.LoadSprite("radar-dot");
			redMarkerSprite = IMG2Sprite.LoadSprite("marker-red");
			yellowMarkerSprite = IMG2Sprite.LoadSprite("marker-yellow");
			silverMarkerSprite = IMG2Sprite.LoadSprite("marker-silver");
			blackMarkerSprite = IMG2Sprite.LoadSprite("marker-black");
			brownMarkerSprite = IMG2Sprite.LoadSprite("marker-brown");
			cocoonSprite = IMG2Sprite.LoadSprite("marker-cocoon");
			benchSprite = IMG2Sprite.LoadSprite("marker-bench");
		}

		public void Start()
		{
			radar = ((Component)this).GetComponent<RadarManagerComponent>();
			viewportImage = ((Component)this).GetComponent<Image>();
			LoadSprites();
			shape = SkongMinimapPlugin.MinimapFillShape.Value;
			useOutline = SkongMinimapPlugin.MinimapUseOutline.Value;
			viewportImage.sprite = ((shape == MinimapShape.Square) ? squareFillSprite : circleFillSprite);
			minimapCG = ((Component)this).gameObject.AddComponent<CanvasGroup>();
			currentOpacity = SkongMinimapPlugin.MinimapOpacity.Value;
			UpdateOpacity();
			location = Assembly.GetExecutingAssembly().Location;
			directoryName = Path.GetDirectoryName(location);
			mask = ((Component)this).gameObject.AddComponent<Mask>();
			InitOutline();
			InitFullMap();
			InitPlayerIcon();
			InitPosDisplay();
			InitFrames();
			InitSubModules();
			InitCurrentMarkers();
			((Transform)SkongMinimapPlugin.areaNameRect).SetAsLastSibling();
			((Transform)SkongMinimapPlugin.compassScalerRect).SetAsLastSibling();
			((Component)SkongMinimapPlugin.compassScalerRect).gameObject.SetActive(false);
			SkongMinimapPlugin.UpdateAreaNameValue();
			SkongMinimapPlugin.UpdateMinimapScale();
		}

		private void InitSubModules()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0050: 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_007c: 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_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: 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_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_020b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			markersParentObject = new GameObject("Custom Markers");
			Object.DontDestroyOnLoad((Object)(object)markersParentObject);
			markersParentObject.transform.SetParent(((Component)mapRect).transform);
			RectTransform val = markersParentObject.AddComponent<RectTransform>();
			val.anchorMin = new Vector2(0.5f, 0.5f);
			val.anchorMax = new Vector2(0.5f, 0.5f);
			val.pivot = new Vector2(0.5f, 0.5f);
			val.sizeDelta = new Vector2(1600f, 1600f);
			val.anchoredPosition = Vector2.zero;
			UpdateMarkersActive();
			cocoonParentObject = new GameObject("Cocoon Compass");
			Object.DontDestroyOnLoad((Object)(object)cocoonParentObject);
			cocoonParentObject.transform.SetParent(((Component)mapRect).transform);
			RectTransform val2 = cocoonParentObject.AddComponent<RectTransform>();
			val2.anchorMin = new Vector2(0.5f, 0.5f);
			val2.anchorMax = new Vector2(0.5f, 0.5f);
			val2.pivot = new Vector2(0.5f, 0.5f);
			val2.sizeDelta = new Vector2(1600f, 1600f);
			val2.anchoredPosition = Vector2.zero;
			UpdateCocoonActive();
			pinsParentObject = new GameObject("Pins");
			Object.DontDestroyOnLoad((Object)(object)pinsParentObject);
			pinsParentObject.transform.SetParent(((Component)mapRect).transform);
			RectTransform val3 = pinsParentObject.AddComponent<RectTransform>();
			val3.anchorMin = new Vector2(0.5f, 0.5f);
			val3.anchorMax = new Vector2(0.5f, 0.5f);
			val3.pivot = new Vector2(0.5f, 0.5f);
			val3.sizeDelta = new Vector2(1600f, 1600f);
			val3.anchoredPosition = Vector2.zero + Vector2.up * 2f;
		}

		public void UpdateCocoonActive()
		{
			bool value = SkongMinimapPlugin.IsCocoonCompassEnabled.Value;
			if ((Object)(object)cocoonParentObject != (Object)null)
			{
				cocoonParentObject.SetActive(value);
			}
			if ((Object)(object)SkongMinimapPlugin.compassScalerObject != (Object)null)
			{
				SkongMinimapPlugin.compassScalerObject.SetActive(value && SkongMinimapPlugin.isTrackingCocoon);
			}
		}

		public void UpdateMarkersActive()
		{
			if ((Object)(object)markersParentObject != (Object)null)
			{
				markersParentObject.SetActive(SkongMinimapPlugin.IsCustomMarkersEnabled.Value);
			}
		}

		private void InitCurrentMarkers()
		{
			//IL_0088: 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_0091: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)GameManager.instance == (Object)null || GameManager.instance.playerData.placedMarkers == null)
			{
				SkongMinimapPlugin.Log.LogWarning((object)("Error when loading markers: " + (object)GameManager.instance));
			}
			else
			{
				if (!SkongMinimapPlugin.IsCustomMarkersEnabled.Value)
				{
					return;
				}
				WrappedVector2List[] placedMarkers = GameManager.instance.playerData.placedMarkers;
				for (int i = 0; i < placedMarkers.Length; i++)
				{
					foreach (Vector2 item in ((WrappedList<Vector2>)(object)placedMarkers[i]).List)
					{
						CreateMarkerObject(item, (MarkerTypes)i);
					}
				}
			}
		}

		public void UpdateMarkers()
		{
			foreach (RectTransform markerRect in markerRects)
			{
				if ((Object)(object)markerRect != (Object)null)
				{
					Object.Destroy((Object)(object)((Component)markerRect).gameObject);
				}
			}
			markerRects.Clear();
			markerImages.Clear();
			markerPosPairs.Clear();
			InitCurrentMarkers();
		}

		public void CreateMarkerObject(Vector2 pos, MarkerTypes markerType)
		{
			//IL_000b: 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_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_007c: 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_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			SkongMinimapPlugin.Log.LogInfo((object)$"Added {markerType} marker at {pos}!");
			GameObject val = new GameObject("Marker " + ((object)(MarkerTypes)(ref markerType)).ToString());
			val.transform.SetParent(markersParentObject.transform);
			Image val2 = val.AddComponent<Image>();
			markerImages.Add(val2);
			RectTransform rectTransform = ((Graphic)val2).rectTransform;
			rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
			rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
			rectTransform.pivot = new Vector2(0.5f, 0.5f);
			rectTransform.sizeDelta = new Vector2(32f, 32f);
			rectTransform.anchoredPosition = WorldToMinimapPos(pos);
			((Graphic)val2).color = Color.white;
			((MaskableGraphic)val2).maskable = true;
			val2.sprite = GetMarkerSprite(markerType);
			markerRects.Add(rectTransform);
			markerPosPairs.Add(rectTransform, pos);
		}

		public void DeleteCocoonObject()
		{
			if ((Object)(object)cocoonObject != (Object)null)
			{
				Object.Destroy((Object)(object)cocoonObject);
			}
		}

		public void CreateCocoonObject(Vector2 pos)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Expected O, but got Unknown
			//IL_0080: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)mapRect == (Object)null))
			{
				SkongMinimapPlugin.Log.LogWarning((object)$"Added Cocoon marker at {pos}!");
				cocoonObject = new GameObject("Cocoon Marker");
				cocoonObject.transform.SetParent(cocoonParentObject.transform);
				Image val = cocoonObject.AddComponent<Image>();
				cocoonRect = ((Graphic)val).rectTransform;
				cocoonRect.anchorMin = new Vector2(0.5f, 0.5f);
				cocoonRect.anchorMax = new Vector2(0.5f, 0.5f);
				cocoonRect.pivot = new Vector2(0.5f, 0.5f);
				cocoonRect.sizeDelta = new Vector2(48f, 48f);
				cocoonRect.anchoredPosition = WorldToMinimapPos(pos);
				cocoonPos = pos;
				((Graphic)val).color = Color.white;
				((MaskableGraphic)val).maskable = true;
				val.sprite = cocoonSprite;
			}
		}

		private Sprite GetMarkerSprite(MarkerTypes markerType)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Expected I4, but got Unknown
			Sprite result = null;
			switch ((int)markerType)
			{
			case 0:
				result = yellowMarkerSprite;
				break;
			case 1:
				result = silverMarkerSprite;
				break;
			case 2:
				result = redMarkerSprite;
				break;
			case 3:
				result = blackMarkerSprite;
				break;
			case 4:
				result = brownMarkerSprite;
				break;
			}
			return result;
		}

		public void UpdateRadarDots()
		{
		}

		private void InitRadarDot()
		{
		}

		private void InitOutline()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Minimap Outline");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.transform.SetParent(((Component)this).transform);
			outlineImage = val.AddComponent<Image>();
			((MaskableGraphic)outlineImage).maskable = false;
			outlineRect = ((Graphic)outlineImage).rectTransform;
			outlineRect.anchorMin = new Vector2(0.5f, 0.5f);
			outlineRect.anchorMax = new Vector2(0.5f, 0.5f);
			outlineRect.pivot = new Vector2(0.5f, 0.5f);
			outlineRect.sizeDelta = new Vector2(260f, 260f);
			outlineRect.anchoredPosition = Vector2.zero;
			outlineSquareSprite = IMG2Sprite.LoadSprite("outline");
			outlineCircleSprite = IMG2Sprite.LoadSprite("outline-circle");
			outlineSquareDottedSprite = IMG2Sprite.LoadSprite("outline-dotted");
			outlineCircleDottedSprite = IMG2Sprite.LoadSprite("outline-circle-dotted");
			UpdateShape();
			UpdateOutlineSprite();
			UpdateOutlineColor();
			((Behaviour)outlineImage).enabled = useOutline;
		}

		private void InitFrames()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_006b: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Minimap Frames");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.transform.SetParent(((Component)this).transform);
			val.transform.SetAsLastSibling();
			framesImage = val.AddComponent<Image>();
			((MaskableGraphic)framesImage).maskable = false;
			framesRect = ((Graphic)framesImage).rectTransform;
			framesRect.anchorMin = new Vector2(0.5f, 0.5f);
			framesRect.anchorMax = new Vector2(0.5f, 0.5f);
			framesRect.pivot = new Vector2(0.5f, 0.5f);
			framesRect.sizeDelta = new Vector2(280f, 280f);
			framesRect.anchoredPosition = Vector2.zero;
			((Graphic)framesImage).color = Color.white;
			UpdateFrameSprite();
		}

		public void UpdateOutlineColor()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (Object.op_Implicit((Object)(object)outlineImage))
			{
				((Graphic)outlineImage).color = SkongMinimapPlugin.MinimapOutlineColor.Value;
			}
		}

		public void UpdateOutlineSprite()
		{
			if (shape == MinimapShape.Square)
			{
				outlineImage.sprite = ((outlineType == MinimapOutline.Line) ? outlineSquareSprite : outlineSquareDottedSprite);
			}
			else
			{
				outlineImage.sprite = ((outlineType == MinimapOutline.Line) ? outlineCircleSprite : outlineCircleDottedSprite);
			}
		}

		public void UpdateFrameSprite()
		{
			if (!((Object)(object)framesImage == (Object)null))
			{
				switch (SkongMinimapPlugin.MinimapFrameType.Value)
				{
				case MinimapFrame.Default:
					framesImage.sprite = defaultFrameSprite;
					break;
				case MinimapFrame.Default4x:
					framesImage.sprite = defaultFrameAllSprite;
					break;
				case MinimapFrame.Variant:
					framesImage.sprite = variantFrameSprite;
					break;
				case MinimapFrame.Variant4x:
					framesImage.sprite = variantFrameAllSprite;
					break;
				case MinimapFrame.None:
					framesImage.sprite = null;
					((Behaviour)framesImage).enabled = false;
					return;
				}
				((Behaviour)framesImage).enabled = SkongMinimapPlugin.MinimapFillShape.Value == MinimapShape.Square;
			}
		}

		public void ChangeUseOutline(bool useOutline)
		{
			this.useOutline = useOutline;
		}

		public void ChangeShape(MinimapShape shape)
		{
			this.shape = shape;
		}

		private void InitPosDisplay()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_006b: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = new GameObject("Player Position Display");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.transform.SetParent(((Component)this).transform);
			val.transform.SetAsLastSibling();
			posDisplay = val.AddComponent<Text>();
			((MaskableGraphic)posDisplay).maskable = false;
			posRect = ((Graphic)posDisplay).rectTransform;
			posRect.anchorMin = new Vector2(0.5f, 0.5f);
			posRect.anchorMax = new Vector2(0.5f, 0.5f);
			posRect.pivot = new Vector2(0.5f, 0.5f);
			posRect.sizeDelta = new Vector2(256f, 256f);
			posRect.anchoredPosition = Vector2.zero;
			posDisplay.alignment = (TextAnchor)6;
			posDisplay.text = "X: 0  Y: 0";
			posDisplay.fontSize = 16;
			((Graphic)posDisplay).color = Color.white;
			posDisplay.font = (SkongMinimapPlugin.UseFallbackFont.Value ? SkongMinimapPlugin.fallbackFont : SkongMinimapPlugin.silksongFont);
			SkongMinimapPlugin.UpdatePosDisplayDebug();
		}

		public void UpdateUseOutline()
		{
			if ((Object)(object)outlineImage != (Object)null)
			{
				((Behaviour)outlineImage).enabled = useOutline;
			}
		}

		public void UpdateShape()
		{
			if ((Object)(object)viewportImage != (Object)null)
			{
				if (shape == MinimapShape.Square)
				{
					viewportImage.sprite = squareFillSprite;
					UpdateOutlineSprite();
					UpdateFrameSprite();
				}
				else
				{
					viewportImage.sprite = circleFillSprite;
					UpdateOutlineSprite();
					UpdateFrameSprite();
				}
			}
		}

		public void ChangeOutlineType(MinimapOutline outlineType)
		{
			this.outlineType = outlineType;
		}

		public void ChangeShowBG(bool value)
		{
			showBG = value;
		}

		public void UpdateShowBG()
		{
			if (Object.op_Implicit((Object)(object)mask))
			{
				mask.showMaskGraphic = showBG;
			}
		}

		public void ChangeZoom(float mult)
		{
			currentZoomMult = mult;
		}

		public void ChangeOpacity(float value)
		{
			currentOpacity = value;
		}

		public void UpdateZoom()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: 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_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_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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_00ec: Unknown result type (might be due to invalid IL or missing references)
			if (!Object.op_Implicit((Object)(object)mapRect))
			{
				return;
			}
			mapRect.sizeDelta = Vector2.one * (currentZoomMult * 8000f);
			foreach (RectTransform key in markerPosPairs.Keys)
			{
				key.anchoredPosition = WorldToMinimapPos(markerPosPairs[key]);
			}
			if (Object.op_Implicit((Object)(object)cocoonRect) && cocoonPos != Vector2.zero)
			{
				cocoonRect.anchoredPosition = WorldToMinimapPos(cocoonPos);
			}
			foreach (RectTransform key2 in benchPosPairs.Keys)
			{
				key2.anchoredPosition = WorldToMinimapPos(benchPosPairs[key2]);
			}
		}

		public void UpdateOpacity()
		{
			if (Object.op_Implicit((Object)(object)minimapCG))
			{
				minimapCG.alpha = currentOpacity;
			}
		}

		public void InitFullMap()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: 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_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)
			GameObject val = new GameObject("Full Map");
			Object.DontDestroyOnLoad((Object)(object)val);
			val.transform.SetParent(((Component)this).transform);
			mapImage = val.AddComponent<RawImage>();
			((MaskableGraphic)mapImage).maskable = true;
			mapRect = ((Graphic)mapImage).rectTransform;
			mapRect.anchorMin = new Vector2(0.5f, 0.5f);
			mapRect.anchorMax = new Vector2(0.5f, 0.5f);
			mapRect.pivot = new Vector2(0.5f, 0.5f);
			mapRect.sizeDelta = new Vector2(1600f, 1600f);
			mapRect.anchoredPosition = Vector2.zero;
			((Graphic)mapImage).color = Color.black;
			SkongMinimapPlugin.Log.LogInfo((object)"Map viewport initiated");
			UpdateZoom();
			SkongMinimapPlugin.UpdateAreaNameValue();
		}

		public void InitPlayerIcon()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or mi