Decompiled source of UltraMines v1.0.0

UltraMine.dll

Decompiled 10 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.AddressableAssets;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UltraMine")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UltraMine")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1d43ab1b-e4b5-4a94-aa05-b2b019fd632c")]
[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 UltraMine;

[BepInPlugin("DolfeLive.Ultrakill.UltraMines", "UltraMines", "1.0.0")]
public class UltraMines : BaseUnityPlugin
{
	public const string pluginGuid = "DolfeLive.Ultrakill.UltraMines";

	public const string pluginName = "UltraMines";

	public const string pluginVersion = "1.0.0.0";

	private bool SpawningGo;

	private GameObject LandMine;

	private GameObject Player;

	private float BehindDistance = 1.4f;

	private int CurrentMode = 3;

	private float SpawnSpeed = 0.6f;

	public void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello World!");
		((MonoBehaviour)this).StartCoroutine(SpawnLoop());
		Player = GameObject.Find("Player");
	}

	public void Start()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		//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)
		Harmony val = new Harmony("DolfeLive.Ultrakill.UltraMines");
		val.PatchAll();
		LandMine = Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Attacks and Projectiles/Landmine.prefab").WaitForCompletion();
		((MonoBehaviour)this).StartCoroutine(SpawnLoop());
	}

	private void Update()
	{
		if ((Object)(object)Player == (Object)null)
		{
			Player = GameObject.Find("Player");
		}
		if (Input.GetKey((KeyCode)112))
		{
			SpawnMine();
		}
		if (Input.GetKeyDown((KeyCode)47))
		{
			CurrentMode++;
			if (CurrentMode == 0)
			{
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + CurrentMode + "\nMine spawning on!</color>", "", "", 0, false);
			}
			else if (CurrentMode == 1)
			{
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + CurrentMode + "\nChange speed mode!</color>", "", "", 0, false);
			}
			else if (CurrentMode == 2)
			{
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + CurrentMode + "\nChange Spawn position of mines!</color>", "", "", 0, false);
			}
			else if (CurrentMode == 3)
			{
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + CurrentMode + "\nSpawning disabled!</color>", "", "", 0, false);
			}
			if (CurrentMode >= 4)
			{
				CurrentMode = 0;
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + CurrentMode + "\nSpawning enabled!</color>", "", "", 0, false);
			}
		}
		if (CurrentMode == 1)
		{
			if (Input.GetKeyDown((KeyCode)61))
			{
				SpawnSpeed += 0.1f;
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + SpawnSpeed + " \n(The spawn speed is seconds between spawn)</color>", "", "", 0, false);
			}
			else if (Input.GetKeyDown((KeyCode)45))
			{
				SpawnSpeed += -0.1f;
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + SpawnSpeed + " \n(The spawn speed is seconds between spawn)</color>", "", "", 0, false);
			}
		}
		else if (CurrentMode == 2)
		{
			if (Input.GetKeyDown((KeyCode)61))
			{
				BehindDistance += 0.1f;
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + BehindDistance + " \nThe value controls how far away the mines spawn from you</color>", "", "", 0, false);
			}
			else if (Input.GetKeyDown((KeyCode)45))
			{
				BehindDistance += -0.1f;
				ClearMsg();
				MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("<color=red>" + BehindDistance + " \nThe value controls how far away the mines spawn from you</color>", "", "", 0, false);
			}
		}
	}

	private IEnumerator SpawnLoop()
	{
		if (CurrentMode == 0)
		{
			SpawnMine();
			yield return (object)new WaitForSeconds(SpawnSpeed);
		}
		else if (CurrentMode != 0)
		{
			yield return (object)new WaitForSeconds(1f);
		}
		((MonoBehaviour)this).StartCoroutine(SpawnLoop());
	}

	private void SpawnMine()
	{
		//IL_0016: 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_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		Object.Instantiate<GameObject>(LandMine, GameObject.Find("Player").transform.position - Player.transform.forward * BehindDistance, Quaternion.identity);
	}

	private void ClearMsg()
	{
		MonoSingleton<HudMessageReceiver>.Instance.ClearMessage();
	}
}