Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MiniMapModRebalance v3.4.7
BepInEx/plugins/MiniMapModRebalance/MiniMapLibrary.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using BepInEx.Configuration; using Microsoft.CodeAnalysis; using MiniMapLibrary.Config; using MiniMapLibrary.Helpers; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace 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<KeyboardShortcut> _MiniMapKey; private static IConfigEntry<KeyboardShortcut> _MinimapIncreaseScaleKey; private static IConfigEntry<KeyboardShortcut> _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 KeyboardShortcut MinimapKey => _MiniMapKey.Value; public static KeyboardShortcut MinimapIncreaseScaleKey => _MinimapIncreaseScaleKey.Value; public static KeyboardShortcut MinimapDecreaseScaleKey => _MinimapDecreaseScaleKey.Value; public static IConfigEntry<LogLevel> ApplicationLogLevelEntry => _logLevel; public static IConfigEntry<float> MinimapZoomScaleEntry => _minimapScale; public static IConfigEntry<KeyboardShortcut> MinimapToggleKeyEntry => _MiniMapKey; public static IConfigEntry<KeyboardShortcut> MinimapZoomInKeyEntry => _MinimapIncreaseScaleKey; public static IConfigEntry<KeyboardShortcut> MinimapZoomOutKeyEntry => _MinimapDecreaseScaleKey; static Settings() { //IL_0046: 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_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) 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: 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_0047: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: 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_01df: 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_01fa: 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_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_0218: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025d: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: 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_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0346: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: 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_03dc: 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_03f2: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_042a: 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_0060: 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_0051: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (InteractibleSettings.ContainsKey(type)) { InteractibleSetting interactibleSetting = InteractibleSettings[type]; if (interactibleSetting.Config != null) { if (!active) { return interactibleSetting.Config.InactiveColor.Value; } return interactibleSetting.Config.ActiveColor.Value; } if (!active) { return interactibleSetting.InactiveColor; } return interactibleSetting.ActiveColor; } if (!active) { return DefaultInactiveColor; } return DefaultActiveColor; } public static Dimension2D GetInteractableSize(InteractableKind type) { if (InteractibleSettings.ContainsKey(type)) { InteractibleSetting interactibleSetting = InteractibleSettings[type]; if (interactibleSetting?.Config != null) { return new Dimension2D(interactibleSetting.Config.Width.Value, interactibleSetting.Config.Height.Value); } return interactibleSetting?.Dimensions ?? DefaultUIElementSize; } return DefaultUIElementSize; } public static void LoadApplicationSettings(ILogger logger, IConfig config) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_00f0: 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) 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<KeyboardShortcut>("Settings.Zoom", "UnZoomKey", new KeyboardShortcut((KeyCode)45, Array.Empty<KeyCode>()), "Zooms the minimap OUT"); _MinimapIncreaseScaleKey = config.Bind<KeyboardShortcut>("Settings.Zoom", "ZoomKey", new KeyboardShortcut((KeyCode)61, Array.Empty<KeyCode>()), "Zooms the minimap IN"); _MiniMapKey = config.Bind<KeyboardShortcut>("Settings.General", "EnableKey", new KeyboardShortcut((KeyCode)288, Array.Empty<KeyCode>()), "Key that enables or disables 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 = Resources.Load<Sprite>(Path); if ((Object)(object)val != (Object)null) { SpriteCache.Add(Path, val); } else { val = Resources.Load<Sprite>("Textures/MiscIcons/texMysteryIcon"); if ((Object)(object)val == (Object)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.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; } } } 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.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; 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; } public bool IsKind(T value) { ISettingConfigGroup config = Settings.GetSetting(Kind).Config; if (config == null || !config.Enabled.Value) { return false; } return selector?.Invoke(value) ?? 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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) if ((Object)(object)backing.MinimapTransform == (Object)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)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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) 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 InteractableKind kind, out GameObject gameObject, out Func<T, bool> 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; 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; } public void ScanScene(IList<ITrackedObject> list) { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) ISettingConfigGroup config = Settings.GetSetting(kind).Config; if (config == null || !config.Enabled.Value) { 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 ((Object)(object)_MinimapImage == (Object)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_0021: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)MinimapImage == (Object)null)) { ((Graphic)MinimapImage).color = Settings.GetColor(InteractableType, Active); PreviousActive = Active; } } } }
BepInEx/plugins/MiniMapModRebalance/MiniMapMod.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; 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 RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace 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 != null && expression(value)) { return value; } return null; } } [BepInPlugin("com.minimapmod.rebalance", "Mini Map Mod Rebalance", "3.4.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] 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; private float nextHudParentSearchTime; private readonly HashSet<int> discoveredInteractableInstanceIds = new HashSet<int>(); private ConfigEntry<bool> enableRebalanceEntry; private ConfigEntry<float> findRadiusEntry; private bool pendingSettingsRefresh; public void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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); enableRebalanceEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings.Rebalance", "EnableRebalance", false, "When enabled, interactable icons (chests, shrines, teleporter, items, etc.) stay hidden until you come within Find Radius, then remain visible for the rest of the stage. Enemies, players, minions, and neutrals are always shown."); findRadiusEntry = ((BaseUnityPlugin)this).Config.Bind<float>("Settings.Rebalance", "FindRadius", 30f, new ConfigDescription("Horizontal world distance at which hidden interactables are revealed on the minimap.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); 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(); }; ((BaseUnityPlugin)this).Config.SettingChanged += OnConfigSettingChanged; RiskOfOptionsSetup.Register(this, enableRebalanceEntry, findRadiusEntry); } private static bool IsShortcutPressed(KeyboardShortcut shortcut) { //IL_0002: 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_0024: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey == 0) { return false; } if (((KeyboardShortcut)(ref shortcut)).Modifiers != null) { foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } } return Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey); } private void OnConfigSettingChanged(object sender, SettingChangedEventArgs e) { pendingSettingsRefresh = true; } private void OnDestroy() { ((BaseUnityPlugin)this).Config.SettingChanged -= OnConfigSettingChanged; } private void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (pendingSettingsRefresh) { pendingSettingsRefresh = false; if (Enable) { logger.LogDebug((object)"Config changed. Refreshing minimap."); Reset(); } } if (IsShortcutPressed(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 (IsShortcutPressed(Settings.MinimapIncreaseScaleKey)) { Transform transform = MiniMapLibrary.Minimap.Container.transform; transform.localScale *= 1.1f; } else if (IsShortcutPressed(Settings.MinimapDecreaseScaleKey)) { Transform transform2 = MiniMapLibrary.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 static bool IsAlwaysVisibleUnderRebalance(InteractableKind kind) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 if ((int)kind == 2048 || (int)kind == 4096 || (int)kind == 8192) { return true; } if ((int)kind == 32768 || (int)kind == 16384 || (int)kind == 524288) { return true; } return false; } private void UpdateIconPositions() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) Vector3 playerPosition = GetPlayerPosition(); Vector2 val = playerPosition.ToMinimapPosition(TrackedDimensions); bool flag = enableRebalanceEntry != null && enableRebalanceEntry.Value; float num = ((findRadiusEntry != null) ? findRadiusEntry.Value : 30f); float num2 = num * num; 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; } ISettingConfigGroup val3 = Settings.GetSetting(val2.InteractableType).Config; if (val3 != null && !val3.Enabled.Value) { if ((Object)(object)val2.MinimapTransform != (Object)null) { ((Component)val2.MinimapTransform).gameObject.SetActive(false); } continue; } bool flag2 = !flag || IsAlwaysVisibleUnderRebalance(val2.InteractableType); if (!flag2) { int instanceID = ((Object)val2.gameObject).GetInstanceID(); Vector3 position = val2.gameObject.transform.position; float num3 = position.x - playerPosition.x; float num4 = position.z - playerPosition.z; if (num3 * num3 + num4 * num4 <= num2) { discoveredInteractableInstanceIds.Add(instanceID); } flag2 = discoveredInteractableInstanceIds.Contains(instanceID); } if (!flag2) { if ((Object)(object)val2.MinimapTransform != (Object)null) { ((Component)val2.MinimapTransform).gameObject.SetActive(false); } continue; } Vector2 val4 = val2.gameObject.transform.position.ToMinimapPosition(TrackedDimensions) - val; if ((Object)(object)val2.MinimapTransform == (Object)null) { val2.MinimapTransform = Minimap.CreateIcon(val2.InteractableType, new Vector3(val4.x, val4.y, 0f), SpriteManager); } else { ((Component)val2.MinimapTransform).gameObject.SetActive(true); ((Transform)val2.MinimapTransform).localPosition = new Vector3(val4.x, val4.y, 0f); ((Transform)val2.MinimapTransform).rotation = Quaternion.identity; } val2.CheckActive(); } } private static Transform FindDeepChild(Transform root, string childName) { if ((Object)(object)root == (Object)null) { return null; } if (((Object)root).name == childName) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindDeepChild(root.GetChild(i), childName); if ((Object)(object)val != (Object)null) { return val; } } return null; } private GameObject ResolveMinimapParent() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("ObjectivePanel"); if ((Object)(object)val != (Object)null) { return val; } if (Time.unscaledTime < nextHudParentSearchTime) { return null; } nextHudParentSearchTime = Time.unscaledTime + 0.25f; ObjectivePanelController[] array = Resources.FindObjectsOfTypeAll<ObjectivePanelController>(); Scene scene; foreach (ObjectivePanelController val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } GameObject gameObject = ((Component)val2).gameObject; if ((Object)(object)gameObject == (Object)null) { continue; } scene = gameObject.scene; if (((Scene)(ref scene)).IsValid() && gameObject.activeInHierarchy) { if (((Object)gameObject).name == "ObjectivePanel") { return gameObject; } Transform val3 = FindDeepChild(gameObject.transform, "ObjectivePanel"); if ((Object)(object)val3 != (Object)null) { return ((Component)val3).gameObject; } } } HUD[] array2 = Resources.FindObjectsOfTypeAll<HUD>(); foreach (HUD val4 in array2) { if ((Object)(object)val4 == (Object)null) { continue; } scene = ((Component)val4).gameObject.scene; if (!((Scene)(ref scene)).IsValid() || !((Component)val4).gameObject.activeInHierarchy) { continue; } if ((Object)(object)val4.mainContainer != (Object)null) { Transform val5 = FindDeepChild(val4.mainContainer.transform, "ObjectivePanel"); if ((Object)(object)val5 != (Object)null) { return ((Component)val5).gameObject; } } Transform val6 = FindDeepChild(((Component)val4).transform, "ObjectivePanel"); if ((Object)(object)val6 != (Object)null) { return ((Component)val6).gameObject; } } return null; } private bool TryCreateMinimap() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) GameObject val = ResolveMinimapParent(); if ((Object)(object)val == (Object)null || SpriteManager == null) { Minimap.Destroy(); return false; } logger.LogInfo((object)"Creating Minimap object"); Minimap.CreateMinimap(SpriteManager, val.gameObject); MiniMapLibrary.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(); discoveredInteractableInstanceIds.Clear(); logger.LogDebug((object)"Clearing TrackedDimensions"); TrackedDimensions.Clear(); logger.LogDebug((object)"Destroying Minimap"); Minimap.Destroy(); dynamicScanTimer.Reset(); cooldownTimer.Reset(); ScannedStaticObjects = false; cameraRig = null; nextHudParentSearchTime = 0f; } 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) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown return (ITrackedObjectScanner)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 : notnull, MonoBehaviour { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) 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() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown return (ITrackedObjectScanner)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 : notnull, MonoBehaviour { //IL_000d: Unknown result type (might be due to invalid IL or missing references) 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 ((Object)(object)interaction == (Object)null) { return true; } return ((Behaviour)interaction).isActiveAndEnabled; } static bool PortalSelector(GenericInteraction interaction) { return (interaction?.contextToken?.Contains("PORTAL")).GetValueOrDefault(); } } private ITrackedObjectScanner CreatePurchaseInteractionScanner() { //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown return (ITrackedObjectScanner)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 : notnull, MonoBehaviour { //IL_000d: Unknown result type (might be due to invalid IL or missing references) 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 : notnull, MonoBehaviour { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) object obj2 = value; PurchaseInteraction val = (PurchaseInteraction)((obj2 is PurchaseInteraction) ? obj2 : null); if ((Object)(object)val != (Object)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 : notnull, MonoBehaviour { //IL_000d: Unknown result type (might be due to invalid IL or missing references) 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 : notnull, MonoBehaviour { //IL_0000: 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_0059: Expected O, but got Unknown return (ITrackedObjectScanner)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() { //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown return (ITrackedObjectScanner)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) => (Object)(object)x == (Object)null || ((Component)x).gameObject.activeSelf)) }), TrackedDimensions, SpriteManager, (Func<float>)(() => GetPlayerPosition().y)); static GameObject DefaultConverter<T>(T value) where T : notnull, MonoBehaviour { //IL_000d: Unknown result type (might be due to invalid IL or missing references) object obj = value; if (obj == null) { return null; } return ((Component)obj).gameObject; } static bool EnemyLunarSelector(TeamComponent team) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Object)(object)team == (Object)null) { return false; } return (int)team.teamIndex == 3; } static bool EnemyMonsterSelector(TeamComponent team) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Object)(object)team == (Object)null) { return false; } return (int)team.teamIndex == 2; } static bool EnemyVoidSelector(TeamComponent team) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Object)(object)team == (Object)null) { return false; } return (int)team.teamIndex == 4; } static bool MinionSelector(TeamComponent team) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 bool flag5 = (Object)(object)team != (Object)null && (int)team.teamIndex == 1; bool? flag6; if ((Object)(object)team == (Object)null) { flag6 = null; } else { CharacterBody component3 = ((Component)team).GetComponent<CharacterBody>(); flag6 = (((Object)(object)component3 != (Object)null) ? new bool?(component3.isPlayerControlled) : null); } bool? flag7 = flag6; if (!flag7.HasValue) { return flag5; } if (flag5) { return flag7 == false; } return false; } static bool NeutralSelector(TeamComponent team) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 if ((Object)(object)team == (Object)null) { return false; } return (int)team.teamIndex == 0; } static bool PlayerSelector(TeamComponent team) { bool? flag; if ((Object)(object)team == (Object)null) { flag = null; } else { NetworkStateMachine component = ((Component)team).GetComponent<NetworkStateMachine>(); flag = (((Object)(object)component != (Object)null) ? new bool?(((NetworkBehaviour)component).hasAuthority) : null); } bool? flag2 = flag; bool? flag3; if ((Object)(object)team == (Object)null) { flag3 = null; } else { CharacterBody component2 = ((Component)team).GetComponent<CharacterBody>(); flag3 = (((Object)(object)component2 != (Object)null) ? new bool?(component2.isPlayerControlled) : null); } bool? flag4 = flag3; if (!flag2.HasValue || !flag4.HasValue) { return false; } if (flag2 == false) { return flag4.GetValueOrDefault(); } return false; } } private Vector3 GetPlayerPosition() { //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Camera.main != (Object)null && (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"); } } if ((Object)(object)cameraRig != (Object)null) { GameObject target = cameraRig.target; if ((Object)(object)target != (Object)null && (Object)(object)target.transform != (Object)null) { return target.transform.position; } } if ((Object)(object)Camera.main != (Object)null) { return ((Component)Camera.main).transform.position; } return Vector3.zero; } 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); } } } } internal static class RiskOfOptionsSetup { internal static void Register(MiniMapPlugin plugin, ConfigEntry<bool> enableRebalance, ConfigEntry<float> findRadius) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Invalid comparison between Unknown and I4 //IL_00c4: Unknown result type (might be due to invalid IL or missing references) ModSettingsManager.SetModDescription("Minimap for Risk of Rain 2 with optional rebalance: interactable icons stay hidden until you enter Find Radius, then remain visible. Enemies, players, minions, and neutrals are always shown when rebalance is on."); TrySetModIcon(plugin); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableRebalance)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(findRadius, new StepSliderConfig { min = 1f, max = 100f, increment = 1f })); TryAddEnumChoice<LogLevel>(Settings.ApplicationLogLevelEntry); TryAddSlider(Settings.MinimapZoomScaleEntry, 0.25f, 4f); TryAddKeybind(Settings.MinimapToggleKeyEntry); TryAddKeybind(Settings.MinimapZoomInKeyEntry); TryAddKeybind(Settings.MinimapZoomOutKeyEntry); foreach (InteractableKind value2 in Enum.GetValues(typeof(InteractableKind))) { if ((int)value2 != 0 && (int)value2 != int.MaxValue && Settings.InteractibleSettings.TryGetValue(value2, out var value) && value.Config != null) { ISettingConfigGroup config = value.Config; TryAddCheckbox(config.Enabled); TryAddColor(config.ActiveColor); TryAddColor(config.InactiveColor); TryAddSlider(config.Width, 1f, 64f); TryAddSlider(config.Height, 1f, 64f); TryAddString(config.IconPath); TryAddCheckbox(config.EnabledElevationMarker); TryAddColor(config.ElevationMarkerColor); TryAddSlider(config.ElevationMarkerWidth, 1f, 32f); TryAddSlider(config.ElevationMarkerHeight, 1f, 32f); } } } private static void TrySetModIcon(MiniMapPlugin plugin) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)plugin).Info.Location) ?? "", "icon.png"); if (!File.Exists(path)) { return; } try { byte[] array = File.ReadAllBytes(path); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (ImageConversion.LoadImage(val, array)) { ModSettingsManager.SetModIcon(Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f))); } } catch (Exception) { } } private static void TryAddCheckbox(IConfigEntry<bool> wrapped) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (wrapped is ConfigEntryAdapter<bool> configEntryAdapter) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(configEntryAdapter.Entry)); } } private static void TryAddSlider(IConfigEntry<float> wrapped, float min, float max) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (wrapped is ConfigEntryAdapter<float> configEntryAdapter) { ModSettingsManager.AddOption((BaseOption)new SliderOption(configEntryAdapter.Entry, new SliderConfig { min = min, max = max })); } } private static void TryAddColor(IConfigEntry<Color> wrapped) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (wrapped is ConfigEntryAdapter<Color> configEntryAdapter) { ModSettingsManager.AddOption((BaseOption)new ColorOption(configEntryAdapter.Entry)); } } private static void TryAddString(IConfigEntry<string> wrapped) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (wrapped is ConfigEntryAdapter<string> configEntryAdapter) { ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(configEntryAdapter.Entry)); } } private static void TryAddEnumChoice<T>(IConfigEntry<T> wrapped) where T : struct, Enum { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (wrapped is ConfigEntryAdapter<T> configEntryAdapter) { ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)configEntryAdapter.Entry)); } } private static void TryAddKeybind(IConfigEntry<KeyboardShortcut> wrapped) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown if (wrapped is ConfigEntryAdapter<KeyboardShortcut> configEntryAdapter) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(configEntryAdapter.Entry)); } } } } 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 (IConfigEntry<T>)(object)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 ConfigEntry<T> Entry => entry; public ConfigEntryAdapter(ConfigEntry<T> entry) { this.entry = entry; } } } 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_0041: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_006a: Expected O, but got Unknown 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)component, (Transform)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_0014: 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) Dimension2D interactableSize = Settings.GetInteractableSize(type); GameObject obj = Sprites.CreateIcon(iconTexture, interactableSize.Width, interactableSize.Height, Settings.GetColor(type, true)); ((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; } } }