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+84ec4fe7941fe2c76bf6d9715baf403e6b1b2989")] [assembly: AssemblyProduct("MiniMapLibrary")] [assembly: AssemblyTitle("MiniMapLibrary")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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 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? 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, NewtAltar = 1048576, 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 const string Lunar = "Textures/MiscIcons/texShrineIconOutlined"; } 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; private static IConfigEntry _minimapScale; private static IConfigEntry _MiniMapKey; private static IConfigEntry _MinimapIncreaseScaleKey; private static IConfigEntry _MinimapDecreaseScaleKey; private static ILogger logger; public static Dimension2D MinimapSize { get; set; } public static Dimension2D ViewfinderSize { get; set; } public static IDictionary 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(); 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: 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_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: 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_0275: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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_0297: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: 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_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: 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_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0436: 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.NewtAltar, -1f, -1f, default(Color), default(Color), "Newt Altar", "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("Settings.Zoom", "UnZoomKey", (KeyCode)45, "Zooms the minimap OUT"); _MinimapIncreaseScaleKey = config.Bind("Settings.Zoom", "ZoomKey", (KeyCode)61, "Zooms the minimap IN"); _MiniMapKey = config.Bind("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 enabled = config.Bind(section, "enabled", defaultValue: true, "Whether or not " + interactibleSetting.Description + " should be shown on the minimap"); IConfigEntry configEntry = config.Bind(section, "activeColor", interactibleSetting.ActiveColor, "The color the icon should be when it has not been interacted with"); IConfigEntry configEntry2 = config.Bind(section, "inactiveColor", interactibleSetting.InactiveColor, "The color the icon should be when it has used/bought"); IConfigEntry configEntry3 = config.Bind(section, "width", interactibleSetting.Dimensions.Width, "Width of the icon"); IConfigEntry configEntry4 = config.Bind(section, "height", interactibleSetting.Dimensions.Height, "Width of the icon"); IConfigEntry configEntry5 = config.Bind(section, "icon", interactibleSetting.IconPath ?? "Textures/MiscIcons/texMysteryIcon", "The streaming assets path of the icon"); IConfigEntry configEntry6 = config.Bind(section, "elevationMarkerEnabled", defaultValue: true, "Whether or not the elevation marker for this icon should be shown on the minimap"); IConfigEntry configEntry7 = config.Bind(section, "elevationMarkerColor", interactibleSetting.ElevationMarkerColor, "The color the elevation marker should be when it is shown"); IConfigEntry configEntry8 = config.Bind(section, "elevationMarkerWidth", interactibleSetting.ElevationMarkerDimensions.Width, "Width of the elevation marker icon"); IConfigEntry configEntry9 = config.Bind(section, "elevationMarkerHeight", interactibleSetting.ElevationMarkerDimensions.Height, "Width of the elevation marker icon"); IConfigEntry configEntry10 = config.Bind(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 SpriteCache = new Dictionary(); 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(Path); if ((Object)(object)val != (Object)null) { SpriteCache.Add(Path, val); } else { val = LegacyResourcesAPI.Load("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 : ISorter { private readonly Func? selector; private readonly Func converter; private readonly Func? activeChecker; private readonly bool enabled; public InteractableKind Kind { get; set; } public DefaultSorter(InteractableKind kind, Func converter, Func? selector = null, Func? 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 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 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 { bool TrySort(T objectToBeSorted, out InteractableKind kind, out GameObject gameObject, out Func activeChecker); } public interface IScanner { IEnumerable Scan(); } public interface ISorter { 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 list); } public class MonoBehaviorScanner : IScanner where T : MonoBehaviour { private readonly ILogger logger; public MonoBehaviorScanner(ILogger logger) { this.logger = logger; this.logger.LogDebug("Created MonoBehaviorScanner<" + typeof(T).FullName + ">"); } public IEnumerable Scan() { IEnumerable 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(); } } public class MonoBehaviourSorter : IInteractibleSorter { private readonly ISorter[] sorters; public MonoBehaviourSorter(ISorter[] sorters) { this.sorters = sorters; } public bool TrySort(T value, out InteractableKind kind, out GameObject? gameObject, out Func activeChecker) { kind = InteractableKind.none; gameObject = null; activeChecker = (T x) => true; ISorter[] array = sorters; foreach (ISorter sorter in array) { if (sorter.IsKind(value)) { kind = sorter.Kind; gameObject = sorter.GetGameObject(value); activeChecker = sorter.CheckActive; return true; } } return false; } } public class MultiKindScanner : ITrackedObjectScanner { private readonly IScanner scanner; private readonly IInteractibleSorter sorter; private readonly bool dynamic; private readonly Range3D range; private readonly ISpriteManager spriteManager; private readonly Func playerHeightRetriever; public MultiKindScanner(bool dynamic, IScanner scanner, IInteractibleSorter sorter, Range3D range, ISpriteManager spriteManager, Func playerHeightRetriever) { this.scanner = scanner; this.sorter = sorter; this.dynamic = dynamic; this.range = range; this.spriteManager = spriteManager; this.playerHeightRetriever = playerHeightRetriever; } public void ScanScene(IList 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(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 : ITrackedObjectScanner where T : MonoBehaviour { private readonly IScanner scanner; private readonly bool dynamic; private readonly Func activeChecker; private readonly Func converter; private readonly Func selector; private readonly InteractableKind kind; private readonly Range3D range; private readonly ISpriteManager spriteManager; private readonly Func playerHeightRetriver; private readonly bool enabled; public SingleKindScanner(InteractableKind kind, bool dynamic, IScanner scanner, Range3D range, ISpriteManager spriteManager, Func playerHeightRetriever, Func converter, Func? activeChecker = null, Func? 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 x) => true)); this.selector = selector ?? ((Func)((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 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(kind, converter(item), null) { BackingObject = item, ActiveChecker = activeChecker, DynamicObject = dynamic }, spriteManager, playerHeightRetriver)); range.CheckValue(val.transform.position); } } } } public class TagScanner : IScanner { private readonly string targetTag; private readonly ILogger logger; public TagScanner(InteractableKind kind, bool dynamic, string tag, ILogger logger, Func? selector = null, Func? activeChecker = null) { targetTag = tag; this.logger = logger; logger.LogDebug("Created TagScanner for tag " + tag); } public IEnumerable Scan() { IEnumerable 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(); } } public class TrackedObject : 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(); } return _MinimapImage; } set { _MinimapImage = value; } } public InteractableKind InteractableType { get; set; } public Func 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().sizeDelta = new Vector2(width, height); val.AddComponent(); Image obj = val.AddComponent(); 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 Bind(string section, string key, T defaultValue, string description); } public interface IConfigEntry { T Value { get; } } public interface ISettingConfigGroup { IConfigEntry Enabled { get; } IConfigEntry EnabledElevationMarker { get; } IConfigEntry ElevationMarkerOffset { get; } IConfigEntry ElevationMarkerHeight { get; } IConfigEntry ElevationMarkerWidth { get; } IConfigEntry ElevationMarkerColor { get; } IConfigEntry Height { get; } IConfigEntry Width { get; } IConfigEntry ActiveColor { get; } IConfigEntry InactiveColor { get; } IConfigEntry IconPath { get; } } public class SettingConfigGroup : ISettingConfigGroup { public IConfigEntry Enabled { get; } public IConfigEntry Height { get; } public IConfigEntry Width { get; } public IConfigEntry ActiveColor { get; } public IConfigEntry InactiveColor { get; } public IConfigEntry IconPath { get; } public IConfigEntry EnabledElevationMarker { get; } public IConfigEntry ElevationMarkerOffset { get; } public IConfigEntry ElevationMarkerHeight { get; } public IConfigEntry ElevationMarkerWidth { get; } public IConfigEntry ElevationMarkerColor { get; } public SettingConfigGroup(IConfigEntry enabled, IConfigEntry height, IConfigEntry width, IConfigEntry activeColor, IConfigEntry inactiveColor, IConfigEntry iconPath) { Enabled = enabled; Height = height; Width = width; ActiveColor = activeColor; InactiveColor = inactiveColor; IconPath = iconPath; } public SettingConfigGroup(IConfigEntry enabled, IConfigEntry height, IConfigEntry width, IConfigEntry activeColor, IConfigEntry inactiveColor, IConfigEntry iconPath, IConfigEntry enabledElevationMarker, IConfigEntry elevationMarkerOffset, IConfigEntry elevationMarkerHeight, IConfigEntry elevationMarkerWidth, IConfigEntry elevationMarkerColor) : this(enabled, height, width, activeColor, inactiveColor, iconPath) { EnabledElevationMarker = enabledElevationMarker; ElevationMarkerOffset = elevationMarkerOffset; ElevationMarkerHeight = elevationMarkerHeight; ElevationMarkerWidth = elevationMarkerWidth; ElevationMarkerColor = elevationMarkerColor; } } public class StubConfigEntry : IConfigEntry { public T Value { get; } public StubConfigEntry(T value) { Value = value; } } }