Decompiled source of EasySprint v1.0.2

Mods/EasySprint.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using EasySprint;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(EasySprintMod), "EasySprint", "1.0.2", "art0007i", "https://github.com/art0007i/EasySprint")]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: MelonColor(255, 250, 202, 222)]
[assembly: MelonAuthorColor(255, 34, 221, 136)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("art0007i")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.2.0")]
[assembly: AssemblyInformationalVersion("1.0.2")]
[assembly: AssemblyProduct("EasySprint")]
[assembly: AssemblyTitle("EasySprint")]
[assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/art0007i/EasySprint")]
[assembly: AssemblyVersion("1.0.2.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace EasySprint
{
	public class BoneLibMenu
	{
		private Page _page = Page.Root.CreatePage("EasySprint", new Color(0.134f, 0.867f, 0.534f), 0, true);

		public void AddToggle(MelonPreferences_Entry<bool> toggle)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			_page.CreateBool(((MelonPreferences_Entry)toggle).DisplayName, Color.white, toggle.Value, (Action<bool>)delegate(bool b)
			{
				toggle.Value = b;
			});
		}
	}
	public class EasySprintMod : MelonMod
	{
		private MelonPreferences_Entry<bool> _toggleSprint;

		private MelonPreferences_Entry<bool> _noDoubleFlick;

		private bool _isSprinting;

		public override void OnInitializeMelon()
		{
			MelonPreferences_Category val = MelonPreferences.CreateCategory("art0007i.EasySprint");
			_toggleSprint = val.CreateEntry<bool>("toggle_sprint", true, "Sprint Toggle", "If true, clicking the stick will toggle sprinting", false, false, (ValueValidator)null, (string)null);
			_noDoubleFlick = val.CreateEntry<bool>("no_double_flick", true, "Disable Double Flick Sprint", "If true, double flicking won't make you sprint (it doesn't work if toggle sprint is enabled anyway)", false, false, (ValueValidator)null, (string)null);
			val.SaveToFile(false);
			try
			{
				BoneLibMenu boneLibMenu = new BoneLibMenu();
				boneLibMenu.AddToggle(_toggleSprint);
				boneLibMenu.AddToggle(_noDoubleFlick);
			}
			catch (Exception ex)
			{
				MelonLogger.Error("Failed to create BoneLibMenu. Error: " + ex);
			}
		}

		public override void OnUpdate()
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Invalid comparison between Unknown and I4
			OpenControllerRig controllerRig = Player.ControllerRig;
			if (!Object.op_Implicit((Object)(object)controllerRig))
			{
				return;
			}
			if (_noDoubleFlick.Value)
			{
				controllerRig._wasOverFlickThresh = false;
			}
			if (!_toggleSprint.Value)
			{
				return;
			}
			if (((ControllerRig)controllerRig)._primaryStickDown)
			{
				_isSprinting = !_isSprinting;
			}
			RemapRig remapRig = Player.RemapRig;
			if (Object.op_Implicit((Object)(object)remapRig))
			{
				if (_isSprinting && (int)remapRig.travState == 0)
				{
					remapRig.travState = (TraversalState)1;
				}
				else if (!_isSprinting && (int)remapRig.travState == 1)
				{
					remapRig.travState = (TraversalState)0;
				}
			}
		}
	}
	internal static class ModInfo
	{
		public const string MOD_VERSION = "1.0.2";

		public const string MOD_AUTHOR = "art0007i";

		public const string MOD_URL = "https://github.com/art0007i/EasySprint";
	}
}