Decompiled source of INeedToGetPlaces v2.0.5

Mods/INeedToGetPlaces.dll

Decompiled 5 days ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using INeedToGetPlaces;
using Il2CppRUMBLE.Players.Subsystems;
using Il2CppSystem;
using MelonLoader;
using RumbleModUI;
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), "INeedToGetPlaces", "2.0.5", "ERROR", null)]
[assembly: MelonGame("Buckethead Entertainment", "RUMBLE")]
[assembly: MelonColor(255, 255, 0, 0)]
[assembly: MelonAuthorColor(255, 0, 0, 255)]
[assembly: AssemblyTitle("INeedToGetPlaces")]
[assembly: AssemblyDescription("We got places to be! Hold down right trigger in the gym in order to walk faster")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("INeedToGetPlaces")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b10c94a1-8a40-4701-bc5b-98eabb44dfea")]
[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 INeedToGetPlaces;

public static class BuildInfo
{
	public const string ModName = "INeedToGetPlaces";

	public const string ModVersion = "2.0.5";

	public const string Description = "Sets walking speed in gym or private parks to a certain multiplier when holding right trigger";

	public const string Author = "ERROR";

	public const string Company = "";
}
public class main : MelonMod
{
	private Mod INeedToGetPlaces = new Mod();

	private UI UI = UI.instance;

	private string currentScene;

	private ModSetting<float> SpeedMultiplier;

	private float speedMultiplier;

	private ModSetting<bool> Enabled;

	private bool enabled;

	private int Wait;

	public override void OnLateInitializeMelon()
	{
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00aa: Expected O, but got Unknown
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Expected O, but got Unknown
		INeedToGetPlaces.ModName = "INeedToGetPlaces";
		INeedToGetPlaces.ModVersion = "2.0.5";
		INeedToGetPlaces.SetFolder("INeedToGetPlaces");
		INeedToGetPlaces.AddDescription("Description", "", "Sets walking speed in gym or private parks to a certain multiplier when holding right trigger", new Tags
		{
			IsSummary = true
		});
		SpeedMultiplier = INeedToGetPlaces.AddToList("Speed Multiplier", 4f, "Multiplies your speed where 1 is normal speed, 0.5 is half speed, and 2 is double the speed." + Environment.NewLine + "Enter the number in the box, hit enter, and then click save." + Environment.NewLine + "WARNING: Changing walking speed also makes you sprint a lot faster.", new Tags());
		Enabled = INeedToGetPlaces.AddToList("Enabled", true, 0, "Toggles if trigger should multiply your speed or not", new Tags());
		INeedToGetPlaces.GetFromFile();
		INeedToGetPlaces.ModSaved += Save;
		UI.instance.UI_Initialized += OnUIInit;
	}

	public void OnUIInit()
	{
		UI.AddMod(INeedToGetPlaces);
	}

	public void Save()
	{
		speedMultiplier = (float)((ModSetting)SpeedMultiplier).Value;
		enabled = (bool)((ModSetting)Enabled).Value;
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		if (currentScene != "Loader")
		{
			Save();
		}
	}

	public override void OnFixedUpdate()
	{
		if (!(currentScene == "Gym") && (!(currentScene == "Park") || !(((Object)Park.GetParkBoardParkVariant().currentParkDoorPolicyImage.sprite).name == "Closed_Park_Icon")))
		{
			return;
		}
		if (Wait >= 120)
		{
			if (RightController.GetTrigger() > 0.9f && enabled)
			{
				Players.GetLocalPlayer().Controller.GetSubsystem<PlayerMovement>().desiredMovementVelocity = 0.25f * speedMultiplier;
			}
			else
			{
				Players.GetLocalPlayer().Controller.GetSubsystem<PlayerMovement>().desiredMovementVelocity = 0.25f;
			}
		}
		else
		{
			Wait++;
		}
	}
}