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 Minimal Map v1.5.1
plugins/MinimalMap.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace MinimalMap; internal static class Glyphs { private const float CellSize = 0.25f; private static readonly Vector2 WhiteUV = new Vector2(0.875f, 0.125f); internal static Texture2D LoadAtlas() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown byte[] array; using (Stream stream = typeof(Glyphs).Assembly.GetManifestResourceStream("MinimalMap.MapIcons.png")) { using BinaryReader binaryReader = new BinaryReader(stream); array = binaryReader.ReadBytes((int)stream.Length); } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); if (!ImageConversion.LoadImage(val, array, false)) { Object.Destroy((Object)(object)val); throw new InvalidDataException("Could not load the embedded map icons."); } ((Object)val).name = "Minimal Map icons"; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)2; val.Apply(true, true); return val; } internal static void Background(VertexHelper mesh, Vector2 halfSize, float pixel) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0061: Unknown result type (might be due to invalid IL or missing references) Color32 color = default(Color32); ((Color32)(ref color))..ctor((byte)27, (byte)34, (byte)39, (byte)119); Color32 color2 = default(Color32); ((Color32)(ref color2))..ctor((byte)0, (byte)0, (byte)0, (byte)77); int currentVertCount = mesh.currentVertCount; PanelCorners(mesh, halfSize, 0f, new Color32(color.r, color.g, color.b, (byte)0)); PanelCorners(mesh, halfSize, 1.4f * pixel, color); PanelCorners(mesh, halfSize, 2.6f * pixel, color2); for (int i = 0; i < 2; i++) { int num = currentVertCount + i * 5; for (int j = 0; j < 5; j++) { int num2 = num + j; int num3 = num + (j + 1) % 5; mesh.AddTriangle(num2, num3, num3 + 5); mesh.AddTriangle(num2, num3 + 5, num2 + 5); } } int num4 = currentVertCount + 10; mesh.AddTriangle(num4, num4 + 1, num4 + 2); mesh.AddTriangle(num4, num4 + 2, num4 + 3); mesh.AddTriangle(num4, num4 + 3, num4 + 4); } private static void PanelCorners(VertexHelper mesh, Vector2 half, float inset, Color32 color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) half -= Vector2.one * inset; float num = 6.5f - (2f - Mathf.Sqrt(2f)) * inset; mesh.AddVert(Vector2.op_Implicit(new Vector2(0f - half.x, half.y)), color, Vector4.op_Implicit(WhiteUV)); mesh.AddVert(Vector2.op_Implicit(new Vector2(half.x - num, half.y)), color, Vector4.op_Implicit(WhiteUV)); mesh.AddVert(Vector2.op_Implicit(new Vector2(half.x, half.y - num)), color, Vector4.op_Implicit(WhiteUV)); mesh.AddVert(Vector2.op_Implicit(new Vector2(half.x, 0f - half.y)), color, Vector4.op_Implicit(WhiteUV)); mesh.AddVert(Vector2.op_Implicit(new Vector2(0f - half.x, 0f - half.y)), color, Vector4.op_Implicit(WhiteUV)); } internal static void Draw(VertexHelper mesh, Icon kind, Vector2 p, float scale) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_005e: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) float num = (float)((int)kind % 4) * 0.25f; float num2 = 1f - (float)((int)kind / 4) * 0.25f; float num3 = ((kind == Icon.Player) ? 6.7f : 7.5f) * scale; int currentVertCount = mesh.currentVertCount; mesh.AddVert(Vector2.op_Implicit(p + new Vector2(0f - num3, num3)), Color32.op_Implicit(Color.white), Vector4.op_Implicit(new Vector2(num, num2))); mesh.AddVert(Vector2.op_Implicit(p + new Vector2(num3, num3)), Color32.op_Implicit(Color.white), Vector4.op_Implicit(new Vector2(num + 0.25f, num2))); mesh.AddVert(Vector2.op_Implicit(p + new Vector2(num3, 0f - num3)), Color32.op_Implicit(Color.white), Vector4.op_Implicit(new Vector2(num + 0.25f, num2 - 0.25f))); mesh.AddVert(Vector2.op_Implicit(p + new Vector2(0f - num3, 0f - num3)), Color32.op_Implicit(Color.white), Vector4.op_Implicit(new Vector2(num, num2 - 0.25f))); mesh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); mesh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 3); } } internal sealed class MapSettings { internal readonly ConfigEntry<int> Range; internal readonly ConfigEntry<int> PanelPercent; internal readonly ConfigEntry<int> IconPercent; internal readonly ConfigEntry<bool> TabOverview; internal readonly ConfigEntry<int> TabRangePercent; internal readonly ConfigEntry<int> TabIconPercent; internal readonly ConfigEntry<bool>[] Visible; private static readonly string[] Labels = new string[8] { "Сундуки", "Святилища", "Порталы", "Телепортер босса", "Стрелка игрока", "Терминалы и сундуки с выбором", "Переработчики", "3D-принтеры" }; internal MapSettings(ConfigFile config) { Range = Integer(config, "RangeMeters", 150, 50, 600, "Дальность от центра до ближайшего края в метрах. Уменьши значение, чтобы приблизить карту."); PanelPercent = Integer(config, "PanelSizePercent", 100, 60, 150, "Размер панели относительно стандартного. Правый край закреплён под таймером."); IconPercent = Integer(config, "IconSizePercent", 100, 50, 175, "Размер значков относительно стандартного."); TabOverview = config.Bind<bool>("Map", "TabOverview", true, "Отдалять карту при открытии игровой таблицы (по умолчанию Tab)."); TabRangePercent = Integer(config, "TabRangePercent", 150, 100, 600, "Дальность обзора в процентах от обычной. При 150 м и 150% видно 225 м до ближайшего края."); TabIconPercent = Integer(config, "TabIconPercent", 75, 40, 100, "Размер значков в процентах от их обычного размера, пока открыта таблица."); Visible = new ConfigEntry<bool>[Labels.Length]; foreach (Icon value in Enum.GetValues(typeof(Icon))) { Visible[(int)value] = config.Bind<bool>("Icons", "Show" + value, true, "Показывать на карте: " + Labels[(int)value] + "."); } } private static ConfigEntry<int> Integer(ConfigFile config, string key, int value, int min, int max, string text) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown return config.Bind<int>("Map", key, value, new ConfigDescription(text, (AcceptableValueBase)(object)new AcceptableValueRange<int>(min, max), new object[0])); } internal float RangeMeters(bool overview) { if (!overview) { return Range.Value; } return (float)(Range.Value * TabRangePercent.Value) / 100f; } internal float IconScale(bool overview) { float num = (float)IconPercent.Value / 100f; if (!overview) { return num; } return num * (float)TabIconPercent.Value / 100f; } [MethodImpl(MethodImplOptions.NoInlining)] internal void RegisterMenu() { ModSettingsManager.SetModDescription("Мини-карта под шкалой сложности. Настройки применяются сразу.", "local.ror2.minimalmap", "Minimal Map"); AddSlider(Range, "Дальность обзора", "{0} м"); AddSlider(PanelPercent, "Размер карты", "{0}%"); AddSlider(IconPercent, "Размер значков", "{0}%"); AddToggle(TabOverview, "Обзор по Tab", "Обзор по Tab"); AddSlider(TabRangePercent, "Дальность при Tab", "{0}%", "Обзор по Tab"); AddSlider(TabIconPercent, "Значки при Tab", "{0}%", "Обзор по Tab"); for (int i = 0; i < Visible.Length; i++) { AddToggle(Visible[i], Labels[i], "Видимость значков"); } } private static void AddSlider(ConfigEntry<int> entry, string label, string format, string category = "Карта") { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown AcceptableValueRange<int> val = (AcceptableValueRange<int>)(object)((ConfigEntryBase)entry).Description.AcceptableValues; IntSliderConfig val2 = new IntSliderConfig(); ((BaseOptionConfig)val2).name = label; ((BaseOptionConfig)val2).category = category; ((BaseOptionConfig)val2).description = ((ConfigEntryBase)entry).Description.Description; val2.min = val.MinValue; val2.max = val.MaxValue; val2.formatString = format; IntSliderConfig val3 = val2; ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry, val3), "local.ror2.minimalmap", "Minimal Map"); } private static void AddToggle(ConfigEntry<bool> entry, string label, string category) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown CheckBoxConfig val = new CheckBoxConfig(); ((BaseOptionConfig)val).name = label; ((BaseOptionConfig)val).category = category; ((BaseOptionConfig)val).description = ((ConfigEntryBase)entry).Description.Description; CheckBoxConfig val2 = val; ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry, val2), "local.ror2.minimalmap", "Minimal Map"); } } internal enum Icon { Chest, Shrine, Portal, Teleporter, Player, Choice, Scrapper, Printer } internal struct Landmark { internal readonly Vector3 Position; internal readonly Icon Kind; internal Landmark(Component source, Icon kind) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) Position = source.transform.position; Kind = kind; } } public sealed class MapView : MaskableGraphic { private MapSettings settings; private RectTransform frame; private bool overview; private LayoutElement slotLayout; private int panelPercent; private readonly List<Landmark> landmarks = new List<Landmark>(128); private readonly HashSet<MultiShopController> markedShops = new HashSet<MultiShopController>(); private float nextScan; private Texture2D iconAtlas; internal HUD Hud { get; private set; } internal GameObject Slot { get; private set; } public override Texture mainTexture { get { if (!Object.op_Implicit((Object)(object)iconAtlas)) { return ((Graphic)this).mainTexture; } return (Texture)(object)iconAtlas; } } internal void Initialize(HUD hud, GameObject slot, RectTransform mapFrame, MapSettings mapSettings, Texture2D atlas) { //IL_001b: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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) Hud = hud; Slot = slot; frame = mapFrame; ((Graphic)this).rectTransform.anchorMin = Vector2.zero; ((Graphic)this).rectTransform.anchorMax = Vector2.one; RectTransform rectTransform = ((Graphic)this).rectTransform; Vector2 offsetMin = (((Graphic)this).rectTransform.offsetMax = Vector2.zero); rectTransform.offsetMin = offsetMin; settings = mapSettings; slotLayout = slot.GetComponent<LayoutElement>(); UpdateSize(); iconAtlas = atlas; ((Graphic)this).raycastTarget = false; ((Graphic)this).SetAllDirty(); } private void UpdateSize() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) panelPercent = settings.PanelPercent.Value; float num = (float)panelPercent / 100f; float num2 = 104f * num + 8f; if (Object.op_Implicit((Object)(object)slotLayout)) { LayoutElement obj = slotLayout; float minHeight = (slotLayout.preferredHeight = num2); obj.minHeight = minHeight; } else { ((RectTransform)Slot.transform).sizeDelta = new Vector2(0f, num2); } frame.anchorMin = new Vector2(1f - num, 0f); frame.offsetMin = new Vector2(0f, 4f); frame.offsetMax = new Vector2(0f, -4f); } internal void Remove() { if (Object.op_Implicit((Object)(object)Slot)) { Object.Destroy((Object)(object)Slot); } Object.Destroy((Object)(object)((Component)this).gameObject); } internal void UpdatePresentation() { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_0101: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) if (panelPercent != settings.PanelPercent.Value) { UpdateSize(); } bool flag = settings.TabOverview.Value && Object.op_Implicit((Object)(object)Hud.targetBodyObject) && Slot.activeSelf && Object.op_Implicit((Object)(object)Hud.scoreboardPanel) && Hud.scoreboardPanel.activeInHierarchy; if (flag != overview) { overview = flag; if (overview) { ((Transform)((Graphic)this).rectTransform).SetParent(Hud.scoreboardPanel.transform, true); RectTransform rectTransform = ((Graphic)this).rectTransform; Vector2 anchorMin = (((Graphic)this).rectTransform.anchorMax = Vector2.one * 0.5f); rectTransform.anchorMin = anchorMin; } else { ((Transform)((Graphic)this).rectTransform).SetParent((Transform)(object)frame, false); ((Transform)((Graphic)this).rectTransform).localRotation = Quaternion.identity; ((Transform)((Graphic)this).rectTransform).localScale = Vector3.one; ((Graphic)this).rectTransform.anchorMin = Vector2.zero; ((Graphic)this).rectTransform.anchorMax = Vector2.one; RectTransform rectTransform2 = ((Graphic)this).rectTransform; Vector2 offsetMin = (((Graphic)this).rectTransform.offsetMax = Vector2.zero); rectTransform2.offsetMin = offsetMin; ((Graphic)this).rectTransform.anchoredPosition3D = Vector3.zero; } } if (overview) { RectTransform rectTransform3 = ((Graphic)this).rectTransform; Rect rect = frame.rect; rectTransform3.sizeDelta = ((Rect)(ref rect)).size; ((Transform)((Graphic)this).rectTransform).SetPositionAndRotation(((Transform)frame).position, ((Transform)frame).rotation); } if (Object.op_Implicit((Object)(object)Hud.targetBodyObject) && ((Behaviour)this).isActiveAndEnabled) { if (Time.unscaledTime >= nextScan) { nextScan = Time.unscaledTime + 0.4f; Scan(Hud.targetBodyObject.GetComponent<Interactor>()); } ((Graphic)this).SetVerticesDirty(); } } private void Scan(Interactor viewer) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Invalid comparison between Unknown and I4 landmarks.Clear(); markedShops.Clear(); foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList<PurchaseInteraction>()) { if (Object.op_Implicit((Object)(object)instances) && !Object.op_Implicit((Object)(object)instances.lockGameObject)) { AddPurchase(instances); } } foreach (PickupPickerController instances2 in InstanceTracker.GetInstancesList<PickupPickerController>()) { if (Object.op_Implicit((Object)(object)instances2) && Object.op_Implicit((Object)(object)((Component)instances2).GetComponent<ScrapperController>())) { landmarks.Add(new Landmark((Component)(object)instances2, Icon.Scrapper)); } } if (Object.op_Implicit((Object)(object)viewer)) { foreach (TimedChestController instances3 in InstanceTracker.GetInstancesList<TimedChestController>()) { if (Object.op_Implicit((Object)(object)instances3) && (int)instances3.GetInteractability(viewer) == 2) { landmarks.Add(new Landmark((Component)(object)instances3, Icon.Chest)); } } } foreach (GenericInteraction instances4 in InstanceTracker.GetInstancesList<GenericInteraction>()) { if (Object.op_Implicit((Object)(object)instances4) && (int)instances4.interactability != 0) { string contextToken = instances4.contextToken; if (contextToken != null && contextToken.StartsWith("PORTAL_", StringComparison.Ordinal)) { landmarks.Add(new Landmark((Component)(object)instances4, Icon.Portal)); } } } TeleporterInteraction instance = TeleporterInteraction.instance; if (Object.op_Implicit((Object)(object)instance) && ((Behaviour)instance).isActiveAndEnabled) { landmarks.Add(new Landmark((Component)(object)instance, Icon.Teleporter)); } } private void AddPurchase(PurchaseInteraction purchase) { string contextToken = purchase.contextToken; if (contextToken == "FAN_CONTEXT") { return; } if (contextToken != null && contextToken.StartsWith("DUPLICATOR_", StringComparison.Ordinal) && Object.op_Implicit((Object)(object)((Component)purchase).GetComponent<ShopTerminalBehavior>())) { landmarks.Add(new Landmark((Component)(object)purchase, Icon.Printer)); } else { if (!purchase.available) { return; } if (contextToken == "MULTISHOP_TERMINAL_CONTEXT") { ShopTerminalBehavior component = ((Component)purchase).GetComponent<ShopTerminalBehavior>(); if (Object.op_Implicit((Object)(object)component) && !component.NetworkhasBeenPurchased) { MultiShopController val = component.serverMultiShopController; if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)component).GetComponentInParent<MultiShopController>(); } if (Object.op_Implicit((Object)(object)val) && markedShops.Add(val)) { landmarks.Add(new Landmark((Component)(object)val, Icon.Choice)); } } } else if (purchase.isShrine) { landmarks.Add(new Landmark((Component)(object)purchase, Icon.Shrine)); } else if (Object.op_Implicit((Object)(object)((Component)purchase).GetComponent<OptionChestBehavior>())) { landmarks.Add(new Landmark((Component)(object)purchase, Icon.Choice)); } else if (Object.op_Implicit((Object)(object)((Component)purchase).GetComponent<ChestBehavior>())) { landmarks.Add(new Landmark((Component)(object)purchase, Icon.Chest)); } } } protected override void OnPopulateMesh(VertexHelper mesh) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023a: 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_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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) mesh.Clear(); if (!Object.op_Implicit((Object)(object)Hud) || !Object.op_Implicit((Object)(object)Hud.targetBodyObject) || !Object.op_Implicit((Object)(object)Hud.cameraRigController) || settings == null) { return; } Camera sceneCam = Hud.cameraRigController.sceneCam; if (!Object.op_Implicit((Object)(object)sceneCam)) { return; } Vector3 position = Hud.targetBodyObject.transform.position; float num = ((Component)sceneCam).transform.eulerAngles.y * ((float)Math.PI / 180f); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(Mathf.Sin(num), Mathf.Cos(num)); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(val.y, 0f - val.x); Rect rect = ((Graphic)this).rectTransform.rect; Vector2 val3 = ((Rect)(ref rect)).size * 0.5f; float num2 = settings.IconScale(overview); Vector2 val4 = val3 - Vector2.one * (7f * num2 + 2f); if (val4.x <= 0f || val4.y <= 0f) { return; } float num3 = Mathf.Min(val4.x, val4.y) / settings.RangeMeters(overview); Canvas rootCanvas = ((Graphic)this).canvas.rootCanvas; Camera val5 = (((int)rootCanvas.renderMode == 0) ? null : Hud.cameraRigController.uiCam); Vector2 val6 = RectTransformUtility.WorldToScreenPoint(val5, ((Transform)((Graphic)this).rectTransform).position); Vector2 val7 = RectTransformUtility.WorldToScreenPoint(val5, ((Transform)((Graphic)this).rectTransform).TransformPoint(Vector3.right)); Vector2 val8 = val7 - val6; float pixel = 1f / Mathf.Clamp(((Vector2)(ref val8)).magnitude, 0.75f, 8f); Glyphs.Background(mesh, val3, pixel); Vector2 val9 = default(Vector2); foreach (Landmark landmark in landmarks) { if (!settings.Visible[(int)landmark.Kind].Value) { continue; } ((Vector2)(ref val9))..ctor(landmark.Position.x - position.x, landmark.Position.z - position.z); Vector2 val10 = new Vector2(Vector2.Dot(val9, val2), Vector2.Dot(val9, val)) * num3; float num4 = Mathf.Max(Mathf.Abs(val10.x) / val4.x, Mathf.Abs(val10.y) / val4.y); if (num4 > 1f) { if (landmark.Kind != Icon.Teleporter && landmark.Kind != Icon.Portal) { continue; } val10 /= num4; } if (mesh.currentVertCount <= 64500) { Glyphs.Draw(mesh, landmark.Kind, val10, num2); continue; } break; } if (settings.Visible[4].Value) { Glyphs.Draw(mesh, Icon.Player, Vector2.zero, num2); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("local.ror2.minimalmap", "Minimal Map", "1.5.1")] public sealed class Plugin : BaseUnityPlugin { internal const string Guid = "local.ror2.minimalmap"; internal const string Title = "Minimal Map"; internal const string OptionsGuid = "com.rune580.riskofoptions"; private readonly List<MapView> views = new List<MapView>(); private MapSettings settings; private float nextHudCheck; private Texture2D iconAtlas; private void Awake() { iconAtlas = Glyphs.LoadAtlas(); settings = new MapSettings(((BaseUnityPlugin)this).Config); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { settings.RegisterMenu(); } } private void Update() { if (Time.unscaledTime < nextHudCheck) { return; } nextHudCheck = Time.unscaledTime + 0.5f; for (int num = views.Count - 1; num >= 0; num--) { MapView mapView = views[num]; if (!Object.op_Implicit((Object)(object)mapView) || !Object.op_Implicit((Object)(object)mapView.Hud) || !Object.op_Implicit((Object)(object)mapView.Slot)) { if (Object.op_Implicit((Object)(object)mapView)) { mapView.Remove(); } views.RemoveAt(num); } else { mapView.Slot.SetActive(Object.op_Implicit((Object)(object)Run.instance) && Object.op_Implicit((Object)(object)mapView.Hud.targetBodyObject)); } } if (!Object.op_Implicit((Object)(object)Run.instance)) { return; } foreach (HUD readOnlyInstance in HUD.readOnlyInstanceList) { if (!Object.op_Implicit((Object)(object)readOnlyInstance) || !Object.op_Implicit((Object)(object)readOnlyInstance.targetBodyObject) || !Object.op_Implicit((Object)(object)readOnlyInstance.gameModeUiInstance)) { continue; } bool flag = false; foreach (MapView view in views) { if ((Object)(object)view.Hud == (Object)(object)readOnlyInstance) { flag = true; break; } } if (!flag) { MapView mapView2 = Attach(readOnlyInstance); if (Object.op_Implicit((Object)(object)mapView2)) { views.Add(mapView2); } } } } private void LateUpdate() { foreach (MapView view in views) { if (Object.op_Implicit((Object)(object)view) && Object.op_Implicit((Object)(object)view.Hud) && Object.op_Implicit((Object)(object)view.Slot)) { view.UpdatePresentation(); } } } private MapView Attach(HUD hud) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown Transform transform = hud.gameModeUiInstance.transform; Transform val = transform.Find("RightInfoBar"); VerticalLayoutGroup val2 = (Object.op_Implicit((Object)(object)val) ? ((Component)val).GetComponent<VerticalLayoutGroup>() : null); Transform val3 = val; if (!Object.op_Implicit((Object)(object)val2)) { DifficultyBarController componentInChildren = ((Component)transform).GetComponentInChildren<DifficultyBarController>(true); val3 = (Object.op_Implicit((Object)(object)componentInChildren) ? ((Component)componentInChildren).transform : hud.gameModeUiRoot); } if (!Object.op_Implicit((Object)(object)val3)) { return null; } GameObject val4 = new GameObject("MinimalMapSlot", new Type[1] { typeof(RectTransform) }); val4.layer = ((Component)val3).gameObject.layer; RectTransform val5 = (RectTransform)val4.transform; ((Transform)val5).SetParent(val3, false); if (Object.op_Implicit((Object)(object)val2)) { val4.AddComponent<LayoutElement>(); ((Transform)val5).SetAsFirstSibling(); } else { val5.anchorMin = Vector2.zero; val5.anchorMax = new Vector2(1f, 0f); val5.pivot = new Vector2(0.5f, 1f); val5.anchoredPosition = Vector2.zero; } GameObject val6 = new GameObject("MinimalMapFrame", new Type[1] { typeof(RectTransform) }); val6.layer = val4.layer; RectTransform val7 = (RectTransform)val6.transform; ((Transform)val7).SetParent((Transform)(object)val5, false); val7.anchorMin = Vector2.zero; val7.anchorMax = Vector2.one; val7.pivot = Vector2.one * 0.5f; val7.offsetMin = new Vector2(0f, 4f); val7.offsetMax = new Vector2(0f, -4f); GameObject val8 = new GameObject("MinimalMap", new Type[2] { typeof(RectTransform), typeof(CanvasRenderer) }); val8.layer = val4.layer; val8.transform.SetParent((Transform)(object)val7, false); MapView mapView = val8.AddComponent<MapView>(); mapView.Initialize(hud, val4, val7, settings, iconAtlas); return mapView; } private void OnDestroy() { foreach (MapView view in views) { if (Object.op_Implicit((Object)(object)view)) { view.Remove(); } } if (Object.op_Implicit((Object)(object)iconAtlas)) { Object.Destroy((Object)(object)iconAtlas); } } }