using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using HarmonyLib;
using Il2CppSLZ.Marrow;
using MelonLoader;
using UnityEngine;
using jlib;
using sprinput;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(SprInput), "SprInput", "2.0.0", "Jorink", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonColor(255, 255, 255, 0)]
[assembly: MelonAuthorColor(255, 255, 0, 0)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace sprinput;
public class SprInput : MelonMod
{
[HarmonyPatch(typeof(OpenController), "GetThumbStickDown")]
private static class SuppressPressToRun
{
private static void Postfix(OpenController __instance, ref bool __result)
{
if (__result && (Object)(object)__instance == (Object)(object)Player.LeftController)
{
__result = false;
}
}
}
public const string Version = "2.0.0";
private MelonPreferences_Entry<bool> flick;
private MelonPreferences_Entry<bool> toggle;
private MelonPreferences_Entry<bool> swing;
private MelonPreferences_Entry<float> swingEffort;
private MelonPreferences_Entry<float> swingHold;
private MelonPreferences_Entry<bool> always;
private bool toggleSprint;
private float swingTimer;
public override void OnInitializeMelon()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
ModPage val = JLib.Register("SprInput", Color.yellow);
flick = val.Bool("Double-flick to run", true, Color.yellow, (Action<bool>)null);
toggle = val.Bool("Toggle running", false, Color.yellow, (Action<bool>)null);
always = val.Bool("Always Sprint", false, Color.yellow, (Action<bool>)null);
swing = val.Bool("Swing arms to run", false, Color.blue, (Action<bool>)null);
swingEffort = val.Float("Swing Effort", 0.5f, 0.1f, 0.1f, 1f, Color.blue, (Action<float>)null);
swingHold = val.Float("Swing Hold", 0.05f, 0.05f, 0f, 0.1f, Color.blue, (Action<float>)null);
}
public override void OnUpdate()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
OpenControllerRig controllerRig = Player.ControllerRig;
RemapRig remapRig = Player.RemapRig;
if (!Object.op_Implicit((Object)(object)controllerRig) || !Object.op_Implicit((Object)(object)remapRig))
{
return;
}
if (always.Value)
{
remapRig.travState = (TraversalState)1;
}
else if (swing.Value)
{
Vector3 relativeVelocityInWorld = Player.LeftController.GetRelativeVelocityInWorld();
float magnitude = ((Vector3)(ref relativeVelocityInWorld)).magnitude;
relativeVelocityInWorld = Player.RightController.GetRelativeVelocityInWorld();
if (Mathf.Max(magnitude, ((Vector3)(ref relativeVelocityInWorld)).magnitude) >= swingEffort.Value)
{
swingTimer = swingHold.Value;
}
else
{
swingTimer -= Time.deltaTime;
}
remapRig.travState = (TraversalState)(swingTimer > 0f);
}
else if (toggle.Value)
{
if (Player.LeftController._thumbstickDown)
{
toggleSprint = !toggleSprint;
}
remapRig.travState = (TraversalState)(toggleSprint ? 1 : 0);
}
else if (!flick.Value)
{
controllerRig._wasOverFlickThresh = false;
}
}
}