Decompiled source of INeedToGetPlaces v2.0.3

Mods/INeedToGetPlaces.dll

Decompiled 2 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.InputSystem;

[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.3", "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.3";

	public const string Description = "Sets walking speed in gym 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 int Wait;

	private static InputActionMap actionMap = new InputActionMap("actionmap");

	private static InputAction right_trigger = InputActionSetupExtensions.AddAction(actionMap, "Trigger", (InputActionType)1, "<XRController>{RightHand}/trigger", (string)null, (string)null, (string)null, (string)null);

	private bool right_triggerValue;

	public override void OnLateInitializeMelon()
	{
		//IL_0066: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Expected O, but got Unknown
		//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Expected O, but got Unknown
		((MelonBase)this).OnLateInitializeMelon();
		actionMap.Enable();
		MelonLogger.Msg("Input Initiated");
		INeedToGetPlaces.ModName = "INeedToGetPlaces";
		INeedToGetPlaces.ModVersion = "2.0.3";
		INeedToGetPlaces.SetFolder("INeedToGetPlaces");
		INeedToGetPlaces.AddDescription("Description", "", "Sets walking speed in gym 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());
		INeedToGetPlaces.GetFromFile();
		INeedToGetPlaces.ModSaved += Save;
		UI.instance.UI_Initialized += OnUIInit;
	}

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

	public void Save()
	{
		speedMultiplier = (float)((ModSetting)SpeedMultiplier).Value;
		MelonLogger.Msg("Changed Speed Multipler: " + speedMultiplier);
	}

	public override void OnSceneWasLoaded(int buildIndex, string sceneName)
	{
		currentScene = sceneName;
		if (currentScene == "Gym")
		{
			speedMultiplier = (float)((ModSetting)SpeedMultiplier).Value;
		}
	}

	public override void OnFixedUpdate()
	{
		right_triggerValue = right_trigger.ReadValue<float>() == 1f;
		if (!(currentScene == "Gym"))
		{
			return;
		}
		if (Wait >= 120)
		{
			if (right_triggerValue)
			{
				Players.GetLocalPlayer().Controller.GetSubsystem<PlayerMovement>().desiredMovementVelocity = 0.25f * speedMultiplier;
			}
			else
			{
				Players.GetLocalPlayer().Controller.GetSubsystem<PlayerMovement>().desiredMovementVelocity = 0.25f;
			}
		}
		else
		{
			Wait++;
		}
	}
}