using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BetterSprint.Patches;
using GameNetcodeStuff;
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("BetterSprint")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("BetterSprint")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a032fdf5-89c9-4430-a30e-218b1ff018e0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace BetterSprint
{
[BepInPlugin("SamBjork.BetterSprint", "BetterSprint", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
private const string modGUID = "SamBjork.BetterSprint";
private const string modName = "BetterSprint";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("SamBjork.BetterSprint");
private static Plugin Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("SamBjork.BetterSprint");
mls.LogInfo((object)"ITS ALIVE!");
harmony.PatchAll(typeof(Plugin));
harmony.PatchAll(typeof(PlayerControllerBPatch));
}
}
}
namespace BetterSprint.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPatch("Update")]
[HarmonyPostfix]
private static void ModifiedSprintPatch(ref float ___sprintMeter, ref float ___sprintTime, ref bool ___isSprinting)
{
float num = 1f;
float num2 = 0.071f;
___sprintTime = 31f;
if (___isSprinting)
{
___sprintMeter = Mathf.Clamp(___sprintMeter - Time.deltaTime / ___sprintTime, 0f, num);
}
else
{
___sprintMeter = Mathf.Clamp(___sprintMeter + Time.deltaTime * num2, 0f, num);
}
}
}
}