Decompiled source of MapSelector v1.0.0

MapPicker.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("Map Picker")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("My first plugin")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Map Picker")]
[assembly: AssemblyTitle("Map Picker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MyFirstBoplPlugin
{
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "Map Picker";

		public const string PLUGIN_NAME = "Map Picker";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace MapPicker
{
	[HarmonyPatch]
	public class Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameSession), "RandomBagLevel")]
		public static void Fixes(GameSession __instance, ref byte ___currentLevel, ref int __result)
		{
			if (int.TryParse(Plugin.mapIdInput, out var result))
			{
				if (result >= 0 && result <= 62)
				{
					___currentLevel = (byte)result;
					__result = ___currentLevel;
					Debug.Log((object)("setting mapid to " + result));
				}
				else
				{
					Debug.LogWarning((object)"Invalid, do 0-62");
				}
			}
			else
			{
				Debug.LogWarning((object)"Invalid");
			}
		}
	}
	[BepInPlugin("com.Melon_David.MapPicker", "Map Picker", "1.1.0")]
	[BepInProcess("BoplBattle.exe")]
	public class Plugin : BaseUnityPlugin
	{
		public static string mapIdInput = "";

		public string GUIName = "Map Selector";

		private Rect windowRect = new Rect(60f, 20f, 180f, 70f);

		public string GUIText = "Map Selector";

		public bool youturnnedmeon = false;

		public string InputText = "";

		public static int MapId = 1;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.Melon_David.MapPicker");
			val.PatchAll();
		}

		private void OnGUI()
		{
			//IL_0001: 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_002b: 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_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			GUI.backgroundColor = Color.black;
			GUI.color = Color.blue;
			if (GUI.Button(new Rect(10f, 85f, 100f, 20f), GUIText))
			{
				if (!youturnnedmeon)
				{
					GUIText = "Close";
					youturnnedmeon = true;
				}
				else
				{
					GUIText = "Select Map";
					youturnnedmeon = false;
				}
			}
			if (youturnnedmeon)
			{
				windowRect = GUI.Window(10000, windowRect, new WindowFunction(MainGUI), GUIName);
			}
		}

		private void MainGUI(int windowID)
		{
			//IL_0015: 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_005d: Unknown result type (might be due to invalid IL or missing references)
			GUI.Label(new Rect(35f, 40f, 180f, 70f), "By Melon/David");
			GUI.Label(new Rect(10f, 20f, 100f, 20f), "Map ID:");
			mapIdInput = GUI.TextField(new Rect(70f, 20f, 100f, 20f), mapIdInput);
			GUI.DragWindow();
		}
	}
}