Decompiled source of MiniMapMod v3.3.3

MiniMapLibrary.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Microsoft.CodeAnalysis;
using MiniMapLibrary.Config;
using MiniMapLibrary.Helpers;
using RoR2;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MiniMapLibrary")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MiniMapLibrary")]
[assembly: AssemblyTitle("MiniMapLibrary")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MiniMapLibrary
{
	public class Dimension2D
	{
		private float _Width;

		private float _Height;

		public float Width
		{
			get
			{
				return _Width;
			}
			set
			{
				_Width = value;
				this.OnChanged?.Invoke(this);
			}
		}

		public float Height
		{
			get
			{
				return _Height;
			}
			set
			{
				_Height = value;
				this.OnChanged?.Invoke(this);
			}
		}

		public event Action<Dimension2D> OnChanged;

		public Dimension2D(float width, float height)
		{
			Width = width;
			Height = height;
		}
	}
	public class Range1D
	{
		public float Min { get; set; }

		public float Max { get; set; }

		public float Difference => Max - Min;

		public float Offset => 0f - Min;

		public void CheckValue(float value)
		{
			if (value < Min)
			{
				Min = value;
			}
			else if (value > Max)
			{
				Max = value;
			}
		}

		public void Clear()
		{
			Min = float.MaxValue;
			Max = float.MinValue;
		}
	}
	public class Range3D
	{
		public Range1D X { get; set; } = new Range1D();


		public Range1D Y { get; set; } = new Range1D();


		public Range1D Z { get; set; } = new Range1D();


		public void CheckValue(Vector3 position)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			X.CheckValue(position.x);
			Z.CheckValue(position.z);
		}

		public void Clear()
		{
			X.Clear();
			Y.Clear();
			Z.Clear();
		}
	}
	public class Timer
	{
		public float Duration { get; private set; } = 1f;


		public float Value { get; set; }

		public object? State { get; set; }

		public bool AutoReset { get; set; }

		public bool Started { get; set; } = true;


		public bool Expired => Value <= 0f;

		public event Action<object?>? OnFinished;

		public Timer(float duration, bool autoReset = true)
		{
			Duration = duration;
			AutoReset = autoReset;
		}

		public void Update(float deltaTime)
		{
			if (!Started)
			{
				return;
			}
			Value -= deltaTime;
			if (Expired)
			{
				if (AutoReset)
				{
					Reset();
				}
				else
				{
					Started = false;
				}
				this.OnFinished?.Invoke(State);
			}
		}

		public void Start()
		{
			Started = true;
		}

		public void Reset()
		{
			Value = Duration;
			Started = AutoReset;
		}

		public override string ToString()
		{
			return string.Format("{0} [{1}/{2}s] [{3}: {4}] [{5}: {6}] [{7}: {8}]", typeof(Timer).Name, Value, Duration, "AutoReset", AutoReset, "Started", Started, "Expired", Expired);
		}
	}
	public class Interactable
	{
		public string Name { get; set; }

		public bool Enabled { get; set; } = true;


		public InteractableKind InteractableType { get; set; }

		public Interactable(string name, InteractableKind type)
		{
			Name = name;
			InteractableType = type;
		}
	}
	public enum InteractableKind
	{
		none = 0,
		Chest = 1,
		Utility = 2,
		Shrine = 4,
		Special = 8,
		Drone = 16,
		Barrel = 32,
		Printer = 64,
		LunarPod = 128,
		Shop = 256,
		Equipment = 512,
		Teleporter = 1024,
		EnemyMonster = 2048,
		EnemyLunar = 4096,
		EnemyVoid = 8192,
		Minion = 16384,
		Player = 32768,
		Item = 65536,
		Portal = 131072,
		Totem = 262144,
		Neutral = 524288,
		All = int.MaxValue
	}
	public class InteractibleSetting
	{
		public ISettingConfigGroup Config;

		public Dimension2D Dimensions { get; set; }

		public Color ActiveColor { get; set; }

		public Color InactiveColor { get; set; }

		public string Description { get; set; }

		public string IconPath { get; set; }

		public Dimension2D ElevationMarkerOffset { get; set; }

		public Dimension2D ElevationMarkerDimensions { get; set; }

		public bool ElevationMarkerEnabled { get; set; }

		public Color ElevationMarkerColor { get; set; }
	}
	public interface ILogger
	{
		void LogDebug(object data);

		void LogError(object data);

		void LogFatal(object data);

		void LogInfo(object data);

		void LogMessage(object data);

		void LogWarning(object data);

		void LogException(Exception head, string message = "");
	}
	public interface ISpriteManager : IDisposable
	{
		Sprite GetOrCache(string Path);

		Sprite GetSprite(InteractableKind type);
	}
	public enum LogLevel
	{
		none,
		info,
		debug,
		all
	}
	public static class Settings
	{
		public static class Icons
		{
			public const string Default = "Textures/MiscIcons/texMysteryIcon";

			public const string LootBag = "Textures/MiscIcons/texLootIconOutlined";

			public const string Chest = "Textures/MiscIcons/texInventoryIconOutlined";

			public const string Circle = "Textures/MiscIcons/texBarrelIcon";

			public const string Shrine = "Textures/MiscIcons/texShrineIconOutlined";

			public const string Boss = "Textures/MiscIcons/texTeleporterIconOutlined";

			public const string Drone = "Textures/MiscIcons/texDroneIconOutlined";

			public const string Cross = "Textures/MiscIcons/texCriticallyHurtIcon";

			public const string Lock = "Textures/MiscIcons/texUnlockIcon";

			public const string Dice = "Textures/MiscIcons/texRuleMapIsRandom";

			public const string Cube = "Textures/MiscIcons/texLunarPillarIcon";

			public const string Wrench = "Textures/MiscIcons/texWIPIcon";

			public const string Attack = "Textures/MiscIcons/texAttackIcon";

			public const string Sprint = "Textures/MiscIcons/texSprintIcon";

			public const string Arrow = "Textures/MiscIcons/texOptionsArrowLeft";

			public const string Pencil = "Textures/MiscIcons/texEditIcon";

			public const string Portal = "Textures/MiscIcons/texQuickplay";
		}

		public static class Colors
		{
			public static Color Yellow = new Color(1f, 73f / 85f, 0.34509805f);

			public static Color Purple = new Color(0.47843137f, 0.4117647f, 0.95686275f);

			public static Color DarkPurple = new Color(0.29803923f, 0.20784314f, 0.95686275f);

			public static Color Teal = new Color(0.36862746f, 0.69803923f, 0.9490196f);

			public static Color Pink = new Color(0.6745098f, 19f / 51f, 81f / 85f);

			public static Color DarkPink = new Color(0.57254905f, 13f / 85f, 81f / 85f);

			public static Color Orange = new Color(1f, 0.57254905f, 0f);

			public static Color DarkTeal = new Color(0.36862746f, 0.69803923f, 0.9490196f);
		}

		private static readonly Dimension2D DefaultUIElementSize;

		private static IConfigEntry<LogLevel> _logLevel;

		private static IConfigEntry<float> _minimapScale;

		private static IConfigEntry<KeyCode> _MiniMapKey;

		private static IConfigEntry<KeyCode> _MinimapIncreaseScaleKey;

		private static IConfigEntry<KeyCode> _MinimapDecreaseScaleKey;

		private static ILogger logger;

		public static Dimension2D MinimapSize { get; set; }

		public static Dimension2D ViewfinderSize { get; set; }

		public static IDictionary<InteractableKind, InteractibleSetting> InteractibleSettings { get; }

		public static Color PlayerIconColor { get; set; }

		public static Color DefaultActiveColor { get; set; }

		public static Color DefaultInactiveColor { get; set; }

		public static Color DefaultElevationMarkerColor { get; set; }

		public static Dimension2D DefaultElevationSize { get; set; }

		public static LogLevel LogLevel => _logLevel.Value;

		public static float MinimapScale => _minimapScale.Value;

		public static KeyCode MinimapKey => _MiniMapKey.Value;

		public static KeyCode MinimapIncreaseScaleKey => _MinimapIncreaseScaleKey.Value;

		public static KeyCode MinimapDecreaseScaleKey => _MinimapDecreaseScaleKey.Value;

		static Settings()
		{
			//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_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			MinimapSize = new Dimension2D(100f, 100f);
			ViewfinderSize = new Dimension2D(10f, 100f);
			InteractibleSettings = new Dictionary<InteractableKind, InteractibleSetting>();
			DefaultUIElementSize = new Dimension2D(10f, 10f);
			PlayerIconColor = Color.white;
			DefaultActiveColor = Colors.Yellow;
			DefaultInactiveColor = Color.grey;
			DefaultElevationMarkerColor = Color.white;
			DefaultElevationSize = new Dimension2D(3f, 3f);
			InitializeDefaultSettings();
		}

		private static void InitializeDefaultSettings()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: 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_00b8: 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_00cb: 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_00e4: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: 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_011c: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_0195: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: 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_01f4: 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_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0220: Unknown result type (might be due to invalid IL or missing references)
			//IL_0223: Unknown result type (might be due to invalid IL or missing references)
			//IL_0229: Unknown result type (might be due to invalid IL or missing references)
			//IL_0236: 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_0251: 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_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0264: Unknown result type (might be due to invalid IL or missing references)
			//IL_026f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0284: Unknown result type (might be due to invalid IL or missing references)
			//IL_0289: Unknown result type (might be due to invalid IL or missing references)
			//IL_028e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0308: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0333: Unknown result type (might be due to invalid IL or missing references)
			//IL_0339: Unknown result type (might be due to invalid IL or missing references)
			//IL_034e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0353: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			Add(InteractableKind.Chest, 8f, 6f, default(Color), default(Color), "Chests, Roulette Chests", "Textures/MiscIcons/texInventoryIconOutlined");
			Add(InteractableKind.Shop, 7f, 5f, Colors.Teal, default(Color), "Shops", "Textures/MiscIcons/texInventoryIconOutlined");
			Add(InteractableKind.Equipment, 8f, 6f, Colors.Orange, default(Color), "Equipment Barrels", "Textures/MiscIcons/texInventoryIconOutlined");
			Add(InteractableKind.Printer, 10f, 8f, Colors.Purple, default(Color), "Printers", "Textures/MiscIcons/texInventoryIconOutlined");
			Add(InteractableKind.Utility, 5f, 5f, default(Color), default(Color), "Scrappers", "Textures/MiscIcons/texWIPIcon");
			Add(InteractableKind.LunarPod, 7f, 7f, Color.cyan, default(Color), "Lunar pods (chests)", "Textures/MiscIcons/texLootIconOutlined");
			Add(InteractableKind.Shrine, -1f, -1f, default(Color), default(Color), "All shrines (excluding Newt)", "Textures/MiscIcons/texShrineIconOutlined");
			Add(InteractableKind.Teleporter, 15f, 15f, Color.white, Color.green, "Boss teleporters", "Textures/MiscIcons/texTeleporterIconOutlined");
			Add(InteractableKind.Barrel, 3f, 3f, default(Color), default(Color), "Barrels", "Textures/MiscIcons/texBarrelIcon");
			Add(InteractableKind.Drone, 7f, 7f, default(Color), default(Color), "Drones", "Textures/MiscIcons/texDroneIconOutlined");
			Add(InteractableKind.Special, 5f, 5f, default(Color), default(Color), "Special interactibles such as the landing pod and fans");
			Color red = Color.red;
			Color red2 = Color.red;
			Add(InteractableKind.EnemyMonster, 3f, 3f, red, default(Color), "Enemies", "Textures/MiscIcons/texBarrelIcon", red2);
			Color red3 = Color.red;
			red2 = Color.red;
			Add(InteractableKind.EnemyLunar, 3f, 3f, red3, default(Color), "Lunar enemies", "Textures/MiscIcons/texBarrelIcon", red2);
			Color magenta = Color.magenta;
			red2 = Color.magenta;
			Add(InteractableKind.EnemyVoid, 12f, 12f, magenta, default(Color), "Void touched enemies", "Textures/MiscIcons/texAttackIcon", red2);
			Color green = Color.green;
			red2 = Color.green;
			Add(InteractableKind.Minion, 3f, 3f, green, default(Color), "Minions", "Textures/MiscIcons/texBarrelIcon", red2);
			Add(InteractableKind.Player, 8f, 8f, PlayerIconColor, PlayerIconColor, "Player, including friends", "Textures/MiscIcons/texSprintIcon");
			Add(InteractableKind.Item, 3f, 3f, Colors.Teal, Color.cyan, "Dropped items and lunar coins", "Textures/MiscIcons/texBarrelIcon");
			Add(InteractableKind.Portal, 7f, 7f, DefaultActiveColor, DefaultInactiveColor, "Portal markers, or objects that spawn portals when interacted with (excluding newt altar)", "Textures/MiscIcons/texQuickplay");
			Add(InteractableKind.Totem, 7f, 7f, Colors.DarkTeal, DefaultInactiveColor, "Totems, or totem adjacent objects", "Textures/MiscIcons/texLunarPillarIcon");
			Add(InteractableKind.Neutral, 4f, 4f, Color.white, DefaultInactiveColor, "Neutral objects or NPCs", "Textures/MiscIcons/texBarrelIcon");
			static void Add(InteractableKind type, float width = -1f, float height = -1f, Color activeColor = default(Color), Color inactiveColor = default(Color), string description = "", string path = "Textures/MiscIcons/texMysteryIcon", Color elevationMarkerColor = default(Color))
			{
				//IL_0000: 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_0009: 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_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0019: Unknown result type (might be due to invalid IL or missing references)
				//IL_001b: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: 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_002d: 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_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_004e: Unknown result type (might be due to invalid IL or missing references)
				//IL_004a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Unknown result type (might be due to invalid IL or missing references)
				//IL_0079: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				activeColor = ((activeColor == default(Color)) ? DefaultActiveColor : activeColor);
				inactiveColor = ((inactiveColor == default(Color)) ? DefaultInactiveColor : inactiveColor);
				elevationMarkerColor = ((elevationMarkerColor == default(Color)) ? DefaultElevationMarkerColor : elevationMarkerColor);
				Dimension2D dimension2D = DefaultUIElementSize;
				if (width != -1f || height != -1f)
				{
					dimension2D = new Dimension2D(width, height);
				}
				InteractibleSetting interactibleSetting = new InteractibleSetting
				{
					ActiveColor = activeColor,
					InactiveColor = inactiveColor,
					Dimensions = dimension2D
				};
				interactibleSetting.Description = description;
				interactibleSetting.IconPath = path;
				interactibleSetting.ElevationMarkerColor = elevationMarkerColor;
				interactibleSetting.ElevationMarkerEnabled = true;
				interactibleSetting.ElevationMarkerDimensions = new Dimension2D(DefaultElevationSize.Width, DefaultElevationSize.Height);
				interactibleSetting.ElevationMarkerOffset = new Dimension2D(dimension2D.Width / 2f + DefaultElevationSize.Width / 2f, dimension2D.Height / 2f + DefaultElevationSize.Height / 2f);
				InteractibleSettings.Add(type, interactibleSetting);
			}
		}

		public static InteractibleSetting GetSetting(InteractableKind type)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if (InteractibleSettings.ContainsKey(type))
			{
				return InteractibleSettings[type];
			}
			return new InteractibleSetting
			{
				Dimensions = DefaultUIElementSize,
				ActiveColor = DefaultActiveColor,
				InactiveColor = DefaultInactiveColor,
				Description = "NO_DESCRIPTION",
				IconPath = "Textures/MiscIcons/texMysteryIcon"
			};
		}

		public static Color GetColor(InteractableKind type, bool active)
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (InteractibleSettings.ContainsKey(type))
			{
				InteractibleSetting interactibleSetting = InteractibleSettings[type];
				if (!active)
				{
					return interactibleSetting.InactiveColor;
				}
				return interactibleSetting.ActiveColor;
			}
			if (!active)
			{
				return DefaultInactiveColor;
			}
			return DefaultActiveColor;
		}

		public static Dimension2D GetInteractableSize(InteractableKind type)
		{
			if (InteractibleSettings.ContainsKey(type))
			{
				return InteractibleSettings[type]?.Dimensions ?? DefaultUIElementSize;
			}
			return DefaultUIElementSize;
		}

		public static void LoadApplicationSettings(ILogger logger, IConfig config)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			Settings.logger = logger;
			_logLevel = config.Bind("Settings.General", "LogLevel", LogLevel.info, "The amount of information that the minimap mod should output to the console during runtime");
			_MinimapDecreaseScaleKey = config.Bind<KeyCode>("Settings.Zoom", "UnZoomKey", (KeyCode)45, "Zooms the minimap OUT");
			_MinimapIncreaseScaleKey = config.Bind<KeyCode>("Settings.Zoom", "ZoomKey", (KeyCode)61, "Zooms the minimap IN");
			_MiniMapKey = config.Bind<KeyCode>("Settings.General", "EnableKey", (KeyCode)109, "Key that enables or disabled the minimap");
			_minimapScale = config.Bind("Settings.Zoom", "zoomLevel", 1f, "How far the minimap should be zoomed in");
			logger.LogDebug($"Loaded log level: {LogLevel} Minimap[Key: {MinimapKey}] Zoom[{MinimapScale * 100f}% UnZoomKey:{MinimapDecreaseScaleKey} ZoomKey:{MinimapIncreaseScaleKey}]");
		}

		public static void LoadConfigEntries(InteractableKind type, IConfig config)
		{
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: Unknown result type (might be due to invalid IL or missing references)
			//IL_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0226: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_029f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			if (!InteractibleSettings.ContainsKey(type))
			{
				logger.LogError($"Failed to find an interactible setting for {type}, aborting config loading for {type}s");
				return;
			}
			InteractibleSetting interactibleSetting = InteractibleSettings[type];
			string section = $"Icon.{type}";
			IConfigEntry<bool> enabled = config.Bind(section, "enabled", defaultValue: true, "Whether or not " + interactibleSetting.Description + " should be shown on the minimap");
			IConfigEntry<Color> configEntry = config.Bind<Color>(section, "activeColor", interactibleSetting.ActiveColor, "The color the icon should be when it has not been interacted with");
			IConfigEntry<Color> configEntry2 = config.Bind<Color>(section, "inactiveColor", interactibleSetting.InactiveColor, "The color the icon should be when it has used/bought");
			IConfigEntry<float> configEntry3 = config.Bind(section, "width", interactibleSetting.Dimensions.Width, "Width of the icon");
			IConfigEntry<float> configEntry4 = config.Bind(section, "height", interactibleSetting.Dimensions.Height, "Width of the icon");
			IConfigEntry<string> configEntry5 = config.Bind(section, "icon", interactibleSetting.IconPath ?? "Textures/MiscIcons/texMysteryIcon", "The streaming assets path of the icon");
			IConfigEntry<bool> configEntry6 = config.Bind(section, "elevationMarkerEnabled", defaultValue: true, "Whether or not the elevation marker for this icon should be shown on the minimap");
			IConfigEntry<Color> configEntry7 = config.Bind<Color>(section, "elevationMarkerColor", interactibleSetting.ElevationMarkerColor, "The color the elevation marker should be when it is shown");
			IConfigEntry<float> configEntry8 = config.Bind(section, "elevationMarkerWidth", interactibleSetting.ElevationMarkerDimensions.Width, "Width of the elevation marker icon");
			IConfigEntry<float> configEntry9 = config.Bind(section, "elevationMarkerHeight", interactibleSetting.ElevationMarkerDimensions.Height, "Width of the elevation marker  icon");
			IConfigEntry<Vector2> configEntry10 = config.Bind<Vector2>(section, "elevationMarkerOffset", new Vector2(interactibleSetting.ElevationMarkerOffset.Width, interactibleSetting.ElevationMarkerOffset.Height), "The value of the x and y of the elevation marker's position relative to the main icon's center");
			interactibleSetting.Config = new SettingConfigGroup(enabled, configEntry4, configEntry3, configEntry, configEntry2, configEntry5, configEntry6, configEntry10, configEntry9, configEntry8, configEntry7);
			interactibleSetting.ActiveColor = configEntry.Value;
			interactibleSetting.InactiveColor = configEntry2.Value;
			interactibleSetting.Dimensions.Height = configEntry4.Value;
			interactibleSetting.Dimensions.Width = configEntry3.Value;
			interactibleSetting.IconPath = configEntry5.Value;
			interactibleSetting.ElevationMarkerColor = configEntry7.Value;
			interactibleSetting.ElevationMarkerEnabled = configEntry6.Value;
			interactibleSetting.ElevationMarkerOffset = new Dimension2D(configEntry10.Value.x, configEntry10.Value.y);
			interactibleSetting.ElevationMarkerDimensions = new Dimension2D(configEntry8.Value, configEntry9.Value);
			logger.LogInfo(string.Format("Loaded {0} config [{1}, {2}, {3}, ({4}x{5})] Elevation [{6}, {7}, dimensions: ({8}x{9}), offset: ({10}x{11})]", type, interactibleSetting.Config.Enabled.Value ? "enabled" : "disabled", interactibleSetting.ActiveColor, interactibleSetting.InactiveColor, interactibleSetting.Dimensions.Width, interactibleSetting.Dimensions.Height, interactibleSetting.Config.EnabledElevationMarker.Value ? "enabled" : "disabled", interactibleSetting.ElevationMarkerColor, interactibleSetting.ElevationMarkerDimensions.Width, interactibleSetting.ElevationMarkerDimensions.Height, interactibleSetting.ElevationMarkerOffset.Width, interactibleSetting.ElevationMarkerOffset.Height));
		}
	}
	public sealed class SpriteManager : IDisposable, ISpriteManager
	{
		private readonly Dictionary<string, Sprite> SpriteCache = new Dictionary<string, Sprite>();

		private readonly ILogger logger;

		public SpriteManager(ILogger logger)
		{
			this.logger = logger;
		}

		public void Dispose()
		{
			SpriteCache.Clear();
		}

		public Sprite? GetSprite(InteractableKind type)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			if (type == InteractableKind.none)
			{
				return null;
			}
			string text = Settings.GetSetting(type)?.Config?.IconPath?.Value;
			if (text != null)
			{
				return GetOrCache(text);
			}
			throw new MissingComponentException($"MissingTextureException: Interactible.{type} does not have a registered texture path to load.");
		}

		public Sprite? GetOrCache(string Path)
		{
			if (SpriteCache.ContainsKey(Path))
			{
				return SpriteCache[Path];
			}
			Sprite val = LegacyResourcesAPI.Load<Sprite>(Path);
			if ((Object)(object)val != (Object)null)
			{
				SpriteCache.Add(Path, val);
			}
			else
			{
				val = LegacyResourcesAPI.Load<Sprite>("Textures/MiscIcons/texMysteryIcon");
				if (val == null)
				{
					logger.LogError("Attempted to use default icon for non-existen texture at " + Path + " but default icon path of Textures/MiscIcons/texMysteryIcon also failed to load from the streaming assets path.");
					return null;
				}
				logger.LogWarning("Attempted to load icon texture at streaming asset path: " + Path + ", but it was not found, using default [?] instead.");
				SpriteCache.Add(Path, val);
			}
			return val;
		}
	}
}
namespace MiniMapLibrary.Scanner
{
	public class DefaultSorter<T> : ISorter<T>
	{
		private readonly Func<T, bool>? selector;

		private readonly Func<T, GameObject> converter;

		private readonly Func<T, bool>? activeChecker;

		private readonly bool enabled;

		public InteractableKind Kind { get; set; }

		public DefaultSorter(InteractableKind kind, Func<T, GameObject> converter, Func<T, bool>? selector = null, Func<T, bool>? activeChecker = null)
		{
			Kind = kind;
			this.selector = selector;
			this.converter = converter;
			this.activeChecker = activeChecker;
			enabled = Settings.GetSetting(kind).Config.Enabled.Value;
		}

		public bool IsKind(T value)
		{
			if (enabled)
			{
				return selector?.Invoke(value) ?? false;
			}
			return false;
		}

		public GameObject GetGameObject(T value)
		{
			return converter(value);
		}

		public bool CheckActive(T value)
		{
			return activeChecker?.Invoke(value) ?? true;
		}
	}
	public class ElevationTrackedObject : ITrackedObject
	{
		private const float margin = 5f;

		private readonly ITrackedObject backing;

		private readonly ISpriteManager spriteManager;

		private readonly Func<float> heightRetriever;

		private static readonly Quaternion upDirection;

		private static readonly Quaternion downDirection;

		private Transform arrowTransform;

		private GameObject arrow;

		private bool flag_initialized;

		private bool flag_disabled;

		public GameObject gameObject
		{
			get
			{
				return backing.gameObject;
			}
			set
			{
				backing.gameObject = value;
			}
		}

		public InteractableKind InteractableType
		{
			get
			{
				return backing.InteractableType;
			}
			set
			{
				backing.InteractableType = value;
			}
		}

		public RectTransform MinimapTransform
		{
			get
			{
				return backing.MinimapTransform;
			}
			set
			{
				backing.MinimapTransform = value;
			}
		}

		public bool DynamicObject
		{
			get
			{
				return backing.DynamicObject;
			}
			set
			{
				backing.DynamicObject = value;
			}
		}

		public bool Active => backing.Active;

		static ElevationTrackedObject()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			upDirection = Quaternion.AngleAxis(-90f, Vector3.forward);
			downDirection = Quaternion.AngleAxis(90f, Vector3.forward);
		}

		public ElevationTrackedObject(ITrackedObject backing, ISpriteManager spriteManager, Func<float> heightRetriever)
		{
			this.backing = backing;
			this.spriteManager = spriteManager;
			this.heightRetriever = heightRetriever;
		}

		private bool Initialized()
		{
			//IL_0083: 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_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			if (backing.MinimapTransform == null)
			{
				return false;
			}
			if (flag_initialized)
			{
				return true;
			}
			InteractibleSetting setting = Settings.GetSetting(backing.InteractableType);
			if (!setting.Config.EnabledElevationMarker.Value)
			{
				flag_disabled = true;
				return false;
			}
			Sprite orCache = spriteManager.GetOrCache("Textures/MiscIcons/texOptionsArrowLeft");
			arrow = Sprites.CreateIcon(orCache, setting.Config.ElevationMarkerWidth.Value, setting.Config.ElevationMarkerHeight.Value, setting.Config.ElevationMarkerColor.Value);
			Transforms.SetParent(arrow.transform, (Transform)(object)backing.MinimapTransform);
			arrowTransform = arrow.transform;
			Transform obj = arrowTransform;
			obj.localPosition += new Vector3(setting.Config.ElevationMarkerOffset.Value.x, setting.Config.ElevationMarkerOffset.Value.y, 0f);
			arrowTransform.localRotation = upDirection;
			arrow.SetActive(false);
			flag_initialized = true;
			return true;
		}

		public void CheckActive()
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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)
			backing.CheckActive();
			if (flag_disabled || !Initialized())
			{
				return;
			}
			if (backing.Active)
			{
				float num = heightRetriever();
				if (num > backing.gameObject.transform.position.y + 5f)
				{
					arrow.SetActive(true);
					arrowTransform.localRotation = downDirection;
				}
				else if (num < backing.gameObject.transform.position.y - 5f)
				{
					arrow.SetActive(true);
					arrowTransform.localRotation = upDirection;
				}
				else
				{
					arrow.SetActive(false);
				}
			}
			else if (arrow.activeSelf)
			{
				arrow.SetActive(false);
			}
		}

		public void Destroy()
		{
			backing.Destroy();
		}
	}
	public interface IInteractibleSorter<T>
	{
		bool TrySort(T objectToBeSorted, out InteractableKind kind, out GameObject gameObject, out Func<T, bool> activeChecker);
	}
	public interface IScanner<T>
	{
		IEnumerable<T> Scan();
	}
	public interface ISorter<T>
	{
		InteractableKind Kind { get; }

		bool IsKind(T value);

		GameObject GetGameObject(T value);

		bool CheckActive(T value);
	}
	public interface ITrackedObject
	{
		GameObject gameObject { get; set; }

		InteractableKind InteractableType { get; set; }

		RectTransform MinimapTransform { get; set; }

		bool DynamicObject { get; set; }

		bool Active { get; }

		void CheckActive();

		void Destroy();
	}
	public interface ITrackedObjectScanner
	{
		void ScanScene(IList<ITrackedObject> list);
	}
	public class MonoBehaviorScanner<T> : IScanner<T> where T : MonoBehaviour
	{
		private readonly ILogger logger;

		public MonoBehaviorScanner(ILogger logger)
		{
			this.logger = logger;
			this.logger.LogDebug("Created MonoBehaviorScanner<" + typeof(T).FullName + ">");
		}

		public IEnumerable<T> Scan()
		{
			IEnumerable<T> enumerable = Object.FindObjectsOfType(typeof(T))?.Select((Object x) => (T)(object)x);
			if (enumerable == null)
			{
				logger.LogDebug("Failed to find any objects with type " + typeof(T).FullName + "s");
			}
			else
			{
				logger.LogDebug($"Found {enumerable.Count()} objects with type {typeof(T).FullName}s");
			}
			return enumerable ?? new List<T>();
		}
	}
	public class MonoBehaviourSorter<T> : IInteractibleSorter<T>
	{
		private readonly ISorter<T>[] sorters;

		public MonoBehaviourSorter(ISorter<T>[] sorters)
		{
			this.sorters = sorters;
		}

		public bool TrySort(T value, out InteractableKind kind, out GameObject? gameObject, out Func<T, bool> activeChecker)
		{
			kind = InteractableKind.none;
			gameObject = null;
			activeChecker = (T x) => true;
			ISorter<T>[] array = sorters;
			foreach (ISorter<T> sorter in array)
			{
				if (sorter.IsKind(value))
				{
					kind = sorter.Kind;
					gameObject = sorter.GetGameObject(value);
					activeChecker = sorter.CheckActive;
					return true;
				}
			}
			return false;
		}
	}
	public class MultiKindScanner<T> : ITrackedObjectScanner
	{
		private readonly IScanner<T> scanner;

		private readonly IInteractibleSorter<T> sorter;

		private readonly bool dynamic;

		private readonly Range3D range;

		private readonly ISpriteManager spriteManager;

		private readonly Func<float> playerHeightRetriever;

		public MultiKindScanner(bool dynamic, IScanner<T> scanner, IInteractibleSorter<T> sorter, Range3D range, ISpriteManager spriteManager, Func<float> playerHeightRetriever)
		{
			this.scanner = scanner;
			this.sorter = sorter;
			this.dynamic = dynamic;
			this.range = range;
			this.spriteManager = spriteManager;
			this.playerHeightRetriever = playerHeightRetriever;
		}

		public void ScanScene(IList<ITrackedObject> list)
		{
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			foreach (T item in scanner.Scan())
			{
				if (sorter.TrySort(item, out var kind, out var gameObject, out var activeChecker))
				{
					list.Add(new ElevationTrackedObject(new TrackedObject<T>(kind, gameObject, null)
					{
						BackingObject = item,
						ActiveChecker = activeChecker,
						DynamicObject = dynamic
					}, spriteManager, playerHeightRetriever));
					range.CheckValue(gameObject.transform.position);
				}
			}
		}
	}
	public enum ScanType
	{
		none,
		MonoBehavior,
		Tag
	}
	public class SingleKindScanner<T> : ITrackedObjectScanner where T : MonoBehaviour
	{
		private readonly IScanner<T> scanner;

		private readonly bool dynamic;

		private readonly Func<T, bool> activeChecker;

		private readonly Func<T, GameObject> converter;

		private readonly Func<T, bool> selector;

		private readonly InteractableKind kind;

		private readonly Range3D range;

		private readonly ISpriteManager spriteManager;

		private readonly Func<float> playerHeightRetriver;

		private readonly bool enabled;

		public SingleKindScanner(InteractableKind kind, bool dynamic, IScanner<T> scanner, Range3D range, ISpriteManager spriteManager, Func<float> playerHeightRetriever, Func<T, GameObject> converter, Func<T, bool>? activeChecker = null, Func<T, bool>? selector = null)
		{
			this.scanner = scanner ?? throw new ArgumentNullException("scanner");
			this.dynamic = dynamic;
			this.kind = kind;
			this.converter = converter ?? throw new ArgumentNullException("converter");
			this.activeChecker = activeChecker ?? ((Func<T, bool>)((T x) => true));
			this.selector = selector ?? ((Func<T, bool>)((T x) => true));
			this.range = range ?? throw new ArgumentNullException("range");
			this.spriteManager = spriteManager ?? throw new ArgumentNullException("spriteManager");
			playerHeightRetriver = playerHeightRetriever;
			enabled = Settings.GetSetting(kind).Config.Enabled.Value;
		}

		public void ScanScene(IList<ITrackedObject> list)
		{
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			if (!enabled)
			{
				return;
			}
			foreach (T item in scanner.Scan())
			{
				if (selector(item))
				{
					GameObject val = converter(item);
					list.Add(new ElevationTrackedObject(new TrackedObject<T>(kind, converter(item), null)
					{
						BackingObject = item,
						ActiveChecker = activeChecker,
						DynamicObject = dynamic
					}, spriteManager, playerHeightRetriver));
					range.CheckValue(val.transform.position);
				}
			}
		}
	}
	public class TagScanner : IScanner<GameObject>
	{
		private readonly string targetTag;

		private readonly ILogger logger;

		public TagScanner(InteractableKind kind, bool dynamic, string tag, ILogger logger, Func<GameObject, bool>? selector = null, Func<GameObject, bool>? activeChecker = null)
		{
			targetTag = tag;
			this.logger = logger;
			logger.LogDebug("Created TagScanner for tag " + tag);
		}

		public IEnumerable<GameObject> Scan()
		{
			IEnumerable<GameObject> enumerable = GameObject.FindGameObjectsWithTag(targetTag);
			if (enumerable == null)
			{
				logger.LogDebug("Failed to find any objects with tag " + targetTag);
			}
			else
			{
				logger.LogDebug($"Found {enumerable.Count()} objects with tag {targetTag}");
			}
			return enumerable ?? new List<GameObject>();
		}
	}
	public class TrackedObject<T> : ITrackedObject
	{
		private Image _MinimapImage;

		private bool PreviousActive = true;

		public GameObject gameObject { get; set; }

		public RectTransform MinimapTransform { get; set; }

		public bool DynamicObject { get; set; }

		public T BackingObject { get; set; }

		public Image MinimapImage
		{
			get
			{
				if (_MinimapImage == null && (Object)(object)MinimapTransform != (Object)null)
				{
					_MinimapImage = ((Component)MinimapTransform).GetComponent<Image>();
				}
				return _MinimapImage;
			}
			set
			{
				_MinimapImage = value;
			}
		}

		public InteractableKind InteractableType { get; set; }

		public Func<T, bool> ActiveChecker { get; set; }

		public bool Active { get; private set; } = true;


		public TrackedObject(InteractableKind interactableType, GameObject gameObject, RectTransform minimapTransform)
		{
			this.gameObject = gameObject;
			MinimapTransform = minimapTransform;
			InteractableType = interactableType;
		}

		public void Destroy()
		{
			try
			{
				Object.Destroy((Object)(object)((Component)MinimapTransform).gameObject);
			}
			catch (Exception)
			{
			}
		}

		public void CheckActive()
		{
			if (BackingObject == null)
			{
				Active = false;
				UpdateColor();
				return;
			}
			try
			{
				Active = ActiveChecker?.Invoke(BackingObject) ?? false;
			}
			catch (Exception)
			{
				Active = false;
			}
			UpdateColor();
		}

		private void UpdateColor()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (PreviousActive != Active)
			{
				PreviousActive = Active;
				((Graphic)MinimapImage).color = Settings.GetColor(InteractableType, Active);
			}
		}
	}
}
namespace MiniMapLibrary.Helpers
{
	public static class Sprites
	{
		public static GameObject CreateIcon(Sprite sprite, float width, float height, Color color)
		{
			//IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Expected O, but got Unknown
			GameObject val = new GameObject();
			val.AddComponent<RectTransform>().sizeDelta = new Vector2(width, height);
			val.AddComponent<CanvasRenderer>();
			Image obj = val.AddComponent<Image>();
			obj.sprite = sprite;
			((Graphic)obj).color = color;
			return val;
		}
	}
	public static class Transforms
	{
		public static void SetParent(Transform child, Transform parent)
		{
			//IL_0012: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			((Component)child).transform.SetParent(parent);
			((Component)child).transform.localRotation = Quaternion.identity;
			((Component)child).transform.localPosition = new Vector3(0f, 0f, 0f);
			((Component)child).transform.localScale = new Vector3(1f, 1f, 1f);
		}
	}
}
namespace MiniMapLibrary.Config
{
	public interface IConfig
	{
		IConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description);
	}
	public interface IConfigEntry<T>
	{
		T Value { get; }
	}
	public interface ISettingConfigGroup
	{
		IConfigEntry<bool> Enabled { get; }

		IConfigEntry<bool> EnabledElevationMarker { get; }

		IConfigEntry<Vector2> ElevationMarkerOffset { get; }

		IConfigEntry<float> ElevationMarkerHeight { get; }

		IConfigEntry<float> ElevationMarkerWidth { get; }

		IConfigEntry<Color> ElevationMarkerColor { get; }

		IConfigEntry<float> Height { get; }

		IConfigEntry<float> Width { get; }

		IConfigEntry<Color> ActiveColor { get; }

		IConfigEntry<Color> InactiveColor { get; }

		IConfigEntry<string> IconPath { get; }
	}
	public class SettingConfigGroup : ISettingConfigGroup
	{
		public IConfigEntry<bool> Enabled { get; }

		public IConfigEntry<float> Height { get; }

		public IConfigEntry<float> Width { get; }

		public IConfigEntry<Color> ActiveColor { get; }

		public IConfigEntry<Color> InactiveColor { get; }

		public IConfigEntry<string> IconPath { get; }

		public IConfigEntry<bool> EnabledElevationMarker { get; }

		public IConfigEntry<Vector2> ElevationMarkerOffset { get; }

		public IConfigEntry<float> ElevationMarkerHeight { get; }

		public IConfigEntry<float> ElevationMarkerWidth { get; }

		public IConfigEntry<Color> ElevationMarkerColor { get; }

		public SettingConfigGroup(IConfigEntry<bool> enabled, IConfigEntry<float> height, IConfigEntry<float> width, IConfigEntry<Color> activeColor, IConfigEntry<Color> inactiveColor, IConfigEntry<string> iconPath)
		{
			Enabled = enabled;
			Height = height;
			Width = width;
			ActiveColor = activeColor;
			InactiveColor = inactiveColor;
			IconPath = iconPath;
		}

		public SettingConfigGroup(IConfigEntry<bool> enabled, IConfigEntry<float> height, IConfigEntry<float> width, IConfigEntry<Color> activeColor, IConfigEntry<Color> inactiveColor, IConfigEntry<string> iconPath, IConfigEntry<bool> enabledElevationMarker, IConfigEntry<Vector2> elevationMarkerOffset, IConfigEntry<float> elevationMarkerHeight, IConfigEntry<float> elevationMarkerWidth, IConfigEntry<Color> elevationMarkerColor)
			: this(enabled, height, width, activeColor, inactiveColor, iconPath)
		{
			EnabledElevationMarker = enabledElevationMarker;
			ElevationMarkerOffset = elevationMarkerOffset;
			ElevationMarkerHeight = elevationMarkerHeight;
			ElevationMarkerWidth = elevationMarkerWidth;
			ElevationMarkerColor = elevationMarkerColor;
		}
	}
	public class StubConfigEntry<T> : IConfigEntry<T>
	{
		public T Value { get; }

		public StubConfigEntry(T value)
		{
			Value = value;
		}
	}
}

MiniMapMod.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using MiniMapLibrary;
using MiniMapLibrary.Config;
using MiniMapLibrary.Helpers;
using MiniMapLibrary.Scanner;
using MiniMapMod.Adapters;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("MiniMapMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MiniMapMod")]
[assembly: AssemblyTitle("MiniMapMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace MiniMapLibrary
{
	public class Minimap
	{
		private readonly ILogger Logger;

		private RectTransform ContainerTransform;

		public static GameObject gameObject { get; private set; }

		public static GameObject Container { get; private set; }

		public bool Created { get; private set; }

		public Minimap(ILogger logger)
		{
			Logger = logger;
		}

		public void CreateMinimap(ISpriteManager spriteManager, GameObject Parent)
		{
			if (!Created)
			{
				Created = true;
				gameObject = CreateMask();
				SetParent(gameObject, Parent);
				gameObject.transform.SetAsFirstSibling();
				CreateIconContainer();
				CreatePlayerIcon(spriteManager);
			}
		}

		public void Destroy()
		{
			if (Created)
			{
				Logger.LogDebug((object)"Destroying minimap gameobject");
				Object.Destroy((Object)(object)gameObject);
				gameObject = null;
				Container = null;
				ContainerTransform = null;
				Created = false;
			}
		}

		public void DestroyIcons()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			foreach (Transform item in Container.transform)
			{
				Object.Destroy((Object)(object)((Component)item).gameObject);
			}
		}

		public void SetRotation(Quaternion rotation)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: 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)
			Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
			((Transform)ContainerTransform).localRotation = Quaternion.Euler(0f, 0f, eulerAngles.y);
		}

		public RectTransform CreateIcon(InteractableKind type, Vector3 minimapPosition, ISpriteManager spriteManager)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Expected O, but got Unknown
			//IL_0016: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			Sprite sprite;
			try
			{
				sprite = spriteManager.GetSprite(type);
			}
			catch (MissingComponentException val)
			{
				MissingComponentException val2 = val;
				Logger.LogError((object)$"Failed to get sprite for type {type}");
				Logger.LogError((object)((Exception)(object)val2).Message);
				return null;
			}
			RectTransform component = CreateIcon(type, sprite).GetComponent<RectTransform>();
			((Transform)component).localPosition = minimapPosition;
			Transforms.SetParent((Transform)(object)component, (Transform)(object)ContainerTransform);
			return component;
		}

		private void CreateIconContainer()
		{
			GameObject val = Create(delegate(GameObject obj)
			{
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				((Object)obj).name = "icon_container";
				ContainerTransform = obj.AddComponent<RectTransform>();
				ContainerTransform.sizeDelta = new Vector2(Settings.MinimapSize.Width, Settings.MinimapSize.Height);
			});
			SetParent(val, gameObject);
			Container = val;
		}

		private void CreatePlayerIcon(ISpriteManager spriteManager)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = CreateIcon((InteractableKind)32768, spriteManager.GetSprite((InteractableKind)32768));
			((Graphic)val.GetComponent<Image>()).color = Settings.PlayerIconColor;
			SetParent(val, gameObject);
		}

		private GameObject CreateIcon(InteractableKind type, Sprite iconTexture)
		{
			//IL_0000: 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)
			InteractibleSetting setting = Settings.GetSetting(type);
			GameObject obj = Sprites.CreateIcon(iconTexture, setting.Dimensions.Width, setting.Dimensions.Height, setting.ActiveColor);
			((Object)obj).name = ((object)(InteractableKind)(ref type)).ToString();
			return obj;
		}

		private GameObject CreateMask()
		{
			return Create(delegate(GameObject mask)
			{
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				((Object)mask).name = "Minimap";
				mask.AddComponent<RectTransform>().sizeDelta = new Vector2(Settings.ViewfinderSize.Width, Settings.ViewfinderSize.Height);
				mask.AddComponent<CanvasRenderer>();
				mask.AddComponent<Image>();
				mask.AddComponent<Mask>().showMaskGraphic = false;
				LayoutElement obj = mask.AddComponent<LayoutElement>();
				obj.minHeight = Settings.MinimapSize.Height;
				obj.flexibleHeight = 0f;
			});
		}

		private GameObject SetParent(GameObject child, GameObject parent)
		{
			Transforms.SetParent(child.transform, parent.transform);
			return child;
		}

		private GameObject Create(Action<GameObject> Expression)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Expected O, but got Unknown
			GameObject val = new GameObject();
			Expression(val);
			return val;
		}
	}
}
namespace MiniMapMod
{
	public class Log : ILogger
	{
		private readonly ManualLogSource _logSource;

		public Log(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		public void LogDebug(object data)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			if ((int)Settings.LogLevel > 1)
			{
				_logSource.LogDebug(data);
			}
		}

		public void LogError(object data)
		{
			_logSource.LogError(data);
		}

		public void LogFatal(object data)
		{
			_logSource.LogFatal(data);
		}

		public void LogInfo(object data)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Invalid comparison between Unknown and I4
			if ((int)Settings.LogLevel > 0)
			{
				_logSource.LogDebug(data);
			}
		}

		public void LogMessage(object data)
		{
			_logSource.LogMessage(data);
		}

		public void LogWarning(object data)
		{
			_logSource.LogWarning(data);
		}

		public void LogException(Exception head, string message = "")
		{
			LogError(message);
			while (head != null)
			{
				LogError("\t" + head.Message);
				LogError("\t" + head.StackTrace);
				if (head.InnerException != null)
				{
					head = head.InnerException;
				}
			}
		}
	}
	public static class MinimapExtensions
	{
		public static Vector2 ToMinimapPosition(this Vector3 position, Range3D dimensions)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			float x = position.x;
			float z = position.z;
			float num = x + dimensions.X.Offset;
			z += dimensions.Z.Offset;
			float num2 = num / dimensions.X.Difference;
			z /= dimensions.Z.Difference;
			return new Vector2(num2 * Settings.MinimapSize.Width, z * Settings.MinimapSize.Height);
		}

		public static T? Check<T>(this T value, Func<T, bool> expression) where T : class
		{
			if (expression?.Invoke(value) ?? false)
			{
				return value;
			}
			return null;
		}
	}
	[BepInPlugin("MiniMap", "Mini Map Mod", "3.3.2")]
	public class MiniMapPlugin : BaseUnityPlugin
	{
		private ISpriteManager SpriteManager;

		private readonly List<ITrackedObject> TrackedObjects = new List<ITrackedObject>();

		private Minimap Minimap;

		private readonly Range3D TrackedDimensions = new Range3D();

		private bool Enable = true;

		private bool ScannedStaticObjects;

		private IConfig config;

		private ILogger logger;

		private ITrackedObjectScanner[] staticScanners;

		private ITrackedObjectScanner[] dynamicScanners;

		private readonly Timer dynamicScanTimer = new Timer(5f, true);

		private readonly Timer cooldownTimer = new Timer(2f, false)
		{
			Value = -1f
		};

		private CameraRigController cameraRig;

		public void Awake()
		{
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Expected O, but got Unknown
			logger = (ILogger)(object)new Log(((BaseUnityPlugin)this).Logger);
			SpriteManager = (ISpriteManager)new SpriteManager(logger);
			Minimap = new Minimap(logger);
			config = (IConfig)(object)new ConfigAdapter(((BaseUnityPlugin)this).Config);
			Settings.LoadApplicationSettings(logger, config);
			InteractableKind[] array = (from InteractableKind x in Enum.GetValues(typeof(InteractableKind))
				where (int)x != 0 && (int)x != int.MaxValue
				select x).ToArray();
			for (int i = 0; i < array.Length; i++)
			{
				Settings.LoadConfigEntries(array[i], config);
			}
			logger.LogInfo((object)"Creating scene scan hooks");
			CreateStaticScanners();
			CreateDynamicScanners();
			GlobalEventManager.onCharacterDeathGlobal += delegate
			{
				ScanScene();
			};
			GlobalEventManager.OnInteractionsGlobal += delegate
			{
				ScanScene();
			};
			dynamicScanTimer.OnFinished += delegate
			{
				ScanScene();
			};
		}

		private void Update()
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(Settings.MinimapKey))
			{
				Enable = !Enable;
				if (!Enable)
				{
					logger.LogInfo((object)"Resetting minimap");
					Reset();
					return;
				}
			}
			cooldownTimer.Update(Time.deltaTime);
			dynamicScanTimer.Update(Time.deltaTime);
			if (!Enable)
			{
				return;
			}
			if ((Object)(object)Camera.main == (Object)null)
			{
				logger.LogDebug((object)"Main camera was null, resetting minimap");
				Reset();
				return;
			}
			if (Minimap.Created)
			{
				try
				{
					Minimap.SetRotation(((Component)Camera.main).transform.rotation);
					UpdateIconPositions();
					if (Input.GetKeyDown(Settings.MinimapIncreaseScaleKey))
					{
						Transform transform = Minimap.Container.transform;
						transform.localScale *= 1.1f;
					}
					else if (Input.GetKeyDown(Settings.MinimapDecreaseScaleKey))
					{
						Transform transform2 = Minimap.Container.transform;
						transform2.localScale *= 0.9f;
					}
					return;
				}
				catch (NullReferenceException)
				{
					logger.LogDebug((object)"NullReferenceException was encountered while updating positions, reseting minimap");
					Reset();
					return;
				}
			}
			if (TryCreateMinimap())
			{
				TrackedDimensions.Clear();
				ScanScene();
			}
		}

		private void UpdateIconPositions()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = GetPlayerPosition().ToMinimapPosition(TrackedDimensions);
			for (int i = 0; i < TrackedObjects.Count; i++)
			{
				ITrackedObject val2 = TrackedObjects[i];
				if ((Object)(object)val2.gameObject == (Object)null)
				{
					TrackedObjects.RemoveAt(i);
					if ((Object)(object)val2.MinimapTransform != (Object)null)
					{
						Object.Destroy((Object)(object)((Component)val2.MinimapTransform).gameObject);
					}
					continue;
				}
				Vector2 val3 = val2.gameObject.transform.position.ToMinimapPosition(TrackedDimensions) - val;
				if ((Object)(object)val2.MinimapTransform == (Object)null)
				{
					val2.MinimapTransform = Minimap.CreateIcon(val2.InteractableType, Vector2.op_Implicit(val3), SpriteManager);
				}
				else
				{
					((Transform)val2.MinimapTransform).localPosition = Vector2.op_Implicit(val3);
					((Transform)val2.MinimapTransform).rotation = Quaternion.identity;
				}
				val2.CheckActive();
			}
		}

		private bool TryCreateMinimap()
		{
			//IL_005a: 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)
			GameObject val = GameObject.Find("ObjectivePanel");
			if ((Object)(object)val == (Object)null || SpriteManager == null)
			{
				Minimap.Destroy();
				return false;
			}
			logger.LogInfo((object)"Creating Minimap object");
			Minimap.CreateMinimap(SpriteManager, val.gameObject);
			Minimap.Container.transform.localScale = Vector3.one * Settings.MinimapScale;
			logger.LogInfo((object)"Finished creating Minimap");
			return true;
		}

		private void Reset()
		{
			logger.LogDebug((object)"Clearing TrackedObjects");
			TrackedObjects.Clear();
			logger.LogDebug((object)"Clearing TrackedDimensions");
			TrackedDimensions.Clear();
			logger.LogDebug((object)"Destroying Minimap");
			Minimap.Destroy();
			dynamicScanTimer.Reset();
			cooldownTimer.Reset();
			ScannedStaticObjects = false;
			cameraRig = null;
		}

		private void ScanScene()
		{
			if (!Enable)
			{
				return;
			}
			try
			{
				if (!cooldownTimer.Started)
				{
					cooldownTimer.Start();
				}
				else if (!cooldownTimer.Expired)
				{
					return;
				}
				cooldownTimer.Reset();
				cooldownTimer.Start();
				logger.LogDebug((object)"Scanning Scene");
				logger.LogDebug((object)"Clearing dynamically tracked objects");
				ClearDynamicTrackedObjects();
				logger.LogDebug((object)"Scanning static types");
				ScanStaticTypes();
				logger.LogDebug((object)"Scanning dynamic types");
				ScanDynamicTypes();
			}
			catch (Exception ex)
			{
				logger.LogException(ex, "Fatal exception within minimap");
			}
		}

		private ITrackedObjectScanner CreateChestScanner(Func<ChestBehavior, bool> activeChecker)
		{
			return (ITrackedObjectScanner)(object)new MultiKindScanner<ChestBehavior>(false, (IScanner<ChestBehavior>)(object)new MonoBehaviorScanner<ChestBehavior>(logger), (IInteractibleSorter<ChestBehavior>)(object)new MonoBehaviourSorter<ChestBehavior>(new ISorter<ChestBehavior>[2]
			{
				(ISorter<ChestBehavior>)(object)new DefaultSorter<ChestBehavior>((InteractableKind)1, (Func<ChestBehavior, GameObject>)((ChestBehavior x) => ((Component)x).gameObject), (Func<ChestBehavior, bool>)ChestSelector, activeChecker),
				(ISorter<ChestBehavior>)(object)new DefaultSorter<ChestBehavior>((InteractableKind)128, (Func<ChestBehavior, GameObject>)((ChestBehavior x) => ((Component)x).gameObject), (Func<ChestBehavior, bool>)LunarPodSelector, activeChecker)
			}), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y));
			bool ChestSelector(ChestBehavior chest)
			{
				if (TryGetPurchaseToken<ChestBehavior>(chest, out var out_token3))
				{
					if (out_token3.Contains("CHEST") && out_token3 != "LUNAR_CHEST_CONTEXT")
					{
						return !out_token3.Contains("STEALTH");
					}
					return false;
				}
				return false;
			}
			bool LunarPodSelector(ChestBehavior chest)
			{
				if (TryGetPurchaseToken<ChestBehavior>(chest, out var out_token2))
				{
					return out_token2 == "LUNAR_CHEST_CONTEXT";
				}
				return false;
			}
			bool TryGetPurchaseToken<T>(T value, out string out_token) where T : MonoBehaviour
			{
				object obj = value;
				string text = ((obj == null) ? null : ((Component)obj).GetComponent<PurchaseInteraction>()?.contextToken);
				if (text == null)
				{
					logger.LogDebug((object)("No PurchaseInteraction component on " + typeof(T).Name + ". GameObject.name = " + ((Object)((Component)(object)value).gameObject).name));
				}
				out_token = text;
				return text != null;
			}
		}

		private ITrackedObjectScanner CreateGenericInteractionScanner()
		{
			return (ITrackedObjectScanner)(object)new MultiKindScanner<GenericInteraction>(false, (IScanner<GenericInteraction>)(object)new MonoBehaviorScanner<GenericInteraction>(logger), (IInteractibleSorter<GenericInteraction>)(object)new MonoBehaviourSorter<GenericInteraction>(new ISorter<GenericInteraction>[2]
			{
				(ISorter<GenericInteraction>)(object)new DefaultSorter<GenericInteraction>((InteractableKind)131072, (Func<GenericInteraction, GameObject>)DefaultConverter<GenericInteraction>, (Func<GenericInteraction, bool>)PortalSelector, (Func<GenericInteraction, bool>)GenericActiveChecker),
				(ISorter<GenericInteraction>)(object)new DefaultSorter<GenericInteraction>((InteractableKind)8, (Func<GenericInteraction, GameObject>)DefaultConverter<GenericInteraction>, (Func<GenericInteraction, bool>)DefaultSelector, (Func<GenericInteraction, bool>)GenericActiveChecker)
			}), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y));
			static GameObject DefaultConverter<T>(T value) where T : MonoBehaviour
			{
				object obj = value;
				if (obj == null)
				{
					return null;
				}
				return ((Component)obj).gameObject;
			}
			static bool DefaultSelector(GenericInteraction interaction)
			{
				return true;
			}
			static bool GenericActiveChecker(GenericInteraction interaction)
			{
				if (interaction == null)
				{
					return true;
				}
				return ((Behaviour)interaction).isActiveAndEnabled;
			}
			static bool PortalSelector(GenericInteraction interaction)
			{
				return (interaction?.contextToken?.Contains("PORTAL")).GetValueOrDefault();
			}
		}

		private ITrackedObjectScanner CreatePurchaseInteractionScanner()
		{
			return (ITrackedObjectScanner)(object)new MultiKindScanner<PurchaseInteraction>(false, (IScanner<PurchaseInteraction>)(object)new MonoBehaviorScanner<PurchaseInteraction>(logger), (IInteractibleSorter<PurchaseInteraction>)(object)new MonoBehaviourSorter<PurchaseInteraction>(new ISorter<PurchaseInteraction>[6]
			{
				(ISorter<PurchaseInteraction>)(object)new DefaultSorter<PurchaseInteraction>((InteractableKind)64, (Func<PurchaseInteraction, GameObject>)DefaultConverter<PurchaseInteraction>, (Func<PurchaseInteraction, bool>)PrinterSelector, (Func<PurchaseInteraction, bool>)InteractionActiveChecker),
				(ISorter<PurchaseInteraction>)(object)new DefaultSorter<PurchaseInteraction>((InteractableKind)8, (Func<PurchaseInteraction, GameObject>)DefaultConverter<PurchaseInteraction>, (Func<PurchaseInteraction, bool>)FanSelector, (Func<PurchaseInteraction, bool>)InteractionActiveChecker),
				(ISorter<PurchaseInteraction>)(object)new DefaultSorter<PurchaseInteraction>((InteractableKind)256, (Func<PurchaseInteraction, GameObject>)DefaultConverter<PurchaseInteraction>, (Func<PurchaseInteraction, bool>)ShopSelector, (Func<PurchaseInteraction, bool>)InteractionActiveChecker),
				(ISorter<PurchaseInteraction>)(object)new DefaultSorter<PurchaseInteraction>((InteractableKind)512, (Func<PurchaseInteraction, GameObject>)DefaultConverter<PurchaseInteraction>, (Func<PurchaseInteraction, bool>)EquipmentSelector, (Func<PurchaseInteraction, bool>)InteractionActiveChecker),
				(ISorter<PurchaseInteraction>)(object)new DefaultSorter<PurchaseInteraction>((InteractableKind)131072, (Func<PurchaseInteraction, GameObject>)DefaultConverter<PurchaseInteraction>, (Func<PurchaseInteraction, bool>)GoldShoresSelector, (Func<PurchaseInteraction, bool>)InteractionActiveChecker),
				(ISorter<PurchaseInteraction>)(object)new DefaultSorter<PurchaseInteraction>((InteractableKind)262144, (Func<PurchaseInteraction, GameObject>)DefaultConverter<PurchaseInteraction>, (Func<PurchaseInteraction, bool>)GoldShoresBeaconSelector, (Func<PurchaseInteraction, bool>)GoldShoresSelector)
			}), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y));
			static GameObject DefaultConverter<T>(T value) where T : MonoBehaviour
			{
				object obj = value;
				if (obj == null)
				{
					return null;
				}
				return ((Component)obj).gameObject;
			}
			static bool EquipmentSelector(PurchaseInteraction interaction)
			{
				return (interaction?.contextToken?.Contains("EQUIPMENTBARREL")).GetValueOrDefault();
			}
			static bool FanSelector(PurchaseInteraction interaction)
			{
				return interaction?.contextToken == "FAN_CONTEXT";
			}
			static bool GoldShoresBeaconSelector(PurchaseInteraction interaction)
			{
				return (interaction?.contextToken?.Contains("TOTEM")).GetValueOrDefault();
			}
			static bool GoldShoresSelector(PurchaseInteraction interaction)
			{
				return (interaction?.contextToken?.Contains("GOLDSHORE")).GetValueOrDefault();
			}
			static bool InteractionActiveChecker(PurchaseInteraction interaction)
			{
				return interaction?.available ?? true;
			}
			static bool PrinterSelector(PurchaseInteraction interaction)
			{
				return (interaction?.contextToken?.Contains("DUPLICATOR")).GetValueOrDefault();
			}
			static bool ShopSelector(PurchaseInteraction interaction)
			{
				return (interaction?.contextToken?.Contains("TERMINAL")).GetValueOrDefault();
			}
		}

		private void CreateStaticScanners()
		{
			staticScanners = (ITrackedObjectScanner[])(object)new ITrackedObjectScanner[14]
			{
				CreateChestScanner(DefaultActiveChecker<ChestBehavior>),
				CreatePurchaseInteractionScanner(),
				CreateGenericInteractionScanner(),
				SimpleScanner<RouletteChestController>((InteractableKind)1, null, null, null),
				SimpleScanner<ShrineBloodBehavior>((InteractableKind)4, null, null, null),
				SimpleScanner<ShrineChanceBehavior>((InteractableKind)4, null, null, null),
				SimpleScanner<ShrineCombatBehavior>((InteractableKind)4, null, null, null),
				SimpleScanner<ShrineHealingBehavior>((InteractableKind)4, null, null, null),
				SimpleScanner<ShrineRestackBehavior>((InteractableKind)4, null, null, null),
				SimpleScanner<ShrineBossBehavior>((InteractableKind)4, null, null, null),
				SimpleScanner<ScrapperController>((InteractableKind)2, null, null, null),
				SimpleScanner<TeleporterInteraction>((InteractableKind)1024, (TeleporterInteraction teleporter) => (int)teleporter.activationState != 3, null, null),
				SimpleScanner<SummonMasterBehavior>((InteractableKind)16, null, null, null),
				SimpleScanner<BarrelInteraction>((InteractableKind)32, (BarrelInteraction barrel) => !barrel.Networkopened, null, null)
			};
			static bool DefaultActiveChecker<T>(T value) where T : MonoBehaviour
			{
				object obj2 = value;
				PurchaseInteraction val = (PurchaseInteraction)((obj2 is PurchaseInteraction) ? obj2 : null);
				if (val != null)
				{
					return val.available;
				}
				object obj3 = value;
				PurchaseInteraction val2 = ((obj3 != null) ? ((Component)obj3).GetComponent<PurchaseInteraction>() : null);
				if ((Object)(object)val2 != (Object)null)
				{
					return val2.available;
				}
				return true;
			}
			static GameObject DefaultConverter<T>(T value) where T : MonoBehaviour
			{
				object obj = value;
				if (obj == null)
				{
					return null;
				}
				return ((Component)obj).gameObject;
			}
			ITrackedObjectScanner SimpleScanner<T>(InteractableKind kind, Func<T, bool> activeChecker, Func<T, bool> selector, Func<T, GameObject> converter) where T : MonoBehaviour
			{
				//IL_0000: Unknown result type (might be due to invalid IL or missing references)
				return (ITrackedObjectScanner)(object)new SingleKindScanner<T>(kind, false, (IScanner<T>)(object)new MonoBehaviorScanner<T>(logger), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y), converter ?? new Func<T, GameObject>(DefaultConverter<T>), activeChecker ?? new Func<T, bool>(DefaultActiveChecker<T>), selector);
			}
		}

		private ITrackedObjectScanner CreateAliveEntityScanner()
		{
			return (ITrackedObjectScanner)(object)new MultiKindScanner<TeamComponent>(true, (IScanner<TeamComponent>)(object)new MonoBehaviorScanner<TeamComponent>(logger), (IInteractibleSorter<TeamComponent>)(object)new MonoBehaviourSorter<TeamComponent>(new ISorter<TeamComponent>[6]
			{
				(ISorter<TeamComponent>)(object)new DefaultSorter<TeamComponent>((InteractableKind)2048, (Func<TeamComponent, GameObject>)DefaultConverter<TeamComponent>, (Func<TeamComponent, bool>)EnemyMonsterSelector, (Func<TeamComponent, bool>)((TeamComponent x) => true)),
				(ISorter<TeamComponent>)(object)new DefaultSorter<TeamComponent>((InteractableKind)4096, (Func<TeamComponent, GameObject>)DefaultConverter<TeamComponent>, (Func<TeamComponent, bool>)EnemyLunarSelector, (Func<TeamComponent, bool>)((TeamComponent x) => true)),
				(ISorter<TeamComponent>)(object)new DefaultSorter<TeamComponent>((InteractableKind)8192, (Func<TeamComponent, GameObject>)DefaultConverter<TeamComponent>, (Func<TeamComponent, bool>)EnemyVoidSelector, (Func<TeamComponent, bool>)((TeamComponent x) => true)),
				(ISorter<TeamComponent>)(object)new DefaultSorter<TeamComponent>((InteractableKind)16384, (Func<TeamComponent, GameObject>)DefaultConverter<TeamComponent>, (Func<TeamComponent, bool>)MinionSelector, (Func<TeamComponent, bool>)((TeamComponent x) => true)),
				(ISorter<TeamComponent>)(object)new DefaultSorter<TeamComponent>((InteractableKind)32768, (Func<TeamComponent, GameObject>)DefaultConverter<TeamComponent>, (Func<TeamComponent, bool>)PlayerSelector, (Func<TeamComponent, bool>)((TeamComponent x) => true)),
				(ISorter<TeamComponent>)(object)new DefaultSorter<TeamComponent>((InteractableKind)524288, (Func<TeamComponent, GameObject>)DefaultConverter<TeamComponent>, (Func<TeamComponent, bool>)NeutralSelector, (Func<TeamComponent, bool>)((TeamComponent x) => x == null || ((Component)x).gameObject.activeSelf))
			}), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y));
			static GameObject DefaultConverter<T>(T value) where T : MonoBehaviour
			{
				object obj4 = value;
				if (obj4 == null)
				{
					return null;
				}
				return ((Component)obj4).gameObject;
			}
			static bool EnemyLunarSelector(TeamComponent team)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				if (team == null)
				{
					return false;
				}
				return (int)team.teamIndex == 3;
			}
			static bool EnemyMonsterSelector(TeamComponent team)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				if (team == null)
				{
					return false;
				}
				return (int)team.teamIndex == 2;
			}
			static bool EnemyVoidSelector(TeamComponent team)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				if (team == null)
				{
					return false;
				}
				return (int)team.teamIndex == 4;
			}
			static bool MinionSelector(TeamComponent team)
			{
				//IL_0007: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Invalid comparison between Unknown and I4
				bool flag3 = team != null && (int)team.teamIndex == 1;
				bool? obj3;
				if (team == null)
				{
					obj3 = null;
				}
				else
				{
					CharacterBody component3 = ((Component)team).GetComponent<CharacterBody>();
					obj3 = ((component3 != null) ? new bool?(component3.isPlayerControlled) : null);
				}
				bool? flag4 = obj3;
				if (!flag4.HasValue)
				{
					return flag3;
				}
				if (flag3)
				{
					return flag4 == false;
				}
				return false;
			}
			static bool NeutralSelector(TeamComponent team)
			{
				//IL_0006: Unknown result type (might be due to invalid IL or missing references)
				//IL_000c: Invalid comparison between Unknown and I4
				if (team == null)
				{
					return false;
				}
				return (int)team.teamIndex == 0;
			}
			static bool PlayerSelector(TeamComponent team)
			{
				bool? obj;
				if (team == null)
				{
					obj = null;
				}
				else
				{
					NetworkStateMachine component = ((Component)team).GetComponent<NetworkStateMachine>();
					obj = ((component != null) ? new bool?(((NetworkBehaviour)component).hasAuthority) : null);
				}
				bool? flag = obj;
				bool? obj2;
				if (team == null)
				{
					obj2 = null;
				}
				else
				{
					CharacterBody component2 = ((Component)team).GetComponent<CharacterBody>();
					obj2 = ((component2 != null) ? new bool?(component2.isPlayerControlled) : null);
				}
				bool? flag2 = obj2;
				if (!flag.HasValue || !flag2.HasValue)
				{
					return false;
				}
				if (flag == false)
				{
					return flag2 == true;
				}
				return false;
			}
		}

		private Vector3 GetPlayerPosition()
		{
			//IL_0074: 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_0092: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)cameraRig == (Object)null)
			{
				cameraRig = ((Component)((Component)Camera.main).transform.parent).GetComponent<CameraRigController>();
				if ((Object)(object)cameraRig == (Object)null)
				{
					logger.LogError((object)"Failed to retrieve camera rig in scene to retrieve camera position");
				}
			}
			GameObject target = cameraRig.target;
			Vector3? obj;
			if (target == null)
			{
				obj = null;
			}
			else
			{
				Transform transform = target.transform;
				obj = ((transform != null) ? new Vector3?(transform.position) : null);
			}
			return (Vector3)(((??)obj) ?? ((Component)Camera.main).transform.position);
		}

		private void CreateDynamicScanners()
		{
			dynamicScanners = (ITrackedObjectScanner[])(object)new ITrackedObjectScanner[3]
			{
				CreateAliveEntityScanner(),
				(ITrackedObjectScanner)new SingleKindScanner<GenericPickupController>((InteractableKind)65536, true, (IScanner<GenericPickupController>)(object)new MonoBehaviorScanner<GenericPickupController>(logger), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y), (Func<GenericPickupController, GameObject>)((GenericPickupController x) => ((Component)x).gameObject), (Func<GenericPickupController, bool>)((GenericPickupController x) => true), (Func<GenericPickupController, bool>)null),
				CreateGenericInteractionScanner()
			};
		}

		private void ScanStaticTypes()
		{
			if (!ScannedStaticObjects)
			{
				for (int i = 0; i < staticScanners.Length; i++)
				{
					staticScanners[i].ScanScene((IList<ITrackedObject>)TrackedObjects);
				}
				ScannedStaticObjects = true;
			}
		}

		private void ScanDynamicTypes()
		{
			for (int i = 0; i < dynamicScanners.Length; i++)
			{
				dynamicScanners[i].ScanScene((IList<ITrackedObject>)TrackedObjects);
			}
		}

		private void ClearDynamicTrackedObjects()
		{
			if (!ScannedStaticObjects)
			{
				return;
			}
			for (int i = 0; i < TrackedObjects.Count; i++)
			{
				ITrackedObject val = TrackedObjects[i];
				if (val.DynamicObject)
				{
					val.Destroy();
					TrackedObjects.RemoveAt(i);
				}
			}
		}
	}
}
namespace MiniMapMod.Adapters
{
	public class ConfigAdapter : IConfig
	{
		private readonly ConfigFile plugin;

		public ConfigAdapter(ConfigFile plugin)
		{
			this.plugin = plugin;
		}

		public IConfigEntry<T> Bind<T>(string section, string key, T defaultValue, string description)
		{
			return new ConfigEntryAdapter<T>(plugin.Bind<T>(section, key, defaultValue, description));
		}
	}
	public class ConfigEntryAdapter<T> : IConfigEntry<T>
	{
		private readonly ConfigEntry<T> entry;

		public T Value => entry.Value;

		public ConfigEntryAdapter(ConfigEntry<T> entry)
		{
			this.entry = entry;
		}
	}
}