Decompiled source of UltraDebt v1.0.0

UltraDebt.dll

Decompiled 10 months ago
using System;
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;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("P-Loss")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("P-Loss")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("126fe09c-95f5-49c7-bec8-91a113c535f3")]
[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 P_Loss;

[BepInPlugin("DolfeMods.Ultrakill.UltraPoor", "UltraPoor", "1.0.0")]
public class Class1 : BaseUnityPlugin
{
	private float timer = 0f;

	private const float updateInterval = 0.001f;

	private bool RanThing = false;

	private float RanThing2 = 0f;

	public void Start()
	{
		//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("DolfeMods.UltraPoor");
		val.PatchAll();
		Debug.Log((object)("Money: " + GameProgressSaver.GetMoney()));
	}

	private void Update()
	{
		if (SceneHelper.CurrentScene == "Main Menu" && RanThing2 < 250f)
		{
			MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage("The UltraDebt mod makes the total amount of P you will recive from a level go down by 1 every millisecond (It can go Negative) \n using a alternate save or a backup of your save is reccomended.", "", "", 0, true);
			RanThing2 += 1f;
		}
		try
		{
			if (!MonoSingleton<StatsManager>.Instance.levelStarted)
			{
				return;
			}
			timer += Time.deltaTime;
			if (!RanThing)
			{
				NewMovement val = Object.FindObjectOfType<NewMovement>();
				Debug.Log((object)"New Movement may or may not have been found");
				if ((Object)(object)val != (Object)null && !RanThing)
				{
					((Component)val).gameObject.AddComponent<MoneyUnnegativerMono>();
				}
				RanThing = true;
				Debug.Log((object)"MoneyNetaiverMono added!");
			}
			if (timer >= 0.001f)
			{
				FinalRank instance = MonoSingleton<FinalRank>.Instance;
				instance.totalPoints--;
				Debug.Log((object)"Deducted points");
				timer = 0f;
			}
		}
		catch (Exception)
		{
		}
	}
}
[HarmonyPatch(typeof(GameProgressSaver), "AddMoney")]
public static class MoneyPatch
{
	[HarmonyPrefix]
	public static void Prefix(ref int money)
	{
		if (!SceneHelper.IsPlayingCustom)
		{
			Debug.Log((object)"Fixing Money");
			if ((Object)(object)Object.FindObjectOfType<MoneyUnnegativerMono>() != (Object)null)
			{
				Object.FindObjectOfType<MoneyUnnegativerMono>().StartFixMoney(money);
			}
			else
			{
				Debug.Log((object)"Failed at fixing Money");
			}
		}
	}
}
[HarmonyPatch]
public static class NoLeaderboard
{
	[HarmonyPatch(typeof(LeaderboardController), "SubmitCyberGrindScore")]
	[HarmonyPrefix]
	public static bool OnSubmitCyberGrindScore()
	{
		return false;
	}

	[HarmonyPatch(typeof(LeaderboardController), "SubmitLevelScore")]
	[HarmonyPrefix]
	public static bool OnSubmitLevelScore()
	{
		return false;
	}
}
public class MoneyUnnegativerMono : MonoBehaviour
{
	public void StartFixMoney(int money)
	{
		((MonoBehaviour)this).StartCoroutine(FixMoney(money));
	}

	private IEnumerator FixMoney(int money)
	{
		Debug.Log((object)"Fixed Money");
		GameProgressMoneyAndGear generalProgress = GameProgressSaver.GetGeneralProgress();
		yield return (object)new WaitForSeconds(0.5f);
		generalProgress.money += money;
	}
}