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 PortalLines v0.8.0
plugins/PortalLines/PortalLines.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PortalLines.Core; using PortalLines.Model; using PortalLines.UI; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("PortalLines")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Draws portals and their connections on the Valheim map.")] [assembly: AssemblyFileVersion("0.8.0.0")] [assembly: AssemblyInformationalVersion("0.8.0+c081775baa1a8005500e63b491d375bbed92794e")] [assembly: AssemblyProduct("PortalLines")] [assembly: AssemblyTitle("PortalLines")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.8.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 PortalLines { [BepInPlugin("com.jumpingmushroom.portallines", "PortalLines", "0.8.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("valheim.exe")] [BepInProcess("valheim.x86_64")] public sealed class PortalLinesPlugin : BaseUnityPlugin { public const string PluginGuid = "com.jumpingmushroom.portallines"; public const string PluginName = "PortalLines"; public const string PluginVersion = "0.8.0"; private const float IdleScanInterval = 15f; internal static ManualLogSource Log; private readonly MapOverlay _overlay = new MapOverlay(); private readonly PortalPins _pins = new PortalPins(); private readonly MapToggle _toggle = new MapToggle(); private readonly PortalHover _hover = new PortalHover(); private readonly RouteInput _route = new RouteInput(); private readonly HudArrow _arrow = new HudArrow(); private Harmony _harmony; private float _nextScan; private float _nextRefresh; private float _nextSave; private bool _wasLarge; private Player _lastPlayer; private bool _hadPlayer; private bool _hadWorld; internal static bool InputBlocked() { if (Console.IsVisible()) { return true; } if (Menu.IsVisible()) { return true; } if (TextInput.IsVisible()) { return true; } if (Minimap.InTextInput()) { return true; } if ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) { return true; } return false; } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; PluginConfig.Bind(((BaseUnityPlugin)this).Config); ConsoleCommands.Register(); _harmony = new Harmony("com.jumpingmushroom.portallines"); _harmony.PatchAll(typeof(PortalLinesPlugin).Assembly); PluginConfig.StyleChanged += OnStyleChanged; PluginConfig.PinsChanged += OnPinsChanged; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PortalLines 0.8.0 loaded."); } private void OnDestroy() { PluginConfig.StyleChanged -= OnStyleChanged; PluginConfig.PinsChanged -= OnPinsChanged; _overlay.Destroy(); _toggle.Destroy(); _hover.Destroy(); _route.Destroy(); _arrow.Destroy(); RouteState.Clear(); _pins.Clear(); PortalCache.Unload(); if (_harmony != null) { _harmony.UnpatchSelf(); } } private void OnStyleChanged() { _overlay.MarkStyleDirty(); _toggle.Sync(); } private void OnPinsChanged() { _pins.Invalidate(); } private void WorldGone() { _overlay.Destroy(); _toggle.Destroy(); _hover.Destroy(); _route.Destroy(); _arrow.Destroy(); RouteState.Clear(); _pins.Clear(); PortalRegistry.Clear(); PortalCache.Unload(); Diagnostics.Reset(); _nextScan = 0f; _wasLarge = false; } private void LocalPlayerArrived() { PortalRegistry.Clear(); Diagnostics.Reset(); _nextScan = 0f; _wasLarge = false; } private void Update() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Invalid comparison between Unknown and I4 Player localPlayer = Player.m_localPlayer; bool flag = (Object)(object)ZNet.instance != (Object)null; if (!flag && _hadWorld) { WorldGone(); } _hadWorld = flag; bool flag2 = (Object)(object)localPlayer != (Object)null; bool flag3 = localPlayer == _lastPlayer; if (flag2 && (!_hadPlayer || !flag3)) { LocalPlayerArrived(); } _hadPlayer = flag2; _lastPlayer = localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Minimap instance = Minimap.instance; if (!((Object)(object)instance == (Object)null)) { _overlay.EnsureAttached(instance); if (!_toggle.Created) { _toggle.Create(instance); } _toggle.SetVisible(PluginConfig.MapToggle.Value); KeyboardShortcut value = PluginConfig.ToggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown() && !InputBlocked()) { PluginConfig.LinesEnabled.Value = !PluginConfig.LinesEnabled.Value; } bool flag4 = (int)instance.m_mode == 2; bool num = flag4 && !_wasLarge; _wasLarge = flag4; if (num) { _nextScan = 0f; } if (Time.time >= _nextScan) { _nextScan = Time.time + (flag4 ? PluginConfig.ScanInterval.Value : 15f); PortalRegistry.Scan(); } if (num) { _nextRefresh = Time.time + PluginConfig.RefreshInterval.Value; PortalRegistry.RequestRefresh(); Diagnostics.ReportOnce(instance); } if (flag4 && Time.time >= _nextRefresh) { _nextRefresh = Time.time + PluginConfig.RefreshInterval.Value; PortalRegistry.RequestRefresh(); } _pins.Sync(PortalRegistry.Snapshot); if (flag4) { _hover.Update(instance, PortalRegistry.Snapshot); } else { _hover.Clear(); } _route.Update(instance, flag4); _arrow.Update(instance, flag4); if (Time.time >= _nextSave) { _nextSave = Time.time + 10f; PortalCache.SaveIfDirty(); } } } } public enum LineColorMode { Biome, PerTag, Single } public static class PluginConfig { public static ConfigEntry<float> ScanInterval; public static ConfigEntry<float> RefreshInterval; public static ConfigEntry<bool> FetchPartners; public static ConfigEntry<bool> RememberPortals; public static ConfigEntry<int> ForgetAfterDays; public static ConfigEntry<float> RememberedAlpha; public static ConfigEntry<bool> LinesEnabled; public static ConfigEntry<float> LineWidth; public static ConfigEntry<float> LineAlpha; public static ConfigEntry<LineColorMode> ColorMode; public static ConfigEntry<Color> SingleColor; public static ConfigEntry<bool> ShowPresumed; public static ConfigEntry<Color> MeadowsColor; public static ConfigEntry<Color> BlackForestColor; public static ConfigEntry<Color> SwampColor; public static ConfigEntry<Color> MountainColor; public static ConfigEntry<Color> PlainsColor; public static ConfigEntry<Color> MistlandsColor; public static ConfigEntry<Color> AshlandsColor; public static ConfigEntry<Color> DeepNorthColor; public static ConfigEntry<Color> OceanColor; public static ConfigEntry<bool> Outline; public static ConfigEntry<bool> ShowOnMinimap; public static ConfigEntry<bool> MapToggle; public static ConfigEntry<KeyboardShortcut> ToggleKey; public static ConfigEntry<bool> HoverEnabled; public static ConfigEntry<float> HoverRadius; public static ConfigEntry<float> FocusDim; public static ConfigEntry<bool> RouteEnabled; public static ConfigEntry<float> HopCost; public static ConfigEntry<bool> RoutePresumed; public static ConfigEntry<Color> RouteColor; public static ConfigEntry<bool> RouteOnMinimap; public static ConfigEntry<float> ArriveDistance; public static ConfigEntry<KeyboardShortcut> ClearRouteKey; public static ConfigEntry<bool> ShowHudArrow; public static ConfigEntry<float> HudArrowOffsetY; public static ConfigEntry<float> HudArrowScale; public static ConfigEntry<bool> PinsEnabled; public static ConfigEntry<bool> ShowTags; public static ConfigEntry<bool> TintUnlinked; public static ConfigEntry<Color> UnlinkedColor; public static ConfigEntry<Color> ConflictColor; public static ConfigEntry<bool> Verbose; public static event Action StyleChanged; public static event Action PinsChanged; private static ConfigurationManagerAttributes Attr(int order, bool advanced = false) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown return new ConfigurationManagerAttributes { Order = order, IsAdvanced = advanced }; } public static void Bind(ConfigFile cfg) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: 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_022a: 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_0276: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Expected O, but got Unknown //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Expected O, but got Unknown //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Expected O, but got Unknown //IL_035a: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Expected O, but got Unknown //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Expected O, but got Unknown //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Expected O, but got Unknown //IL_04d8: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Expected O, but got Unknown //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Expected O, but got Unknown //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Expected O, but got Unknown //IL_0593: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Expected O, but got Unknown //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d3: Expected O, but got Unknown //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0605: Expected O, but got Unknown //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Expected O, but got Unknown //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Expected O, but got Unknown //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Expected O, but got Unknown //IL_06e7: Unknown result type (might be due to invalid IL or missing references) //IL_06f1: Expected O, but got Unknown //IL_0719: Unknown result type (might be due to invalid IL or missing references) //IL_0723: Expected O, but got Unknown //IL_0742: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Expected O, but got Unknown //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_07a3: Unknown result type (might be due to invalid IL or missing references) //IL_07ad: Expected O, but got Unknown //IL_07d5: Unknown result type (might be due to invalid IL or missing references) //IL_07df: Expected O, but got Unknown //IL_0811: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Expected O, but got Unknown //IL_0855: Unknown result type (might be due to invalid IL or missing references) //IL_085f: Expected O, but got Unknown //IL_0899: Unknown result type (might be due to invalid IL or missing references) //IL_08a3: Expected O, but got Unknown //IL_08dd: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Expected O, but got Unknown //IL_090f: Unknown result type (might be due to invalid IL or missing references) //IL_0919: Expected O, but got Unknown //IL_0940: Unknown result type (might be due to invalid IL or missing references) //IL_094a: Expected O, but got Unknown LinesEnabled = cfg.Bind<bool>("Lines", "Enabled", true, new ConfigDescription("Draw a line between each pair of connected portals.", (AcceptableValueBase)null, new object[1] { Attr(100) })); LineWidth = cfg.Bind<float>("Lines", "Width", 3f, new ConfigDescription("Line width in pixels on the large map. The minimap uses two thirds of this.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 12f), new object[1] { Attr(90) })); LineAlpha = cfg.Bind<float>("Lines", "Alpha", 0.85f, new ConfigDescription("Line opacity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), new object[1] { Attr(85) })); ColorMode = cfg.Bind<LineColorMode>("Lines", "ColorMode", LineColorMode.Biome, new ConfigDescription("Biome colours each end of a line by the biome it sits in and blends between them, so a line tells you where it goes. PerTag gives each tag its own stable colour so crossing lines can be told apart. Single uses one colour for everything.", (AcceptableValueBase)null, new object[1] { Attr(80) })); SingleColor = cfg.Bind<Color>("Lines", "SingleColor", new Color(0.55f, 0.85f, 1f), new ConfigDescription("Line colour when ColorMode is Single.", (AcceptableValueBase)null, new object[1] { Attr(75) })); MeadowsColor = BiomeEntry(cfg, "Meadows", new Color(0.62f, 1f, 0.3f), 79); BlackForestColor = BiomeEntry(cfg, "BlackForest", new Color(0.1f, 0.68f, 0.55f), 78); SwampColor = BiomeEntry(cfg, "Swamp", new Color(0.72f, 0.5f, 0.38f), 77); MountainColor = BiomeEntry(cfg, "Mountain", new Color(0.5f, 0.78f, 1f), 76); PlainsColor = BiomeEntry(cfg, "Plains", new Color(1f, 0.9f, 0.2f), 75); MistlandsColor = BiomeEntry(cfg, "Mistlands", new Color(0.75f, 0.5f, 1f), 74); AshlandsColor = BiomeEntry(cfg, "Ashlands", new Color(1f, 0.28f, 0.18f), 73); DeepNorthColor = BiomeEntry(cfg, "DeepNorth", new Color(0.92f, 0.96f, 1f), 72); OceanColor = BiomeEntry(cfg, "Ocean", new Color(0.25f, 0.5f, 1f), 71); ShowPresumed = cfg.Bind<bool>("Lines", "ShowPresumed", true, new ConfigDescription("Also draw dashed lines for pairs the game has not confirmed yet: the only two known portals with a tag, or a pair where one end's copy is still stale.", (AcceptableValueBase)null, new object[1] { Attr(70) })); Outline = cfg.Bind<bool>("Lines", "Outline", true, new ConfigDescription("Dark outline under each line so it stays readable over snow and sand.", (AcceptableValueBase)null, new object[1] { Attr(65) })); ShowOnMinimap = cfg.Bind<bool>("Lines", "ShowOnMinimap", false, new ConfigDescription("Also draw lines on the small minimap in the corner.", (AcceptableValueBase)null, new object[1] { Attr(60) })); MapToggle = cfg.Bind<bool>("Lines", "MapToggle", true, new ConfigDescription("Show a \"Portal lines\" checkbox on the large map, above the map's own toggles.", (AcceptableValueBase)null, new object[1] { Attr(58) })); ToggleKey = cfg.Bind<KeyboardShortcut>("Lines", "ToggleKey", KeyboardShortcut.Empty, new ConfigDescription("Hotkey that shows and hides the lines. Unbound by default.", (AcceptableValueBase)null, new object[1] { Attr(57) })); HoverEnabled = cfg.Bind<bool>("Hover", "Enabled", true, new ConfigDescription("Hovering a portal on the large map highlights its line, dims the others, and shows its tag, destination biome, distance and link state. With lines switched off, hovering still shows that one portal's line.", (AcceptableValueBase)null, new object[1] { Attr(56) })); HoverRadius = cfg.Bind<float>("Hover", "Radius", 28f, new ConfigDescription("How close the cursor must be to a portal, in screen pixels.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(8f, 80f), new object[1] { Attr(55) })); FocusDim = cfg.Bind<float>("Hover", "DimOthers", 0.12f, new ConfigDescription("Opacity multiplier for every other line while a portal is hovered.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), new object[1] { Attr(54) })); RouteEnabled = cfg.Bind<bool>("Route", "Enabled", true, new ConfigDescription("Shift-click a spot on the large map to plan the fastest way there through the portal network: walk to a portal, hop, walk on. Shift-right-click clears it.", (AcceptableValueBase)null, new object[1] { Attr(53) })); HopCost = cfg.Bind<float>("Route", "HopCost", 60f, new ConfigDescription("How many metres of walking one portal hop is worth, so the planner does not chain hops that save almost nothing.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 500f), new object[1] { Attr(52) })); RoutePresumed = cfg.Bind<bool>("Route", "UsePresumedLinks", true, new ConfigDescription("Let the planner use links that are presumed but not yet confirmed by the server.", (AcceptableValueBase)null, new object[1] { Attr(51) })); RouteColor = cfg.Bind<Color>("Route", "Color", new Color(1f, 1f, 1f), new ConfigDescription("Colour of the walking legs and markers.", (AcceptableValueBase)null, new object[1] { Attr(50) })); RouteOnMinimap = cfg.Bind<bool>("Route", "ShowOnMinimap", true, new ConfigDescription("Follow the route on the small minimap: the walking leg from you to the next portal or the destination, with an arrow at the edge when it is out of view.", (AcceptableValueBase)null, new object[1] { Attr(49) })); ArriveDistance = cfg.Bind<float>("Route", "ArriveDistance", 20f, new ConfigDescription("Clear the route by itself once you are this close to the destination (metres). 0 keeps it until you clear it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), new object[1] { Attr(48) })); ClearRouteKey = cfg.Bind<KeyboardShortcut>("Route", "ClearKey", KeyboardShortcut.Empty, new ConfigDescription("Hotkey that clears the route without opening the map. Unbound by default.", (AcceptableValueBase)null, new object[1] { Attr(47) })); ShowHudArrow = cfg.Bind<bool>("Route", "ShowHudArrow", true, new ConfigDescription("An arrow at the top of the screen pointing the way to the next portal or the destination, relative to where you are looking, with the distance underneath. Beside the portal to take it says which one to enter.", (AcceptableValueBase)null, new object[1] { Attr(46) })); HudArrowOffsetY = cfg.Bind<float>("Route", "HudArrowOffsetY", 0f, new ConfigDescription("Move the HUD arrow down (positive) or up (negative) from its place at the top centre, e.g. to clear a compass mod. It already drops below raid and boss bars.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-100f, 600f), new object[1] { Attr(45) })); HudArrowScale = cfg.Bind<float>("Route", "HudArrowScale", 1f, new ConfigDescription("Size of the HUD arrow and its label.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 2.5f), new object[1] { Attr(44) })); PinsEnabled = cfg.Bind<bool>("Pins", "Enabled", true, new ConfigDescription("Add a portal pin at every known portal. These pins are never saved and never shared through the cartography table. The map's own portal-icon filter hides them.", (AcceptableValueBase)null, new object[1] { Attr(50) })); ShowTags = cfg.Bind<bool>("Pins", "ShowTags", true, new ConfigDescription("Label each pin with the portal's tag (visible when zoomed in, like any pin name).", (AcceptableValueBase)null, new object[1] { Attr(45) })); TintUnlinked = cfg.Bind<bool>("Pins", "TintUnlinked", true, new ConfigDescription("Tint the pin of a portal that has no connection.", (AcceptableValueBase)null, new object[1] { Attr(40) })); UnlinkedColor = cfg.Bind<Color>("Pins", "UnlinkedColor", new Color(1f, 0.45f, 0.45f), new ConfigDescription("Pin tint for unconnected portals.", (AcceptableValueBase)null, new object[1] { Attr(35) })); ConflictColor = cfg.Bind<Color>("Pins", "ConflictColor", new Color(1f, 0.75f, 0.2f), new ConfigDescription("Pin tint when three or more known portals share a tag. Only one pair of them can ever be connected; the rest sit dark.", (AcceptableValueBase)null, new object[1] { Attr(30) })); RememberPortals = cfg.Bind<bool>("Data", "RememberPortals", true, new ConfigDescription("Remember portals on disk per world, so the map is populated from the moment you log in. The game only tells a client about portals near it, so without this the map starts empty every session. Stored in BepInEx/config/PortalLines/.", (AcceptableValueBase)null, new object[1] { Attr(28) })); ForgetAfterDays = cfg.Bind<int>("Data", "ForgetAfterDays", 0, new ConfigDescription("Drop remembered portals not seen for this many days. 0 keeps them until you visit the spot and find them gone.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 365), new object[1] { Attr(26) })); RememberedAlpha = cfg.Bind<float>("Data", "RememberedAlpha", 0.55f, new ConfigDescription("Opacity of pins and lines for portals known only from memory, not yet confirmed this session.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1f), new object[1] { Attr(24) })); ScanInterval = cfg.Bind<float>("Data", "ScanInterval", 2f, new ConfigDescription("Seconds between re-reading the portal list while the large map is open.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f), new object[1] { Attr(20, advanced: true) })); RefreshInterval = cfg.Bind<float>("Data", "RefreshInterval", 10f, new ConfigDescription("Seconds between asking the server to re-send the portals you know about but are not near, while the large map is open. This is how retagged or demolished portals far away catch up. The server sends nothing for portals that have not changed.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 60f), new object[1] { Attr(15, advanced: true) })); FetchPartners = cfg.Bind<bool>("Data", "FetchPartners", true, new ConfigDescription("Ask the server for the far end of every known portal. This is the same request the game makes for the portal you are standing next to; without it, a line is only drawn once you have been near both ends.", (AcceptableValueBase)null, new object[1] { Attr(10, advanced: true) })); Verbose = cfg.Bind<bool>("Logging", "Verbose", false, new ConfigDescription("Log scans and requests to the BepInEx log. Off by default; nothing is logged per tick.", (AcceptableValueBase)null, new object[1] { Attr(5, advanced: true) })); LinesEnabled.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; LineWidth.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; LineAlpha.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; ColorMode.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; SingleColor.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; ShowPresumed.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; Outline.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; ShowOnMinimap.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; RouteOnMinimap.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; RememberedAlpha.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; FocusDim.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; MapToggle.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; PinsEnabled.SettingChanged += delegate { Raise(PluginConfig.PinsChanged); }; ShowTags.SettingChanged += delegate { Raise(PluginConfig.PinsChanged); }; TintUnlinked.SettingChanged += delegate { Raise(PluginConfig.PinsChanged); }; UnlinkedColor.SettingChanged += delegate { Raise(PluginConfig.PinsChanged); }; ConflictColor.SettingChanged += delegate { Raise(PluginConfig.PinsChanged); }; } private static ConfigEntry<Color> BiomeEntry(ConfigFile cfg, string biome, Color def, int order) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown ConfigEntry<Color> obj = cfg.Bind<Color>("Biome colours", biome, def, new ConfigDescription("Line colour for a portal standing in " + biome + " (ColorMode Biome).", (AcceptableValueBase)null, new object[1] { Attr(order) })); obj.SettingChanged += delegate { Raise(PluginConfig.StyleChanged); }; return obj; } private static void Raise(Action a) { if (a == null) { return; } try { a(); } catch (Exception ex) { PortalLinesPlugin.Log.LogWarning((object)("config listener threw: " + ex)); } } } } namespace PortalLines.UI { internal sealed class HudArrow { private const float EnterDistance = 4f; private const float AlignedAngle = 15f; private const float UnalignedAlpha = 0.5f; private const float TopMargin = 24f; private const float ObstacleGap = 10f; private const float ArrowSize = 34f; private Hud _hud; private RectTransform _root; private ArrowGraphic _arrow; private TMP_Text _text; private string _lastKey; private static readonly Vector3[] s_corners = (Vector3[])(object)new Vector3[4]; public void Update(Minimap map, bool large) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) Hud instance = Hud.instance; Player localPlayer = Player.m_localPlayer; if ((Object)(object)instance == (Object)null || (Object)(object)localPlayer == (Object)null || (Object)(object)map == (Object)null) { Destroy(); return; } if (instance != _hud || (Object)(object)_root == (Object)null) { Destroy(); if (!Create(instance, map)) { return; } } if (large || !RouteState.Active || !PluginConfig.RouteEnabled.Value || !PluginConfig.ShowHudArrow.Value || InventoryGui.IsVisible()) { Hide(); return; } Vector3 position = ((Component)localPlayer).transform.position; Route current = RouteState.Current; RouteLeg routeLeg = NextHop(current); Vector3 val = RouteState.NextWaypoint(); float num = Utils.DistanceXZ(position, val); bool flag = routeLeg != null && (current.Legs[0].Kind == LegKind.Hop || num <= 4f); string text = ((!flag) ? (((routeLeg != null) ? ("portal|" + routeLeg.Portal.Key) : "dest") + "|" + DistKey(num)) : ("enter|" + routeLeg.Portal.Key)); if (text != _lastKey) { _lastKey = text; _text.text = (flag ? EnterText(routeLeg) : WalkText(routeLeg, num)); } ((Component)_arrow).gameObject.SetActive(!flag); if (!flag) { float num2 = Heading(position, val); ((Transform)((Graphic)_arrow).rectTransform).localEulerAngles = new Vector3(0f, 0f, 0f - num2); ((Graphic)_arrow).canvasRenderer.SetAlpha((Mathf.Abs(num2) <= 15f) ? 1f : 0.5f); Color value = PluginConfig.RouteColor.Value; value.a = 1f; if (((Graphic)_arrow).color != value) { ((Graphic)_arrow).color = value; } } float value2 = PluginConfig.HudArrowScale.Value; ((Transform)_root).localScale = new Vector3(value2, value2, 1f); Place(instance); if (!((Component)_root).gameObject.activeSelf) { ((Component)_root).gameObject.SetActive(true); } } public void Hide() { if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf) { ((Component)_root).gameObject.SetActive(false); } } public void Destroy() { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)((Component)_root).gameObject); } _root = null; _arrow = null; _text = null; _hud = null; _lastKey = null; } private bool Create(Hud hud, Minimap map) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0155: 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_016e: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hud.m_rootObject == (Object)null || (Object)(object)map.m_biomeNameLarge == (Object)null) { return false; } Transform transform = hud.m_rootObject.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)val == (Object)null) { return false; } GameObject val2 = new GameObject("PortalLinesHudArrow", new Type[1] { typeof(RectTransform) }); val2.transform.SetParent((Transform)(object)val, false); ref RectTransform root = ref _root; Transform transform2 = val2.transform; root = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); RectTransform root2 = _root; RectTransform root3 = _root; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 1f); root3.anchorMax = val3; root2.anchorMin = val3; _root.pivot = new Vector2(0.5f, 1f); _root.sizeDelta = new Vector2(360f, 64f); GameObject val4 = new GameObject("Arrow", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(ArrowGraphic) }); val4.transform.SetParent((Transform)(object)_root, false); _arrow = val4.GetComponent<ArrowGraphic>(); ((Graphic)_arrow).raycastTarget = false; RectTransform rectTransform = ((Graphic)_arrow).rectTransform; ((Vector2)(ref val3))..ctor(0.5f, 1f); rectTransform.anchorMax = val3; rectTransform.anchorMin = val3; rectTransform.pivot = new Vector2(0.5f, 0.5f); rectTransform.sizeDelta = new Vector2(34f, 34f); rectTransform.anchoredPosition = new Vector2(0f, -17f); GameObject val5 = Object.Instantiate<GameObject>(((Component)map.m_biomeNameLarge).gameObject, (Transform)(object)_root); ((Object)val5).name = "Text"; Component[] components = val5.GetComponents<Component>(); foreach (Component val6 in components) { if ((Object)(object)val6 != (Object)null && ((object)val6).GetType().Name == "Localize") { Object.Destroy((Object)(object)val6); } } val5.SetActive(true); _text = val5.GetComponent<TMP_Text>(); Transform transform3 = val5.transform; Transform obj = ((transform3 is RectTransform) ? transform3 : null); ((RectTransform)obj).anchorMin = new Vector2(0f, 1f); ((RectTransform)obj).anchorMax = new Vector2(1f, 1f); ((RectTransform)obj).pivot = new Vector2(0.5f, 1f); ((RectTransform)obj).sizeDelta = new Vector2(0f, 26f); ((RectTransform)obj).anchoredPosition = new Vector2(0f, -36f); _text.alignment = (TextAlignmentOptions)258; _text.fontSize = 18f; _text.textWrappingMode = (TextWrappingModes)0; _text.richText = true; ((Graphic)_text).color = Color.white; _text.outlineWidth = 0.2f; _text.outlineColor = new Color32((byte)0, (byte)0, (byte)0, (byte)200); ((Graphic)_text).raycastTarget = false; _text.text = ""; _hud = hud; val2.SetActive(false); return true; } private static RouteLeg NextHop(Route route) { if (route == null || route.Legs.Count == 0) { return null; } if (route.Legs[0].Kind == LegKind.Hop) { return route.Legs[0]; } if (route.Legs.Count > 1 && route.Legs[1].Kind == LegKind.Hop) { return route.Legs[1]; } return null; } private static float Heading(Vector3 from, Vector3 to) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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) Transform val = (((Object)(object)GameCamera.instance != (Object)null) ? ((Component)GameCamera.instance).transform : (((Object)(object)Camera.main != (Object)null) ? ((Component)Camera.main).transform : null)); if ((Object)(object)val == (Object)null) { return 0f; } Vector3 forward = val.forward; forward.y = 0f; Vector3 val2 = to - from; val2.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 1E-06f || ((Vector3)(ref val2)).sqrMagnitude < 1E-06f) { return 0f; } return Vector3.SignedAngle(forward, val2, Vector3.up); } private static int DistKey(float m) { if (!(m < 1000f)) { return 100000 + Mathf.RoundToInt(m / 100f); } return Mathf.RoundToInt(m); } private static string WalkText(RouteLeg hop, float dist) { if (hop == null) { return "Destination <alpha=#AA>" + RouteInput.Dist(dist); } return "Portal " + TagText(hop) + " <alpha=#AA>" + RouteInput.Dist(dist); } private static string EnterText(RouteLeg hop) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Color val = MapMath.BiomeColor(hop.Link.Other(hop.Portal).Biome); return "Enter portal " + TagText(hop) + " → <color=#" + ColorUtility.ToHtmlStringRGB(val) + ">" + RouteInput.BiomeName(hop.To) + "</color>"; } private static string TagText(RouteLeg hop) { if (!hop.Portal.HasTag) { return "(no tag)"; } return "\"" + hop.Portal.Tag + "\""; } private void Place(Hud hud) { //IL_0012: 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_0038: 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_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) Transform parent = ((Transform)_root).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); Rect rect = val.rect; float num = ((Rect)(ref rect)).yMax - 24f - PluginConfig.HudArrowOffsetY.Value; float halfWidth = _root.sizeDelta.x * 0.5f * ((Transform)_root).localScale.x; if ((Object)(object)hud.m_eventBar != (Object)null && hud.m_eventBar.activeInHierarchy) { Transform transform = hud.m_eventBar.transform; num = Below(val, (RectTransform)(object)((transform is RectTransform) ? transform : null), num, halfWidth); } EnemyHud instance = EnemyHud.instance; if ((Object)(object)instance != (Object)null && instance.m_huds != null) { foreach (KeyValuePair<Character, HudData> hud2 in instance.m_huds) { if (!((Object)(object)hud2.Key == (Object)null) && hud2.Key.IsBoss() && !((Object)(object)hud2.Value.m_gui == (Object)null) && hud2.Value.m_gui.activeInHierarchy) { Transform obj = hud2.Value.m_gui.transform.Find("Health"); num = Below(val, (RectTransform)(object)((obj is RectTransform) ? obj : null), num, halfWidth); if ((Object)(object)hud2.Value.m_name != (Object)null) { num = Below(val, ((TMP_Text)hud2.Value.m_name).rectTransform, num, halfWidth); } } } } RectTransform root = _root; float num2 = num; rect = val.rect; root.anchoredPosition = new Vector2(0f, num2 - ((Rect)(ref rect)).yMax); } private static float Below(RectTransform parent, RectTransform rt, float top, float halfWidth) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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_00a0: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) if ((Object)(object)rt == (Object)null) { return top; } Camera val = CanvasCamera((Transform)(object)parent); Camera val2 = CanvasCamera((Transform)(object)rt); rt.GetWorldCorners(s_corners); float num = float.MaxValue; float num2 = float.MinValue; float num3 = float.MaxValue; Vector2 val4 = default(Vector2); for (int i = 0; i < 4; i++) { Vector2 val3 = RectTransformUtility.WorldToScreenPoint(val2, s_corners[i]); if (!RectTransformUtility.ScreenPointToLocalPointInRectangle(parent, val3, val, ref val4)) { return top; } num = Mathf.Min(num, val4.x); num2 = Mathf.Max(num2, val4.x); num3 = Mathf.Min(num3, val4.y); } Rect rect = parent.rect; float x = ((Rect)(ref rect)).center.x; bool num4 = num2 > x - halfWidth && num < x + halfWidth; bool flag = num3 > ((Rect)(ref rect)).center.y; if (num4 && flag && num3 - 10f < top) { return num3 - 10f; } return top; } private static Camera CanvasCamera(Transform t) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) Canvas componentInParent = ((Component)t).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent == (Object)null) { return null; } componentInParent = componentInParent.rootCanvas; if ((int)componentInParent.renderMode != 0) { return componentInParent.worldCamera; } return null; } } public sealed class ArrowGraphic : MaskableGraphic { protected override void OnPopulateMesh(VertexHelper vh) { //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_003d: 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_0044: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) vh.Clear(); Rect rect = ((Graphic)this).rectTransform.rect; float num = Mathf.Min(((Rect)(ref rect)).width, ((Rect)(ref rect)).height) * 0.5f - 2f; if (!(num <= 0f)) { Vector2 center = ((Rect)(ref rect)).center; AddDart(vh, center, num + 2.5f, new Color(0f, 0f, 0f, 0.65f)); AddDart(vh, center, num, ((Graphic)this).color); } } private static void AddDart(VertexHelper vh, Vector2 c, float h, Color col) { //IL_0000: 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_0012: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0061: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Vector2 p = c + new Vector2(0f, h); Vector2 p2 = c + new Vector2((0f - h) * 0.8f, 0f - h); Vector2 p3 = c + new Vector2(h * 0.8f, 0f - h); Vector2 p4 = c + new Vector2(0f, (0f - h) * 0.45f); int currentVertCount = vh.currentVertCount; vh.AddVert(LineMesh.Vert(p, col)); vh.AddVert(LineMesh.Vert(p2, col)); vh.AddVert(LineMesh.Vert(p4, col)); vh.AddVert(LineMesh.Vert(p3, col)); vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 1); vh.AddTriangle(currentVertCount, currentVertCount + 3, currentVertCount + 2); } } internal static class LineMesh { private const int MaxDashesPerLine = 512; private static readonly List<UIVertex> s_verts = new List<UIVertex>(4); public static void AddLine(VertexHelper vh, Vector2 a, Vector2 b, float width, Color colorA, Color colorB, float dash = 0f, float gap = 0f) { //IL_0017: 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_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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_0083: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (dash <= 0f) { AddQuad(vh, a, b, width, colorA, colorB); return; } Vector2 val = b - a; float magnitude = ((Vector2)(ref val)).magnitude; if (magnitude < 0.001f) { return; } Vector2 val2 = val / magnitude; float num = dash + gap; int num2 = Mathf.Min(512, Mathf.CeilToInt(magnitude / num)); float num3 = 0f; for (int i = 0; i < num2; i++) { if (!(num3 < magnitude)) { break; } float num4 = Mathf.Min(magnitude, num3 + dash); AddQuad(vh, a + val2 * num3, a + val2 * num4, width, Color.Lerp(colorA, colorB, num3 / magnitude), Color.Lerp(colorA, colorB, num4 / magnitude)); num3 += num; } } public static void AddQuad(VertexHelper vh, Vector2 p0, Vector2 p1, float width, Color c0, Color c1) { //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_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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0051: 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_0053: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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_00e3: Unknown result type (might be due to invalid IL or missing references) Vector2 val = p1 - p0; float magnitude = ((Vector2)(ref val)).magnitude; if (!(magnitude < 0.001f)) { Vector2 val2 = new Vector2(0f - val.y, val.x) / magnitude * (width * 0.5f); Vector2 val3 = val / magnitude * (width * 0.5f); p0 -= val3; p1 += val3; int currentVertCount = vh.currentVertCount; s_verts.Clear(); s_verts.Add(Vert(p0 - val2, c0)); s_verts.Add(Vert(p0 + val2, c0)); s_verts.Add(Vert(p1 + val2, c1)); s_verts.Add(Vert(p1 - val2, c1)); for (int i = 0; i < 4; i++) { vh.AddVert(s_verts[i]); } vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); vh.AddTriangle(currentVertCount + 2, currentVertCount + 3, currentVertCount); } } public static void AddDisc(VertexHelper vh, Vector2 c, float radius, Color color, int segments = 20) { //IL_0008: 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_000a: 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_0039: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) int currentVertCount = vh.currentVertCount; vh.AddVert(Vert(c, color)); for (int i = 0; i < segments; i++) { float num = (float)i * (float)Math.PI * 2f / (float)segments; vh.AddVert(Vert(c + new Vector2(Mathf.Cos(num), Mathf.Sin(num)) * radius, color)); } for (int j = 0; j < segments; j++) { vh.AddTriangle(currentVertCount, currentVertCount + 1 + j, currentVertCount + 1 + (j + 1) % segments); } } public static void AddRing(VertexHelper vh, Vector2 c, float radius, float thickness, Color color, int segments = 24) { //IL_0049: 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_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_0057: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_006d: 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_0074: Unknown result type (might be due to invalid IL or missing references) int currentVertCount = vh.currentVertCount; float num = radius - thickness * 0.5f; float num2 = radius + thickness * 0.5f; Vector2 val = default(Vector2); for (int i = 0; i < segments; i++) { float num3 = (float)i * (float)Math.PI * 2f / (float)segments; ((Vector2)(ref val))..ctor(Mathf.Cos(num3), Mathf.Sin(num3)); vh.AddVert(Vert(c + val * num, color)); vh.AddVert(Vert(c + val * num2, color)); } for (int j = 0; j < segments; j++) { int num4 = currentVertCount + j * 2; int num5 = currentVertCount + (j + 1) % segments * 2; vh.AddTriangle(num4, num4 + 1, num5 + 1); vh.AddTriangle(num5 + 1, num5, num4); } } public static void AddArrowHead(VertexHelper vh, Vector2 tip, Vector2 dir, float length, float halfWidth, Color color) { //IL_0002: 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_0015: 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_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_002a: 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_002d: 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_0039: 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_0048: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f - dir.y, dir.x); Vector2 val2 = tip - dir * length; int currentVertCount = vh.currentVertCount; vh.AddVert(Vert(tip, color)); vh.AddVert(Vert(val2 + val * halfWidth, color)); vh.AddVert(Vert(val2 - val * halfWidth, color)); vh.AddTriangle(currentVertCount, currentVertCount + 1, currentVertCount + 2); vh.AddTriangle(currentVertCount, currentVertCount + 2, currentVertCount + 1); } public static UIVertex Vert(Vector2 p, Color c) { //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_0008: 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_000e: 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_0016: 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_0020: Unknown result type (might be due to invalid IL or missing references) UIVertex simpleVert = UIVertex.simpleVert; simpleVert.position = Vector2.op_Implicit(p); simpleVert.color = Color32.op_Implicit(c); return simpleVert; } } internal static class MapMath { public static Vector2 WorldToMapPoint(Minimap map, Vector3 p) { //IL_000a: 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_003a: Unknown result type (might be due to invalid IL or missing references) float num = map.m_textureSize / 2; float num2 = (p.x / map.m_pixelSize + num) / (float)map.m_textureSize; float num3 = (p.z / map.m_pixelSize + num) / (float)map.m_textureSize; return new Vector2(num2, num3); } public static Vector2 MapPointToLocal(Vector2 mp, Rect uv, Rect rect) { //IL_0000: 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_003c: Unknown result type (might be due to invalid IL or missing references) return new Vector2((mp.x - ((Rect)(ref uv)).xMin) / ((Rect)(ref uv)).width * ((Rect)(ref rect)).width, (mp.y - ((Rect)(ref uv)).yMin) / ((Rect)(ref uv)).height * ((Rect)(ref rect)).height); } public static Vector2 WorldToLocal(Minimap map, Vector3 p, Rect uv, Rect rect) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) return MapPointToLocal(WorldToMapPoint(map, p), uv, rect); } public static bool ClipToRect(ref Vector2 a, ref Vector2 b, Rect r) { //IL_00d1: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) float t = 0f; float t2 = 1f; float num = b.x - a.x; float num2 = b.y - a.y; if (!Clip(0f - num, a.x - ((Rect)(ref r)).xMin, ref t, ref t2)) { return false; } if (!Clip(num, ((Rect)(ref r)).xMax - a.x, ref t, ref t2)) { return false; } if (!Clip(0f - num2, a.y - ((Rect)(ref r)).yMin, ref t, ref t2)) { return false; } if (!Clip(num2, ((Rect)(ref r)).yMax - a.y, ref t, ref t2)) { return false; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(a.x + t * num, a.y + t * num2); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(a.x + t2 * num, a.y + t2 * num2); a = val; b = val2; return true; } private static bool Clip(float p, float q, ref float t0, ref float t1) { if (p == 0f) { return q >= 0f; } float num = q / p; if (p < 0f) { if (num > t1) { return false; } if (num > t0) { t0 = num; } } else { if (num < t0) { return false; } if (num < t1) { t1 = num; } } return true; } public static Color BiomeColor(Biome biome) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0005: 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_001d: Expected I4, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0053: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_001f: Invalid comparison between Unknown and I4 //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0095: 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) //IL_0038: Invalid comparison between Unknown and I4 //IL_005e: 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_0024: Invalid comparison between Unknown and I4 //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if ((int)biome <= 16) { switch (biome - 1) { default: if ((int)biome != 8) { if ((int)biome != 16) { break; } return PluginConfig.PlainsColor.Value; } return PluginConfig.BlackForestColor.Value; case 0: return PluginConfig.MeadowsColor.Value; case 1: return PluginConfig.SwampColor.Value; case 3: return PluginConfig.MountainColor.Value; case 2: break; } } else if ((int)biome <= 64) { if ((int)biome == 32) { return PluginConfig.AshlandsColor.Value; } if ((int)biome == 64) { return PluginConfig.DeepNorthColor.Value; } } else { if ((int)biome == 256) { return PluginConfig.OceanColor.Value; } if ((int)biome == 512) { return PluginConfig.MistlandsColor.Value; } } return new Color(0.82f, 0.82f, 0.82f); } public static Color TagColor(string tag) { //IL_0044: 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) if (string.IsNullOrEmpty(tag)) { return new Color(0.82f, 0.82f, 0.82f); } return Color.HSVToRGB((float)((double)(uint)StringExtensionMethods.GetStableHashCode(tag) * 0.6180339887498949 % 1.0), 0.72f, 1f); } } internal sealed class MapOverlay { private Minimap _map; private PortalLinesGraphic _large; private PortalLinesGraphic _small; private RouteGraphic _route; private RouteGraphic _smallRoute; public bool Attached => (Object)(object)_large != (Object)null; public void EnsureAttached(Minimap map) { if ((Object)(object)map == (Object)null) { Destroy(); return; } if (map != _map || (Object)(object)_large == (Object)null) { Destroy(); _map = map; _large = Create(map.m_pinRootLarge, map.m_mapImageLarge, large: true); _route = CreateRoute(map.m_pinRootLarge, map.m_mapImageLarge, large: true); } bool flag = false; bool value = PluginConfig.ShowOnMinimap.Value; if (value && (Object)(object)_small == (Object)null) { _small = Create(map.m_pinRootSmall, map.m_mapImageSmall, large: false); flag = true; } else if (!value && (Object)(object)_small != (Object)null) { Object.Destroy((Object)(object)((Component)_small).gameObject); _small = null; flag = true; } bool flag2 = PluginConfig.RouteOnMinimap.Value && PluginConfig.RouteEnabled.Value; if (flag2 && (Object)(object)_smallRoute == (Object)null) { _smallRoute = CreateRoute(map.m_pinRootSmall, map.m_mapImageSmall, large: false); flag = true; } else if (!flag2 && (Object)(object)_smallRoute != (Object)null) { Object.Destroy((Object)(object)((Component)_smallRoute).gameObject); _smallRoute = null; } if (flag) { if ((Object)(object)_small != (Object)null) { ((Component)_small).transform.SetAsFirstSibling(); } if ((Object)(object)_smallRoute != (Object)null) { ((Component)_smallRoute).transform.SetSiblingIndex(((Object)(object)_small != (Object)null) ? 1 : 0); } } } public void MarkStyleDirty() { if ((Object)(object)_large != (Object)null) { _large.MarkStyleDirty(); } if ((Object)(object)_small != (Object)null) { _small.MarkStyleDirty(); } } public void Destroy() { if ((Object)(object)_large != (Object)null) { Object.Destroy((Object)(object)((Component)_large).gameObject); } if ((Object)(object)_small != (Object)null) { Object.Destroy((Object)(object)((Component)_small).gameObject); } if ((Object)(object)_route != (Object)null) { Object.Destroy((Object)(object)((Component)_route).gameObject); } if ((Object)(object)_smallRoute != (Object)null) { Object.Destroy((Object)(object)((Component)_smallRoute).gameObject); } _large = null; _small = null; _route = null; _smallRoute = null; _map = null; } private static RouteGraphic CreateRoute(RectTransform root, RawImage image, bool large) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a6: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null || (Object)(object)image == (Object)null) { return null; } GameObject val = new GameObject(large ? "PortalLines.Route" : "PortalLines.RouteSmall", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(RouteGraphic) }) { layer = ((Component)root).gameObject.layer }; RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)root, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.pivot = Vector2.zero; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; ((Transform)val2).localScale = Vector3.one; ((Transform)val2).SetSiblingIndex(1); RouteGraphic component = val.GetComponent<RouteGraphic>(); component.MapImage = image; component.IsLarge = large; ((Graphic)component).raycastTarget = false; ((Graphic)component).color = Color.white; return component; } private static PortalLinesGraphic Create(RectTransform root, RawImage image, bool large) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0066: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00a6: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null || (Object)(object)image == (Object)null) { return null; } GameObject val = new GameObject(large ? "PortalLines.Large" : "PortalLines.Small", new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(PortalLinesGraphic) }) { layer = ((Component)root).gameObject.layer }; RectTransform val2 = (RectTransform)val.transform; ((Transform)val2).SetParent((Transform)(object)root, false); val2.anchorMin = Vector2.zero; val2.anchorMax = Vector2.one; val2.pivot = Vector2.zero; val2.offsetMin = Vector2.zero; val2.offsetMax = Vector2.zero; ((Transform)val2).localScale = Vector3.one; ((Transform)val2).SetAsFirstSibling(); PortalLinesGraphic component = val.GetComponent<PortalLinesGraphic>(); component.MapImage = image; component.IsLarge = large; ((Graphic)component).raycastTarget = false; ((Graphic)component).color = Color.white; return component; } } internal sealed class MapPanel { private RectTransform _panel; private TMP_Text _text; private string _lastText; public bool Created => (Object)(object)_panel != (Object)null; public bool Create(Minimap map, string name) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_panel != (Object)null) { return true; } if ((Object)(object)map == (Object)null || (Object)(object)map.m_largeRoot == (Object)null || (Object)(object)map.m_biomeNameLarge == (Object)null) { return false; } GameObject val = new GameObject(name, new Type[3] { typeof(RectTransform), typeof(CanvasRenderer), typeof(Image) }); val.transform.SetParent(map.m_largeRoot.transform, false); ref RectTransform panel = ref _panel; Transform transform = val.transform; panel = (RectTransform)(object)((transform is RectTransform) ? transform : null); _panel.anchorMin = Vector2.zero; _panel.anchorMax = Vector2.zero; _panel.pivot = new Vector2(0f, 1f); Image component = val.GetComponent<Image>(); ((Graphic)component).color = new Color(0.05f, 0.04f, 0.03f, 0.82f); ((Graphic)component).raycastTarget = false; GameObject val2 = Object.Instantiate<GameObject>(((Component)map.m_biomeNameLarge).gameObject, (Transform)(object)_panel); ((Object)val2).name = "Text"; Component[] components = val2.GetComponents<Component>(); foreach (Component val3 in components) { if ((Object)(object)val3 != (Object)null && ((object)val3).GetType().Name == "Localize") { Object.Destroy((Object)(object)val3); } } _text = val2.GetComponent<TMP_Text>(); Transform transform2 = val2.transform; Transform obj = ((transform2 is RectTransform) ? transform2 : null); ((RectTransform)obj).anchorMin = Vector2.zero; ((RectTransform)obj).anchorMax = Vector2.one; ((RectTransform)obj).pivot = new Vector2(0f, 1f); ((RectTransform)obj).offsetMin = new Vector2(10f, 7f); ((RectTransform)obj).offsetMax = new Vector2(-10f, -7f); _text.alignment = (TextAlignmentOptions)257; _text.fontSize = 17f; _text.textWrappingMode = (TextWrappingModes)0; _text.richText = true; ((Graphic)_text).color = Color.white; ((Graphic)_text).raycastTarget = false; _text.text = ""; val.SetActive(false); return true; } public void ShowAtScreen(Minimap map, string content, Vector2 screen, float offset = 18f) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) Vector2 local = default(Vector2); if (!((Object)(object)_panel == (Object)null) && RectTransformUtility.ScreenPointToLocalPointInRectangle((RectTransform)/*isinst with value type is only supported in some contexts*/, screen, (Camera)null, ref local)) { ShowAtRootLocal(map, content, local, offset); } } public void ShowAtRootLocal(Minimap map, string content, Vector2 local, float offset = 18f) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: 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_00b0: 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_003c: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_panel == (Object)null)) { if (content != _lastText) { _lastText = content; _text.text = content; Vector2 preferredValues = _text.GetPreferredValues(content); _panel.sizeDelta = new Vector2(Mathf.Ceil(preferredValues.x) + 20f, Mathf.Ceil(preferredValues.y) + 14f); } Transform transform = map.m_largeRoot.transform; Rect rect = ((RectTransform)((transform is RectTransform) ? transform : null)).rect; float num = local.x - ((Rect)(ref rect)).xMin + offset; float num2 = local.y - ((Rect)(ref rect)).yMin - offset; if (num + _panel.sizeDelta.x > ((Rect)(ref rect)).width) { num = local.x - ((Rect)(ref rect)).xMin - offset - _panel.sizeDelta.x; } if (num2 - _panel.sizeDelta.y < 0f) { num2 = local.y - ((Rect)(ref rect)).yMin + offset + _panel.sizeDelta.y; } _panel.anchoredPosition = new Vector2(num, num2); if (!((Component)_panel).gameObject.activeSelf) { ((Component)_panel).gameObject.SetActive(true); } ((Transform)_panel).SetAsLastSibling(); } } public void Hide() { if ((Object)(object)_panel != (Object)null && ((Component)_panel).gameObject.activeSelf) { ((Component)_panel).gameObject.SetActive(false); } } public void Destroy() { if ((Object)(object)_panel != (Object)null) { Object.Destroy((Object)(object)((Component)_panel).gameObject); } _panel = null; _text = null; _lastText = null; } } internal sealed class MapToggle { private Toggle _toggle; private bool _syncing; public bool Created => (Object)(object)_toggle != (Object)null; public void Create(Minimap map) { //IL_006d: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0153: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_toggle != (Object)null || (Object)(object)map == (Object)null || (Object)(object)map.m_publicPosition == (Object)null || (Object)(object)map.m_largeRoot == (Object)null) { return; } Toggle publicPosition = map.m_publicPosition; Transform transform = ((Component)publicPosition).transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); Transform parent = ((Component)publicPosition).transform.parent; RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null) { return; } float x = ((Transform)val2).InverseTransformPoint(((Transform)val).position).x; float y = ((Transform)val2).InverseTransformPoint(((Transform)val).position).y; Rect rect = val.rect; float num = Mathf.Max(40f, ((Rect)(ref rect)).width * 0.5f); List<float> list = new List<float>(); StringBuilder stringBuilder = new StringBuilder("map toggles: "); Toggle[] componentsInChildren = map.m_largeRoot.GetComponentsInChildren<Toggle>(true); foreach (Toggle val3 in componentsInChildren) { Vector3 val4 = ((Transform)val2).InverseTransformPoint(((Component)val3).transform.position); bool flag = Mathf.Abs(val4.x - x) <= num; stringBuilder.Append(((Object)val3).name).Append('@').Append(val4.y.ToString("0")) .Append(flag ? "* " : " "); if (flag) { list.Add(val4.y); } } float num2 = y; float num3 = y; for (int j = 0; j < list.Count; j++) { if (list[j] > num2) { num2 = list[j]; } if (list[j] < num3) { num3 = list[j]; } } float num4; if (list.Count < 2) { rect = val.rect; num4 = ((Rect)(ref rect)).height + 6f; } else { num4 = (num2 - num3) / (float)(list.Count - 1); } float num5 = num4; GameObject val5 = Object.Instantiate<GameObject>(((Component)publicPosition).gameObject, (Transform)(object)val2); ((Object)val5).name = "PortalLinesToggle"; Transform transform2 = val5.transform; RectTransform val6 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); val6.anchoredPosition = val.anchoredPosition + new Vector2(0f, num2 - y + num5); Component[] componentsInChildren2 = val5.GetComponentsInChildren<Component>(true); foreach (Component val7 in componentsInChildren2) { if ((Object)(object)val7 != (Object)null && ((object)val7).GetType().Name == "Localize") { Object.Destroy((Object)(object)val7); } } TMP_Text componentInChildren = val5.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = "Portal lines"; } _toggle = val5.GetComponent<Toggle>(); _toggle.onValueChanged = new ToggleEvent(); _toggle.SetIsOnWithoutNotify(PluginConfig.LinesEnabled.Value); ((UnityEvent<bool>)(object)_toggle.onValueChanged).AddListener((UnityAction<bool>)OnToggled); ManualLogSource log = PortalLinesPlugin.Log; StringBuilder stringBuilder2 = stringBuilder.Append("-> placed at "); Vector2 anchoredPosition = val6.anchoredPosition; log.LogInfo((object)stringBuilder2.Append(((Vector2)(ref anchoredPosition)).ToString("0")).ToString()); } public void SetVisible(bool visible) { if ((Object)(object)_toggle != (Object)null && ((Component)_toggle).gameObject.activeSelf != visible) { ((Component)_toggle).gameObject.SetActive(visible); } } public void Sync() { if (!((Object)(object)_toggle == (Object)null) && !_syncing) { _syncing = true; _toggle.SetIsOnWithoutNotify(PluginConfig.LinesEnabled.Value); _syncing = false; } } public void Destroy() { if ((Object)(object)_toggle != (Object)null) { Object.Destroy((Object)(object)((Component)_toggle).gameObject); } _toggle = null; } private void OnToggled(bool on) { if (!_syncing) { _syncing = true; PluginConfig.LinesEnabled.Value = on; _syncing = false; } } } internal static class HoverState { public static PortalEntry Entry; public static int Version; public static void Set(PortalEntry e) { string obj = ((Entry != null) ? Entry.Key : null); string text = e?.Key; if (obj == text) { Entry = e; return; } Entry = e; Version++; } } internal sealed class PortalHover { private readonly MapPanel _panel = new MapPanel(); private Minimap _map; public void Update(Minimap map, PortalSnapshot snap) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_0062: 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_0069: Unknown result type (might be due to invalid IL or missing references) //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_0070: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)map == (Object)null) { Clear(); return; } if (map != _map) { _panel.Destroy(); _map = map; } if (!PluginConfig.HoverEnabled.Value || (int)map.m_mode != 2 || Minimap.InTextInput() || !ZInput.IsMouseActive() || snap.Portals.Count == 0) { Clear(); return; } Vector3 pointerPosition = ZInput.pointerPosition; Vector3 val = map.ScreenToWorldPoint(pointerPosition); if (val == Vector3.zero) { Clear(); return; } Rect uvRect = map.m_mapImageLarge.uvRect; Rect rect = ((Graphic)map.m_mapImageLarge).rectTransform.rect; float num = ((Rect)(ref uvRect)).width * (float)map.m_textureSize * map.m_pixelSize / ((Rect)(ref rect)).width; float num2 = PluginConfig.HoverRadius.Value * num; PortalEntry portalEntry = null; float num3 = num2; for (int i = 0; i < snap.Portals.Count; i++) { float num4 = Utils.DistanceXZ(snap.Portals[i].Pos, val); if (num4 < num3) { num3 = num4; portalEntry = snap.Portals[i]; } } HoverState.Set(portalEntry); if (portalEntry == null) { _panel.Hide(); } else if (_panel.Created || _panel.Create(map, "PortalLinesHover")) { _panel.ShowAtScreen(map, Describe(portalEntry), Vector2.op_Implicit(pointerPosition)); } } public void Clear() { HoverState.Set(null); _panel.Hide(); } public void Destroy() { HoverState.Set(null); _panel.Destroy(); _map = null; } private static string Describe(PortalEntry e) { //IL_0020: 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_002a: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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_0210: 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_0115: Unknown result type (might be due to invalid IL or missing references) //IL_024a: 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) StringBuilder stringBuilder = new StringBuilder(160); Color val = (Color)(PluginConfig.ColorMode.Value switch { LineColorMode.Biome => MapMath.BiomeColor(e.Biome), LineColorMode.Single => PluginConfig.SingleColor.Value, _ => MapMath.TagColor(e.Tag), }); stringBuilder.Append("<color=#").Append(ColorUtility.ToHtmlStringRGB(val)).Append("><b>") .Append(e.HasTag ? e.Tag : "(no tag)") .Append("</b></color>"); if (e.PrefabName.IndexOf("stone", StringComparison.OrdinalIgnoreCase) >= 0) { stringBuilder.Append(" <alpha=#99>stone portal"); } stringBuilder.Append('\n'); if (e.Linked) { PortalEntry portalEntry = e.Link.Other(e); stringBuilder.Append((e.Link.Kind == LinkKind.Confirmed) ? "Linked" : "Presumed link").Append(" → <color=#").Append(ColorUtility.ToHtmlStringRGB(MapMath.BiomeColor(portalEntry.Biome))) .Append('>') .Append(BiomeName(portalEntry.Pos)) .Append("</color>") .Append(", ") .Append(Dist(e.Link.Distance)); if (e.Link.Kind != LinkKind.Confirmed && !string.IsNullOrEmpty(e.Link.Reason)) { stringBuilder.Append("\n<alpha=#99>").Append(e.Link.Reason); } } else if (e.Conflict) { stringBuilder.Append("<color=#").Append(ColorUtility.ToHtmlStringRGB(PluginConfig.ConflictColor.Value)).Append(">Not connected</color>: tag used by ") .Append(e.TagCount) .Append(" portals, only one pair can connect"); } else if (!((ZDOID)(ref e.PartnerId)).IsNone() && !e.PartnerLoaded) { stringBuilder.Append("Linked, partner not received yet"); } else { stringBuilder.Append("<color=#").Append(ColorUtility.ToHtmlStringRGB(PluginConfig.UnlinkedColor.Value)).Append(">Not connected</color>"); } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { stringBuilder.Append("\n<alpha=#99>").Append(Dist(Utils.DistanceXZ(((Component)localPlayer).transform.position, e.Pos))).Append(" from you"); } if (e.Remembered) { stringBuilder.Append("\n<alpha=#99>Remembered, last seen ").Append(Ago(e.LastSeen)); } return stringBuilder.ToString(); } private static string BiomeName(Vector3 pos) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) WorldGenerator instance = WorldGenerator.instance; if (instance == null) { return "?"; } try { return instance.GetBiomeSector(pos, false).GetName(false); } catch (Exception) { return "?"; } } private static string Dist(float m) { if (!(m < 1000f)) { return (m / 1000f).ToString("0.0") + " km"; } return Mathf.RoundToInt(m) + " m"; } private static string Ago(long unix) { long num = PortalCache.Now() - unix; if (num < 120) { return "just now"; } if (num < 7200) { return num / 60 + " min ago"; } if (num < 172800) { return num / 3600 + " h ago"; } return num / 86400 + " d ago"; } } public sealed class PortalLinesGraphic : MaskableGraphic { private const float DashLength = 14f; private const float GapLength = 9f; public RawImage MapImage; public bool IsLarge = true; private Rect _lastUv; private Rect _lastRect; private int _lastVersion = -1; private int _lastHover = -1; private bool _styleDirty = true; public void MarkStyleDirty() { _styleDirty = true; } private void LateUpdate() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_006a: 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) if (!((Object)(object)MapImage == (Object)null)) { Rect uvRect = MapImage.uvRect; Rect rect = ((Graphic)MapImage).rectTransform.rect; int version = PortalRegistry.Snapshot.Version; int num = (IsLarge ? (HoverState.Version + RouteState.Version * 1000) : 0); if (_styleDirty || uvRect != _lastUv || rect != _lastRect || version != _lastVersion || num != _lastHover) { _lastUv = uvRect; _lastRect = rect; _lastVersion = version; _lastHover = num; _styleDirty = false; ((Graphic)this).SetVerticesDirty(); } } } protected override void OnPopulateMesh(VertexHelper vh) { //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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: 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_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (m