Decompiled source of DinkysSpeedMod v1.0.0

SuperSpeed.dll

Decompiled 4 months ago
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.Logging;
using DinkysSuperSpeed.Patch;
using GameNetcodeStuff;
using HarmonyLib;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SuperSpeed")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SuperSpeed")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c177dd8c-e580-4b8a-b90e-3b86cc17225c")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace DinkysSuperSpeed
{
	[BepInPlugin("Dink.SuperSpeed", "SuperSpeed", "1.0.0")]
	public class SpeedBase : BaseUnityPlugin
	{
		private const string modGUID = "Dink.SuperSpeed";

		private const string modName = "SuperSpeed";

		private const string modVersion = "1.0.0";

		private readonly Harmony harmony = new Harmony("Dink.SuperSpeed");

		private static SpeedBase Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if (Instance == null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("SuperSpeed");
			mls.LogInfo((object)"The mod is awake");
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}
	}
}
namespace DinkysSuperSpeed.Patch
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static InputAction action;

		private static bool sprintToggled;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void updatePatch(ref float ___sprintMultiplier, ref bool ___isSprinting, ref bool ___isFallingFromJump)
		{
			if (___isSprinting && sprintToggled)
			{
				___sprintMultiplier = 100f;
			}
		}

		[HarmonyPatch("Awake")]
		[HarmonyPostfix]
		private static void AwakePatch()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			if (action == null)
			{
				action = new InputAction("Toggle", (InputActionType)0, "<Keyboard>/r", (string)null, (string)null, (string)null);
				action.performed += delegate
				{
					ToggleSprint();
				};
				action.Enable();
			}
		}

		private static void ToggleSprint()
		{
			sprintToggled = !sprintToggled;
		}
	}
}