using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("Run")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("HP")] [assembly: AssemblyProduct("Run")] [assembly: AssemblyCopyright("Copyright © HP 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("07f7a2d6-6812-4679-a53d-8ba964c5b75b")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.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.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] [Microsoft.CodeAnalysis.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] [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 Run { [BepInPlugin("YouDied.run", "Run!", "2.0.0")] [BepInProcess("valheim.exe")] public class Run : BaseUnityPlugin { [HarmonyPatch(typeof(Character), "ApplyLiquidResistance")] private static class Patch_ApplyLiquidResistance { [HarmonyPrefix] private static bool Prefix(Character __instance) { Player val = (Player)(object)((__instance is Player) ? __instance : null); if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return true; } return !s_mRun.Invoke(__instance); } } [HarmonyPatch(typeof(Player), "GetRunSpeedFactor")] private static class Patch_GetRunSpeedFactor { [HarmonyPostfix] private static void Postfix(Player __instance, ref float __result) { if (!((Object)(object)__instance != (Object)(object)Player.m_localPlayer)) { __result *= GetEffectiveMultiplier(); } } } public const string PluginGUID = "YouDied.run"; public const string PluginName = "Run!"; public const string PluginVersion = "2.0.0"; internal static ManualLogSource Log = null; private static ConfigEntry _cfgMinMultiplier = null; private static ConfigEntry _cfgMaxMultiplier = null; private static ConfigEntry _cfgStep = null; private static ConfigEntry _cfgCurrentMultiplier = null; private static ConfigEntry _cfgLudicrousEnabled = null; private static ConfigEntry _cfgLudicrousMultiplier = null; private static ConfigEntry _cfgKeyIncrease = null; private static ConfigEntry _cfgKeyDecrease = null; private static int s_multiplier = 100; private Harmony _harmony = null; private static readonly FieldRef s_mRun = AccessTools.FieldRefAccess("m_run"); private void Awake() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; _cfgMinMultiplier = ((BaseUnityPlugin)this).Config.Bind("Speed Range", "MinimumMultiplier", 100, new ConfigDescription("Lowest run speed percentage allowed (100 = default game speed).", (AcceptableValueBase)(object)new AcceptableValueRange(100, 500), Array.Empty())); _cfgMaxMultiplier = ((BaseUnityPlugin)this).Config.Bind("Speed Range", "MaximumMultiplier", 200, new ConfigDescription("Highest run speed percentage reachable with arrow keys.", (AcceptableValueBase)(object)new AcceptableValueRange(100, 500), Array.Empty())); _cfgStep = ((BaseUnityPlugin)this).Config.Bind("Speed Range", "AdjustmentPercent", 10, new ConfigDescription("How much each arrow key press changes speed, in percentage points. e.g. 10 moves from 100% to 110% per press.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 100), Array.Empty())); _cfgCurrentMultiplier = ((BaseUnityPlugin)this).Config.Bind("Current Speed", "CurrentMultiplier", 100, new ConfigDescription("Your last-used run speed percentage. Updated automatically in-game.", (AcceptableValueBase)(object)new AcceptableValueRange(100, 500), Array.Empty())); _cfgLudicrousEnabled = ((BaseUnityPlugin)this).Config.Bind("Ludicrous Speed", "LudicrousEnabled", false, "Set to true to enable Ludicrous Speed. Run speed is further multiplied by LudicrousMultiplier on top of your current setting. Edit and restart to toggle."); _cfgLudicrousMultiplier = ((BaseUnityPlugin)this).Config.Bind("Ludicrous Speed", "LudicrousMultiplier", 3, new ConfigDescription("Extra speed factor stacked on top of normal multiplier when Ludicrous Speed is on. Try 2-3 before going higher.", (AcceptableValueBase)(object)new AcceptableValueRange(2, 10), Array.Empty())); _cfgKeyIncrease = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "IncreaseSpeed", new KeyboardShortcut((KeyCode)273, Array.Empty()), "Key to increase run speed."); _cfgKeyDecrease = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "DecreaseSpeed", new KeyboardShortcut((KeyCode)274, Array.Empty()), "Key to decrease run speed."); s_multiplier = Mathf.Clamp(_cfgCurrentMultiplier.Value, GetMin(), GetMax()); _harmony = new Harmony("YouDied.run"); _harmony.PatchAll(); Log.LogInfo((object)"Run! v2.0.0 by YouDied loaded."); Log.LogInfo((object)(" Speed range : " + GetMin() + "% – " + GetMax() + "%")); Log.LogInfo((object)(" Step : " + _cfgStep.Value + "%")); Log.LogInfo((object)(" Current : " + s_multiplier + "%")); Log.LogInfo((object)(" Ludicrous : " + (_cfgLudicrousEnabled.Value ? ("ON (x" + _cfgLudicrousMultiplier.Value + ")") : "off"))); ManualLogSource log = Log; string[] obj = new string[5] { " Controls : ", null, null, null, null }; KeyboardShortcut value = _cfgKeyIncrease.Value; obj[1] = ((object)(KeyboardShortcut)(ref value)).ToString(); obj[2] = " / "; value = _cfgKeyDecrease.Value; obj[3] = ((object)(KeyboardShortcut)(ref value)).ToString(); obj[4] = " to adjust speed"; log.LogInfo((object)string.Concat(obj)); } private void Update() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || InventoryGui.IsVisible() || Menu.IsVisible()) { return; } bool flag = false; KeyboardShortcut value = _cfgKeyIncrease.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { s_multiplier = Mathf.Min(s_multiplier + _cfgStep.Value, GetMax()); flag = true; } else { value = _cfgKeyDecrease.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { s_multiplier = Mathf.Max(s_multiplier - _cfgStep.Value, GetMin()); flag = true; } } if (flag) { _cfgCurrentMultiplier.Value = s_multiplier; string text = ((s_multiplier <= GetMin()) ? " (min)" : ((s_multiplier >= GetMax()) ? " (max)" : "")); string text2 = "Run Speed: " + s_multiplier + "%" + text; if (_cfgLudicrousEnabled.Value) { text2 = text2 + " [LUDICROUS x" + _cfgLudicrousMultiplier.Value + "]"; } ((Character)Player.m_localPlayer).Message((MessageType)1, text2, 0, (Sprite)null); Log.LogInfo((object)("Run speed -> " + s_multiplier + "%")); } } private static int GetMin() { return Mathf.Max(100, _cfgMinMultiplier.Value); } private static int GetMax() { return Mathf.Clamp(_cfgMaxMultiplier.Value, GetMin(), 500); } private static float GetEffectiveMultiplier() { float num = (float)s_multiplier / 100f; if (!_cfgLudicrousEnabled.Value) { return num; } return num * (float)Mathf.Max(2, _cfgLudicrousMultiplier.Value); } private void OnDestroy() { _harmony.UnpatchSelf(); } } }