Decompiled source of ReverseSprintControl v1.0.0

repo mod8.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("repo mod8")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("repo mod8")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("846c1df0-1f66-4509-9207-b4d503f8ab62")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.ar.reversesprint", "Reverse Sprint Control", "5.1.0")]
public class ReverseSprintMod : BaseUnityPlugin
{
	[HarmonyPatch(typeof(PlayerController), "FixedUpdate")]
	private class SprintCheck
	{
		private static void Prefix(PlayerController __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				bool sprinting = __instance.sprinting;
				if (sprinting && !lastSprint)
				{
					reverseActive = Random.value < ReverseChance.Value;
				}
				if (!sprinting && lastSprint)
				{
					reverseActive = false;
				}
				lastSprint = sprinting;
			}
		}
	}

	[HarmonyPatch(typeof(SemiFunc), "InputMovementY")]
	private class ReverseY
	{
		private static void Postfix(ref float __result)
		{
			if (reverseActive && ReverseForward.Value)
			{
				__result *= -1f;
			}
		}
	}

	[HarmonyPatch(typeof(SemiFunc), "InputMovementX")]
	private class ReverseX
	{
		private static void Postfix(ref float __result)
		{
			if (reverseActive && ReverseSide.Value)
			{
				__result *= -1f;
			}
		}
	}

	private static bool reverseActive;

	private static bool lastSprint;

	public static ConfigEntry<float> ReverseChance;

	public static ConfigEntry<bool> ReverseForward;

	public static ConfigEntry<bool> ReverseSide;

	private void Awake()
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Expected O, but got Unknown
		//IL_0094: Unknown result type (might be due to invalid IL or missing references)
		((BaseUnityPlugin)this).Logger.LogInfo((object)"ReverseSprintMod Loaded (v5.1.0)");
		ReverseChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Reverse Chance", 0.75f, new ConfigDescription("ダッシュ開始時に操作が反転する確率", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>()));
		ReverseForward = ((BaseUnityPlugin)this).Config.Bind<bool>("Control", "Reverse Forward/Back (W/S)", true, "前後移動を反転する");
		ReverseSide = ((BaseUnityPlugin)this).Config.Bind<bool>("Control", "Reverse Left/Right (A/D)", true, "左右移動を反転する");
		new Harmony("com.ar.reversesprint").PatchAll();
	}
}