Decompiled source of ModMenuByTibeStinkt v0.0.9

ModMenuUltrakill.dll

Decompiled 2 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("ModMenuUltrakill")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ModMenuUltrakill")]
[assembly: AssemblyTitle("ModMenuUltrakill")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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 ModMenuUltrakill
{
	[BepInPlugin("ModMenu.UltraKill.Kazz", "Mod Menu", "1.0.0")]
	public class Class1 : BaseUnityPlugin
	{
		private NewMovement player;

		private OptionsManager optionsManager;

		private EnemyIdentifier[] enemyIdentifierListFinal;

		private EnemyIdentifierIdentifier[] enemyIdentifierIdentifierList;

		private Nailgun nailGun;

		private bool showMenu = false;

		private string walkSpeedInput = "750";

		private string jumpForceInput = "75";

		private string slowMotionInput = "0";

		private Vector2 scrollPosition = Vector2.zero;

		private bool isGodMode;

		private string godModeText = "DISABLED";

		private bool infiniteDash;

		private string infiniteDashText = "DISABLED";

		private bool unlimitedAmmo;

		private string unlimitedAmmoText = "DISABLED";

		private float walkSpeed;

		private float jumpForce;

		private Image hurtScreen;

		private bool isInSlowMotion;

		private float slowMotionValue = 0.5f;

		private bool settedDefTimeScale;

		public float standSpeed;

		public float standJumpForce;

		public float standSlowMotionTime = 0.5f;

		private bool settedStandValue;

		private WeaponCharges weaponCharges;

		private Canvas uiCanvas;

		private bool settingsMenuEnabled;

		private bool controllsMenuEnabled;

		private void Start()
		{
		}

		private void Update()
		{
			if ((Object)(object)weaponCharges == (Object)null)
			{
				weaponCharges = MonoSingleton<WeaponCharges>.Instance;
			}
			if ((Object)(object)player == (Object)null)
			{
				player = MonoSingleton<NewMovement>.Instance;
				optionsManager = MonoSingleton<OptionsManager>.Instance;
			}
			else
			{
				if (optionsManager.mainMenu || !((Object)(object)optionsManager != (Object)null))
				{
					return;
				}
				if ((Object)(object)hurtScreen == (Object)null)
				{
					hurtScreen = player.hurtScreen;
				}
				if (isGodMode)
				{
					if (player.hp != 100)
					{
						player.hp = 100;
					}
					if ((Object)(object)player.hurtScreen != (Object)null)
					{
						player.hurtScreen = null;
					}
				}
				else if ((Object)(object)player.hurtScreen == (Object)null)
				{
					player.hurtScreen = hurtScreen;
				}
				if (infiniteDash)
				{
					player.boostCharge = 300f;
				}
				if (Input.GetKeyDown((KeyCode)290))
				{
					ToggleMenu();
				}
				if (Input.GetKeyDown((KeyCode)121))
				{
					ToggleSlowMotion();
				}
				if (isInSlowMotion && !optionsManager.paused)
				{
					Time.timeScale = slowMotionValue;
					settedDefTimeScale = false;
				}
				else if (!settedDefTimeScale)
				{
					settedDefTimeScale = true;
					Time.timeScale = 1f;
				}
				if (standSpeed == 0f)
				{
					standSpeed = player.walkSpeed;
					standJumpForce = player.jumpPower;
				}
				if (!settedStandValue && standSpeed != 0f)
				{
					walkSpeedInput = standSpeed.ToString();
					jumpForceInput = standJumpForce.ToString();
					slowMotionInput = "1";
					settedStandValue = true;
				}
				if (unlimitedAmmo && (Object)(object)weaponCharges != (Object)null)
				{
					weaponCharges.naiAmmo = 100f;
				}
			}
		}

		private void ToggleMenu()
		{
			showMenu = !showMenu;
			Cursor.lockState = (CursorLockMode)((!showMenu) ? 1 : 0);
			Cursor.visible = showMenu;
		}

		private void ToggleSlowMotion()
		{
			isInSlowMotion = !isInSlowMotion;
			Time.timeScale = (isInSlowMotion ? slowMotionValue : 1f);
		}

		private void OnGUI()
		{
			//IL_050e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0532: Unknown result type (might be due to invalid IL or missing references)
			//IL_0556: 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_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_011d: 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_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_0165: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_040e: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)optionsManager != (Object)null && !optionsManager.mainMenu && showMenu && (Object)(object)player != (Object)null)
			{
				GUI.Box(new Rect(5f, 5f, 400f, 800f), "Mod Menu");
				if (GUI.Button(new Rect(60f, 30f, 100f, 30f), "Settings"))
				{
					settingsMenuEnabled = true;
					controllsMenuEnabled = false;
				}
				if (GUI.Button(new Rect(210f, 30f, 100f, 30f), "Controls"))
				{
					settingsMenuEnabled = false;
					controllsMenuEnabled = true;
				}
				if (settingsMenuEnabled)
				{
					scrollPosition = GUI.BeginScrollView(new Rect(10f, 80f, 400f, 800f), scrollPosition, new Rect(0f, 0f, 400f, 400f));
					GUI.Label(new Rect(10f, 45f, 100f, 30f), "Walk Speed:");
					walkSpeedInput = GUI.TextField(new Rect(120f, 45f, 200f, 30f), walkSpeedInput);
					GUI.Label(new Rect(10f, 80f, 100f, 30f), "JumpForce:");
					jumpForceInput = GUI.TextField(new Rect(120f, 80f, 200f, 30f), jumpForceInput);
					GUI.Label(new Rect(10f, 120f, 120f, 30f), "Slow Motion Time:");
					slowMotionInput = GUI.TextField(new Rect(120f, 120f, 200f, 30f), slowMotionInput);
					if (float.TryParse(walkSpeedInput, out var result))
					{
						walkSpeed = result;
						player.walkSpeed = walkSpeed;
					}
					if (float.TryParse(jumpForceInput, out var result2))
					{
						jumpForce = result2;
						player.jumpPower = jumpForce;
					}
					if (float.TryParse(slowMotionInput, out var result3))
					{
						slowMotionValue = result3;
					}
					GUI.Label(new Rect(150f, 180f, 200f, 30f), godModeText);
					if (GUI.Button(new Rect(10f, 180f, 100f, 30f), "GodMode"))
					{
						isGodMode = !isGodMode;
						godModeText = (isGodMode ? "ENABLED" : "DISABLED");
					}
					GUI.Label(new Rect(150f, 230f, 200f, 30f), infiniteDashText);
					if (GUI.Button(new Rect(10f, 230f, 100f, 30f), "InfiniteDash"))
					{
						infiniteDash = !infiniteDash;
						infiniteDashText = (infiniteDash ? "ENABLED" : "DISABLED");
					}
					GUI.Label(new Rect(250f, 270f, 200f, 30f), unlimitedAmmoText);
					if (GUI.Button(new Rect(10f, 270f, 225f, 30f), "Unlimted Ammo (Nail gun)"))
					{
						unlimitedAmmo = !unlimitedAmmo;
						unlimitedAmmoText = (unlimitedAmmo ? "ENABLED" : "DISABLED");
					}
					if (GUI.Button(new Rect(10f, 330f, 225f, 30f), "Kill All Enemies"))
					{
						enemyIdentifierListFinal = Object.FindObjectsOfType<EnemyIdentifier>();
						enemyIdentifierIdentifierList = Object.FindObjectsOfType<EnemyIdentifierIdentifier>();
						EnemyIdentifier[] array = enemyIdentifierListFinal;
						foreach (EnemyIdentifier val in array)
						{
							val.Explode(false);
							val.InstaKill();
						}
						EnemyIdentifierIdentifier[] array2 = enemyIdentifierIdentifierList;
						foreach (EnemyIdentifierIdentifier val2 in array2)
						{
							Object.Destroy((Object)(object)((Component)val2).gameObject);
						}
					}
					GUI.EndScrollView();
				}
				else
				{
					GUI.Label(new Rect(10f, 80f, 100f, 30f), "Slow Motion: Y");
				}
			}
			if ((Object)(object)optionsManager != (Object)null && optionsManager.mainMenu)
			{
				GUI.Box(new Rect(5f, 5f, 400f, 200f), "About Mod Menu");
				GUI.Label(new Rect(10f, 80f, 400f, 50f), "PRESS F9 TO OPEN MOD MENU IN THE GAME");
				GUI.Label(new Rect(10f, 125f, 350f, 140f), "Thanks for everyone that downloaded the mod <3");
			}
		}
	}
}