Decompiled source of Sprint Invert v1.0.1

SprintInvert.dll

Decompiled 3 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Opsive.UltimateCharacterController.Character.Abilities;
using UnityEngine;
using VoidManager;
using VoidManager.CustomGUI;
using VoidManager.MPModChecks;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("SprintInvert")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Inverts sprint keybind. Client-Side.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+72187a974a43a9c57ac17f9752ac3b4b6cca56ac")]
[assembly: AssemblyProduct("SprintInvert")]
[assembly: AssemblyTitle("Inverts sprint keybind. Client-Side.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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 SprintInvert
{
	[BepInPlugin("18107.SprintInvert", "SprintInvert", "1.0.1")]
	[BepInProcess("Void Crew.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BepinPlugin : BaseUnityPlugin
	{
		internal static ManualLogSource Log;

		internal static ConfigEntry<bool> SprintInvertEnabled;

		internal static ConfigEntry<bool> TapToggleEnabled;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			SprintInvertEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SprintInvertEnabled", true, (ConfigDescription)null);
			TapToggleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "TapToggleEnabled", false, (ConfigDescription)null);
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "18107.SprintInvert");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin 18107.SprintInvert is loaded!");
		}
	}
	internal class GUI : ModSettingsMenu
	{
		public override string Name()
		{
			return "Sprint Inverted: " + BepinPlugin.SprintInvertEnabled.Value;
		}

		public override void Draw()
		{
			if (GUILayout.Button("Sprint Inverted: " + BepinPlugin.SprintInvertEnabled.Value, Array.Empty<GUILayoutOption>()))
			{
				BepinPlugin.SprintInvertEnabled.Value = !BepinPlugin.SprintInvertEnabled.Value;
			}
			if (GUILayout.Button("Tap Toggle: " + (BepinPlugin.TapToggleEnabled.Value ? "Enabled" : "Disabled"), Array.Empty<GUILayoutOption>()))
			{
				BepinPlugin.TapToggleEnabled.Value = !BepinPlugin.TapToggleEnabled.Value;
			}
		}
	}
	[HarmonyPatch(typeof(SpeedChangeToggle), "Start")]
	internal class InitRunningPatch
	{
		private static MethodInfo StopRunningMI = AccessTools.Method(typeof(SpeedChangeToggle), "StopRunning", (Type[])null, (Type[])null);

		private static void Postfix(SpeedChangeToggle __instance)
		{
			StopRunningMI.Invoke(__instance, null);
		}
	}
	public class MyPluginInfo
	{
		public const string PLUGIN_GUID = "18107.SprintInvert";

		public const string PLUGIN_NAME = "SprintInvert";

		public const string USERS_PLUGIN_NAME = "Sprint Invert";

		public const string PLUGIN_VERSION = "1.0.1";

		public const string PLUGIN_DESCRIPTION = "Inverts sprint keybind. Client-Side.";

		public const string PLUGIN_ORIGINAL_AUTHOR = "18107";

		public const string PLUGIN_AUTHORS = "18107, Dragon";

		public const string PLUGIN_THUNDERSTORE_ID = "";
	}
	[HarmonyPatch(typeof(SpeedChangeToggle), "OnInputSpeedChangeRelease")]
	internal class TapTogglePatch
	{
		private static MethodInfo StopRunningMI = AccessTools.Method(typeof(SpeedChangeToggle), "StopRunning", (Type[])null, (Type[])null);

		private static void Postfix(SpeedChangeToggle __instance)
		{
			if (!BepinPlugin.TapToggleEnabled.Value)
			{
				StopRunningMI.Invoke(__instance, null);
			}
		}
	}
	[HarmonyPatch(typeof(SpeedChangeToggle), "ChangeActiveState")]
	internal class ToggleStatePatch
	{
		private static void Prefix(ref bool active)
		{
			if (BepinPlugin.SprintInvertEnabled.Value)
			{
				active = !active;
			}
		}
	}
	public class VoidManagerPlugin : VoidPlugin
	{
		public override MultiplayerType MPType => (MultiplayerType)8;

		public override string Author => "18107, Dragon";

		public override string Description => "Inverts sprint keybind. Client-Side.";

		public override string ThunderstoreID => "";
	}
}