using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using ErenshorMods.Input;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Sprint.Config;
using Sprint.Core;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Sprint")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+da54a6a010598788c467b5d082673a1649aac93b")]
[assembly: AssemblyProduct("Sprint")]
[assembly: AssemblyTitle("Sprint")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
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;
}
}
[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 ErenshorMods.Input
{
public interface IKeyboardInput
{
bool IsHeld(KeyCode key);
bool WasPressed(KeyCode key);
}
public sealed class UnityKeyboardInput : IKeyboardInput
{
public static UnityKeyboardInput Instance { get; } = new UnityKeyboardInput();
private UnityKeyboardInput()
{
}
public bool IsHeld(KeyCode key)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return Input.GetKey(key);
}
public bool WasPressed(KeyCode key)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return Input.GetKeyDown(key);
}
}
public static class KeyboardShortcuts
{
public static bool WasPressed(KeyCode key, IKeyboardInput keyboard)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
return (int)key != 0 && keyboard.WasPressed(key);
}
public static bool IsHeld(IReadOnlyList<KeyCode> keys, IKeyboardInput keyboard)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (keys.Count == 0)
{
return false;
}
for (int i = 0; i < keys.Count; i++)
{
if ((int)keys[i] == 0 || !keyboard.IsHeld(keys[i]))
{
return false;
}
}
return true;
}
public static bool IsHeld(KeyCode mainKey, IReadOnlyList<KeyCode> modifiers, IKeyboardInput keyboard)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if ((int)mainKey == 0 || !keyboard.IsHeld(mainKey))
{
return false;
}
for (int i = 0; i < modifiers.Count; i++)
{
if ((int)modifiers[i] == 0 || !keyboard.IsHeld(modifiers[i]))
{
return false;
}
}
return true;
}
}
}
namespace Sprint
{
internal static class PluginInfo
{
public const string GUID = "wow-much.sprint";
public const string Name = "Sprint";
public const string Version = "2026.717.0";
}
[BepInPlugin("wow-much.sprint", "Sprint", "2026.717.0")]
public sealed class Plugin : BaseUnityPlugin
{
private sealed class BepSprintSettings : ISprintSettings
{
private readonly ConfigEntry<bool> _enabled;
private readonly ConfigEntry<bool> _toggleMode;
private readonly ConfigEntry<float> _multiplier;
public bool Enabled => _enabled.Value;
public bool ToggleMode => _toggleMode.Value;
public float Multiplier => _multiplier.Value;
internal BepSprintSettings(ConfigEntry<bool> enabled, ConfigEntry<bool> toggleMode, ConfigEntry<float> multiplier)
{
_enabled = enabled;
_toggleMode = toggleMode;
_multiplier = multiplier;
}
}
private ConfigEntry<bool> _enabled = null;
private ConfigEntry<KeyboardShortcut> _sprintKey = null;
private ConfigEntry<bool> _toggleMode = null;
private ConfigEntry<float> _sprintMultiplier = null;
private BepSprintSettings _settings = null;
private KeyCode[] _sprintModifiers = Array.Empty<KeyCode>();
private void Awake()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Expected O, but got Unknown
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
_enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch. When false, sprint is disabled.");
_sprintKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "SprintKey", new KeyboardShortcut((KeyCode)304, Array.Empty<KeyCode>()), "Controls sprinting. Hold it, or tap to toggle when Toggle Mode is enabled.");
_toggleMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Controls", "ToggleMode", false, "If true, tap sprint key to toggle sprint on/off. If false, hold it to sprint.");
_sprintMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "SprintMultiplier", 1.5f, new ConfigDescription("Speed multiplier when sprinting. 1.5 = 50% faster, 2.0 = 100% faster.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
_sprintKey.SettingChanged += OnSprintKeyChanged;
CacheSprintShortcut();
_settings = new BepSprintSettings(_enabled, _toggleMode, _sprintMultiplier);
SprintRuntime.Start(_settings);
((BaseUnityPlugin)this).Logger.LogInfo((object)("Sprint v2026.717.0 loaded\n" + $" Sprint Key: {_sprintKey.Value}\n" + " Toggle Mode: " + (_toggleMode.Value ? "Enabled" : "Disabled") + "\n" + $" Speed Multiplier: {_sprintMultiplier.Value}x"));
}
private void Update()
{
SprintRuntime.Tick(IsSprintPressed());
}
private void OnDestroy()
{
_sprintKey.SettingChanged -= OnSprintKeyChanged;
SprintRuntime.Stop();
}
private void OnSprintKeyChanged(object sender, EventArgs args)
{
CacheSprintShortcut();
}
private void CacheSprintShortcut()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = _sprintKey.Value;
List<KeyCode> list = new List<KeyCode>();
foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers)
{
list.Add(modifier);
}
_sprintModifiers = ((list.Count == 0) ? Array.Empty<KeyCode>() : list.ToArray());
}
private bool IsSprintPressed()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
KeyboardShortcut value = _sprintKey.Value;
return KeyboardShortcuts.IsHeld(((KeyboardShortcut)(ref value)).MainKey, _sprintModifiers, UnityKeyboardInput.Instance);
}
}
}
namespace Sprint.Patches
{
[HarmonyPatch(typeof(Stats), "CalcStats")]
internal static class CalcStatsPatch
{
[HarmonyPostfix]
private static void CalcStats_Postfix(Stats __instance)
{
SprintRuntime.OnStatsCalculated(__instance);
}
}
}
namespace Sprint.Core
{
internal static class SprintRuntime
{
private const float DefaultMultiplier = 1.5f;
private static Harmony? _harmony;
private static ISprintSettings? _settings;
private static Stats? _playerStats;
private static bool _sprintToggled;
private static bool _previousKeyPressed;
private static bool _active;
private static float _multiplier = 1.5f;
private static bool _started;
internal static bool Start(ISprintSettings settings)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
if (_started)
{
return false;
}
if (settings == null)
{
throw new ArgumentNullException("settings");
}
_settings = settings;
_multiplier = settings.Multiplier;
_harmony = new Harmony("wow-much.sprint");
_harmony.PatchAll();
_started = true;
return true;
}
internal static void Tick(bool keyPressed)
{
if (!_started || _settings == null)
{
return;
}
if ((Object)(object)_playerStats == (Object)null)
{
GameObject val = GameObject.Find("Player");
if ((Object)(object)val != (Object)null)
{
_playerStats = val.GetComponent<Stats>();
}
_active = false;
return;
}
_multiplier = _settings.Multiplier;
if (!_settings.Enabled)
{
_sprintToggled = false;
_active = false;
_previousKeyPressed = keyPressed;
}
else if (_settings.ToggleMode)
{
if (keyPressed && !_previousKeyPressed)
{
_sprintToggled = !_sprintToggled;
}
_previousKeyPressed = keyPressed;
_active = _sprintToggled;
}
else
{
_previousKeyPressed = keyPressed;
_active = keyPressed;
}
Apply(_playerStats, _active);
}
internal static void OnStatsCalculated(Stats stats)
{
Apply(stats, IsActiveFor(stats));
}
internal static bool IsActiveFor(Stats stats)
{
return _started && _active && (Object)(object)_playerStats != (Object)null && (Object)(object)stats == (Object)(object)_playerStats;
}
internal static void Stop()
{
if (_started)
{
if ((Object)(object)_playerStats != (Object)null)
{
Apply(_playerStats, shouldSprint: false);
}
Harmony? harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
_harmony = null;
Reset();
}
}
internal static void Reset()
{
_settings = null;
_playerStats = null;
_sprintToggled = false;
_previousKeyPressed = false;
_active = false;
_multiplier = 1.5f;
_started = false;
}
internal static void Apply(Stats stats, bool shouldSprint)
{
if (!((Object)(object)stats == (Object)null))
{
float value = Traverse.Create((object)stats).Field("seRunSpeed").GetValue<float>();
stats.actualRunSpeed = (shouldSprint ? ((stats.RunSpeed + value) * _multiplier) : (stats.RunSpeed + value));
if (stats.actualRunSpeed < 2f)
{
stats.actualRunSpeed = 2f;
}
}
}
}
}
namespace Sprint.Config
{
internal interface ISprintSettings
{
bool Enabled { get; }
bool ToggleMode { get; }
float Multiplier { get; }
}
}