using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BoneLib; using BoneLib.BoneMenu; using BoneLib.Notifications; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSLZ.Marrow.SceneStreaming; using Il2CppSLZ.Marrow.Warehouse; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using QuickMap; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(QuickMapMod), "QuickMap", "1.1.0", "nontendo", null)] [assembly: MelonGame("Stress Level Zero", "BONELAB")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("QuickMap")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("QuickMap")] [assembly: AssemblyTitle("QuickMap")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace QuickMap { public static class MapBrowser { private static Page? _page; public static void SetPage(Page page) { _page = page; } public static void Populate() { //IL_003b: 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_0070: Unknown result type (might be due to invalid IL or missing references) if (_page == null || !AssetWarehouse.ready) { return; } List crates = AssetWarehouse.Instance.GetCrates(); for (int i = 0; i < crates.Count; i++) { LevelCrate val = ((Il2CppObjectBase)crates[i]).TryCast(); if (!((Object)(object)val == (Object)null)) { string title = ((Scannable)val).Title; string iD = ((Scannable)val).Barcode.ID; string capturedBarcode = iD; string capturedTitle = title; _page.CreateFunction(title, Color.white, (Action)delegate { SelectMap(capturedBarcode, capturedTitle); }); } } } private static void SelectMap(string barcode, string title) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown SavedMap.Set(barcode); QuickMapMod.RefreshLabel(); Notifier.Send(new Notification { Title = new NotificationText { Text = "QuickMap" }, Message = new NotificationText { Text = "Saved: " + title }, Type = (NotificationType)3, ShowTitleOnPopup = true, PopupLength = 2.5f }); } } public static class MapSwitcher { private static bool _waitingToSwitch; private static float _switchTimer; public static string? CurrentLevelBarcode { get; private set; } public static void OnLevelLoaded(LevelInfo info) { //IL_0000: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_007f: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown CurrentLevelBarcode = info.barcode; _waitingToSwitch = false; _switchTimer = 0f; if (SavedMap.Enabled && SavedMap.HasMap && !(info.barcode != "fa534c5a868247138f50c62e424c4144.Level.VoidG114") && !(SavedMap.Barcode == "fa534c5a868247138f50c62e424c4144.Level.VoidG114")) { _waitingToSwitch = true; _switchTimer = SavedMap.Delay; Notifier.Send(new Notification { Title = new NotificationText { Text = "QuickMap" }, Message = new NotificationText { Text = $"Loading {SavedMap.GetDisplayName()} in {SavedMap.Delay:F0}s..." }, Type = (NotificationType)0, ShowTitleOnPopup = true, PopupLength = SavedMap.Delay + 1f }); } } public static void OnUpdate() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (_waitingToSwitch) { _switchTimer -= Time.deltaTime; if (_switchTimer <= 0f) { _waitingToSwitch = false; SceneStreamer.Load(new Barcode(SavedMap.Barcode), (Barcode)null); } } } } public class QuickMapMod : MelonMod { private static FunctionElement? _savedMapLabel; private static bool _browsePagePopulated; public static QuickMapMod Instance { get; private set; } public override void OnInitializeMelon() { Instance = this; SavedMap.Load(); Hooking.OnLevelLoaded += OnLevelLoaded; SetupMenu(); ((MelonBase)this).LoggerInstance.Msg("QuickMap loaded!"); } private static void OnLevelLoaded(LevelInfo info) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) MapSwitcher.OnLevelLoaded(info); if (!_browsePagePopulated) { MapBrowser.Populate(); _browsePagePopulated = true; } } private static Page GetOrCreateQuickModsPage() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) object? data = AppDomain.CurrentDomain.GetData("QuickMods.RootPage"); Page val = (Page)((data is Page) ? data : null); if (val != null) { return val; } Page val2 = Page.Root.CreatePage("Quick Mods", new Color(0.35f, 0.27f, 0.9f), 0, true); AppDomain.CurrentDomain.SetData("QuickMods.RootPage", val2); return val2; } private static void SetupMenu() { //IL_0019: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) Page obj = GetOrCreateQuickModsPage().CreatePage("QuickMap", new Color(0.1f, 0.8f, 0.2f), 0, true); _savedMapLabel = obj.CreateFunction("Saved: " + SavedMap.GetDisplayName(), Color.white, (Action)RefreshLabel); obj.CreateFunction("Save Current Map", Color.green, (Action)SaveCurrentMap); obj.CreateFunction("Clear Saved Map", Color.red, (Action)ClearSavedMap); obj.CreateBool("Auto-Load Enabled", Color.cyan, SavedMap.Enabled, (Action)delegate(bool enabled) { SavedMap.SetEnabled(enabled); }); obj.CreateFloat("Delay (s)", Color.yellow, SavedMap.Delay, 0.5f, 0.5f, 30f, (Action)delegate(float delay) { SavedMap.SetDelay(delay); }); MapBrowser.SetPage(obj.CreatePage("Browse Maps", Color.white, 0, true)); } public static void RefreshLabel() { if (_savedMapLabel != null) { ((Element)_savedMapLabel).ElementName = "Saved: " + SavedMap.GetDisplayName(); } } private static void SaveCurrentMap() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008e: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002c: 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_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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown string currentLevelBarcode = MapSwitcher.CurrentLevelBarcode; if (currentLevelBarcode == null) { Notifier.Send(new Notification { Title = new NotificationText { Text = "QuickMap" }, Message = new NotificationText { Text = "No level is currently loaded!" }, Type = (NotificationType)1, ShowTitleOnPopup = true, PopupLength = 2f }); } else { SavedMap.Set(currentLevelBarcode); RefreshLabel(); Notifier.Send(new Notification { Title = new NotificationText { Text = "QuickMap" }, Message = new NotificationText { Text = "Saved: " + SavedMap.GetDisplayName() }, Type = (NotificationType)3, ShowTitleOnPopup = true, PopupLength = 2.5f }); } } private static void ClearSavedMap() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_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_002d: 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_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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown SavedMap.Clear(); RefreshLabel(); Notifier.Send(new Notification { Title = new NotificationText { Text = "QuickMap" }, Message = new NotificationText { Text = "Saved map cleared. Auto-load disabled." }, Type = (NotificationType)0, ShowTitleOnPopup = true, PopupLength = 2f }); } public override void OnUpdate() { MapSwitcher.OnUpdate(); } } public static class SavedMap { private static readonly MelonPreferences_Category _prefs = MelonPreferences.CreateCategory("QuickMap"); private static readonly MelonPreferences_Entry _barcodeEntry = _prefs.CreateEntry("SavedBarcode", string.Empty, "Saved Map Barcode", (string)null, false, false, (ValueValidator)null, (string)null); private static readonly MelonPreferences_Entry _delayEntry = _prefs.CreateEntry("Delay", 3f, "Auto-Load Delay (seconds)", (string)null, false, false, (ValueValidator)null, (string)null); private static readonly MelonPreferences_Entry _enabledEntry = _prefs.CreateEntry("Enabled", true, "Auto-Load Enabled", (string)null, false, false, (ValueValidator)null, (string)null); public static string? Barcode { get; private set; } public static float Delay { get; private set; } = 3f; public static bool Enabled { get; private set; } = true; public static bool HasMap => Barcode != null; public static void Load() { string value = _barcodeEntry.Value; Barcode = (string.IsNullOrWhiteSpace(value) ? null : value); Delay = _delayEntry.Value; Enabled = _enabledEntry.Value; } public static void Set(string barcode) { Barcode = barcode; _barcodeEntry.Value = barcode; _prefs.SaveToFile(false); } public static void Clear() { Barcode = null; _barcodeEntry.Value = string.Empty; _prefs.SaveToFile(false); } public static void SetDelay(float delay) { Delay = delay; _delayEntry.Value = delay; _prefs.SaveToFile(false); } public static void SetEnabled(bool enabled) { Enabled = enabled; _enabledEntry.Value = enabled; _prefs.SaveToFile(false); } public static string GetDisplayName() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (Barcode == null) { return "None"; } if (AssetWarehouse.ready) { Barcode val = new Barcode(Barcode); LevelCrate val2 = default(LevelCrate); if (AssetWarehouse.Instance.TryGetCrate(val, ref val2)) { return ((Scannable)val2).Title; } } return Barcode; } } }