Decompiled source of HowardSpeedrun v2.0.1

Mods/HowardSpeedrun.dll

Decompiled 5 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using HarmonyLib;
using HowardSpeedrun;
using Il2CppRUMBLE.Environment.Howard;
using Il2CppTMPro;
using MelonLoader;
using RumbleModdingAPI;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(main), "HowardSpeedrun", "2.0.1", "UlvakSkillz", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 195, 0, 255)]
[assembly: MelonAuthorColor(255, 195, 0, 255)]
[assembly: VerifyLoaderVersion(0, 6, 2, true)]
[assembly: AssemblyTitle("HowardSpeedrun")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HowardSpeedrun")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("95dd4b44-114b-446b-b143-721c49169f52")]
[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 HowardSpeedrun;

public class main : MelonMod
{
	[HarmonyPatch(typeof(Howard), "OnActivationLeverChanged")]
	public static class Patch0
	{
		private static void Postfix(int step)
		{
			switch (step)
			{
			case 0:
				howardActive = true;
				howard.currentHp = howard.CurrentSelectedLogic.maxHealth;
				howard.UpdateHealthBarPercentage(100f, false);
				timer.Restart();
				break;
			case 1:
				howardActive = false;
				timer.Stop();
				((TMP_Text)timerTimeComponent).text = timer.Elapsed.ToString();
				break;
			}
		}
	}

	[HarmonyPatch(typeof(Howard), "DealDamage")]
	public static class Patch1
	{
		private static void Postfix()
		{
			if (howard.currentHp <= 0f)
			{
				howard.OnActivationLeverChanged(1);
			}
		}
	}

	private string currentScene = "Loader";

	private bool sceneChanged = false;

	private bool loaded = false;

	private GameObject timerGameObject;

	private GameObject timerTextStatic;

	private GameObject timerTime;

	private static TextMeshPro timerTextComponent;

	private static TextMeshPro timerTimeComponent;

	private static Howard howard;

	private static bool howardActive = false;

	private static Stopwatch timer = new Stopwatch();

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		sceneChanged = true;
		howardActive = false;
	}

	public override void OnFixedUpdate()
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Expected O, but got Unknown
		//IL_00db: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ff: 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_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		if (currentScene != "Gym")
		{
			return;
		}
		if (sceneChanged)
		{
			try
			{
				howard = HowardRoot.GetGameObject().GetComponent<Howard>();
				timerGameObject = new GameObject();
				((Object)timerGameObject).name = "HowardTimer";
				timerTextStatic = Object.Instantiate<GameObject>(Nr.GetGameObject());
				timerTextStatic.transform.parent = timerGameObject.transform;
				((Object)timerTextStatic).name = "TimerText";
				timerTextComponent = timerTextStatic.GetComponent<TextMeshPro>();
				((TMP_Text)timerTextComponent).text = "Time: ";
				((TMP_Text)timerTextComponent).fontSize = 5f;
				((TMP_Text)timerTextComponent).color = new Color(0f, 0f, 0f, 1f);
				((TMP_Text)timerTextComponent).outlineColor = Color32.op_Implicit(new Color(0f, 0f, 0f, 0.5f));
				((TMP_Text)timerTextComponent).alignment = (TextAlignmentOptions)513;
				((TMP_Text)timerTextComponent).enableWordWrapping = false;
				((TMP_Text)timerTextComponent).outlineWidth = 0.1f;
				timerTime = Object.Instantiate<GameObject>(timerTextStatic);
				timerTime.transform.parent = timerGameObject.transform;
				((Object)timerTime).name = "TimerTime";
				timerTimeComponent = timerTime.GetComponent<TextMeshPro>();
				((TMP_Text)timerTimeComponent).text = timer.Elapsed.ToString();
				timerTextStatic.transform.position = new Vector3(-2f, 1f, 0f);
				timerTime.transform.position = new Vector3(-1f, 1f, 0f);
				timerGameObject.transform.position = new Vector3(10.5091f, -0.9382f, -22.3673f);
				timerGameObject.transform.rotation = Quaternion.Euler(0f, 133.5728f, 0f);
				loaded = true;
				sceneChanged = false;
			}
			catch
			{
				return;
			}
		}
		if (loaded && howardActive)
		{
			((TMP_Text)timerTimeComponent).text = timer.Elapsed.ToString();
		}
	}
}