Decompiled source of RandomMap v1.0.1

Mods/RandomMap.dll

Decompiled a month ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BoneLib.BoneMenu;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using RandomMap;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(global::RandomMap.RandomMap), "RandomMap", "1.0.0", "Man2787", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: AssemblyTitle("RandomMap")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RandomMap")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("937d873b-687a-4936-92bd-459cfac449c0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RandomMap;

public class RandomMap : MelonMod
{
	private bool hasLoadedAdditive;

	private LevelCrate GetRandomLevel()
	{
		List<LevelCrate> crates = AssetWarehouse.Instance.GetCrates<LevelCrate>((ICrateFilter<LevelCrate>)null);
		int num = Random.Range(0, crates.Count - 1);
		return crates[num];
	}

	private void LoadRandom()
	{
		((MelonBase)this).LoggerInstance.Msg("Loading a Random map");
		SceneStreamer.Load(((Scannable)GetRandomLevel()).Barcode, (Barcode)null);
	}

	private void LoadRandomAdditive()
	{
		((MelonBase)this).LoggerInstance.Msg("Loading a Random map ADDITATIVE");
		hasLoadedAdditive = true;
		((MarrowAsset)GetRandomLevel().MainScene).LoadSceneAsync((LoadSceneMode)1, true, 100);
	}

	private void AskLoadRandomAdditive()
	{
		if (hasLoadedAdditive)
		{
			LoadRandomAdditive();
			return;
		}
		Menu.DisplayDialog("Are you sure", "This will load a scene in additon to your current scene\nTHIS WILL NOT APPEAR AGAIN", Dialog.WarningIcon, (Action)delegate
		{
			LoadRandomAdditive();
		}, (Action)null);
	}

	public override void OnInitializeMelon()
	{
		//IL_0010: 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_003e: Unknown result type (might be due to invalid IL or missing references)
		((MelonBase)this).OnInitializeMelon();
		Page obj = Page.Root.CreatePage("Random Map", Color.white, 0, true);
		obj.CreateFunction("Load Random", Color.white, (Action)LoadRandom);
		obj.CreateFunction("Load Random (ADDITATIVE)", Color.red, (Action)AskLoadRandomAdditive);
	}
}