using System;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BoneLib;
using BoneLib.BoneMenu;
using HarmonyLib;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using SprInput;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(Core), "SprInput", "1.2.1", "jorink", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("SprInput")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+268b9914e273aff4fb7069e0c259e608f337d114")]
[assembly: AssemblyProduct("SprInput")]
[assembly: AssemblyTitle("SprInput")]
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace SprInput
{
public class Core : 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)GetLeftController())
{
__result = false;
}
}
}
private static MelonPreferences_Category category;
private static MelonPreferences_Entry<bool> toggleEntry;
private static MelonPreferences_Entry<bool> flickEntry;
private static MelonPreferences_Entry<bool> swingEntry;
private static MelonPreferences_Entry<float> swingEffortEntry;
private static MelonPreferences_Entry<bool> alwaysEntry;
private static bool toggleSprint;
private static BaseController GetLeftController()
{
return Player.LeftController;
}
private static BaseController GetRightController()
{
return Player.RightController;
}
public override void OnInitializeMelon()
{
SetupMelonPreferences();
SetupBoneMenu();
}
private void SetupBoneMenu()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
Page obj = Page.Root.CreatePage("Jorink", Color.red, 0, true).CreatePage("SprInput", Color.yellow, 0, true);
obj.CreateBool("Toggle running", Color.yellow, toggleEntry.Value, (Action<bool>)delegate(bool value)
{
toggleEntry.Value = value;
});
obj.CreateBool("Double-flick to run", Color.yellow, flickEntry.Value, (Action<bool>)delegate(bool value)
{
flickEntry.Value = value;
});
obj.CreateBool("Swing arms to run (overrides other inputs)", Color.blue, swingEntry.Value, (Action<bool>)delegate(bool value)
{
swingEntry.Value = value;
});
obj.CreateFloat("Swing Effort", Color.blue, swingEffortEntry.Value, 0.1f, 0.1f, 1f, (Action<float>)delegate(float value)
{
swingEffortEntry.Value = value;
});
obj.CreateBool("Always Sprint (overrides other inputs)", Color.red, alwaysEntry.Value, (Action<bool>)delegate(bool value)
{
alwaysEntry.Value = value;
});
obj.CreateFunction("Save Settings", Color.cyan, (Action)delegate
{
MelonPreferences.Save();
});
}
private void SetupMelonPreferences()
{
category = MelonPreferences.CreateCategory("SprInput");
toggleEntry = category.CreateEntry<bool>("Toggle running", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
flickEntry = category.CreateEntry<bool>("Double-flick to run", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
swingEntry = category.CreateEntry<bool>("Swing arms to run", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
swingEffortEntry = category.CreateEntry<float>("Swing Effort", 0.5f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
alwaysEntry = category.CreateEntry<bool>("Always Sprint", false, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
MelonPreferences.Save();
category.SaveToFile(true);
}
public override void OnUpdate()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
OpenControllerRig controllerRig = Player.ControllerRig;
if (!Object.op_Implicit((Object)(object)controllerRig))
{
return;
}
RemapRig remapRig = Player.RemapRig;
if (!Object.op_Implicit((Object)(object)remapRig))
{
return;
}
BaseController leftController = GetLeftController();
if (!Object.op_Implicit((Object)(object)leftController))
{
return;
}
if (alwaysEntry.Value)
{
remapRig.travState = (TraversalState)1;
return;
}
if (swingEntry.Value)
{
BaseController rightController = GetRightController();
if (Object.op_Implicit((Object)(object)rightController))
{
Vector3 relativeVelocityInWorld = leftController.GetRelativeVelocityInWorld();
float magnitude = ((Vector3)(ref relativeVelocityInWorld)).magnitude;
relativeVelocityInWorld = rightController.GetRelativeVelocityInWorld();
float magnitude2 = ((Vector3)(ref relativeVelocityInWorld)).magnitude;
bool flag = Mathf.Max(magnitude, magnitude2) >= swingEffortEntry.Value;
remapRig.travState = (TraversalState)(flag ? 1 : 0);
}
return;
}
if (!flickEntry.Value && !toggleEntry.Value)
{
controllerRig._wasOverFlickThresh = false;
}
if (toggleEntry.Value)
{
if (leftController._thumbstickDown)
{
toggleSprint = !toggleSprint;
}
remapRig.travState = (TraversalState)(toggleSprint ? 1 : 0);
}
}
}
}