Decompiled source of InvertedSprint v1.0.0

plugins/InvertedSprint.dll

Decompiled 3 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
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: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("InvertedSprint")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("My first plugin")]
[assembly: AssemblyTitle("InvertedSprint")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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 InvertedSprint
{
	[HarmonyPatch]
	public class PlayerPatches
	{
		private static float ForwardSpeed;

		private static float ForwardSprintSpeed;

		private static float CrouchSpeed;

		private static float CrouchSprintSpeed;

		private static float SwimSpeed;

		private static float SwimSprintSpeed;

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerCharacter), "Start")]
		public static void StartPatch(PlayerCharacter __instance)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Expected O, but got Unknown
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Expected O, but got Unknown
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			if (!((Object)(object)__instance == (Object)null))
			{
				ManualLogSource log = Plugin.Log;
				bool flag = default(bool);
				BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initial forward speed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance.tunings.forwardSpeed);
				}
				log.LogInfo(val);
				ManualLogSource log2 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initial forward sprint speed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance.tunings.forwardSprintSpeed);
				}
				log2.LogInfo(val);
				ManualLogSource log3 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(22, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initial crouch speed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance.tunings.crouchForwardSpeed);
				}
				log3.LogInfo(val);
				ManualLogSource log4 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initial crouch sprint speed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance.tunings.crouchForwardSprintSpeed);
				}
				log4.LogInfo(val);
				ManualLogSource log5 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(20, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initial swim speed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance.tunings.swimForwardSpeed);
				}
				log5.LogInfo(val);
				ManualLogSource log6 = Plugin.Log;
				val = new BepInExInfoLogInterpolatedStringHandler(27, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initial swim sprint speed: ");
					((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(__instance.tunings.swimForwardSprintSpeed);
				}
				log6.LogInfo(val);
				ForwardSpeed = __instance.tunings.forwardSpeed;
				ForwardSprintSpeed = __instance.tunings.forwardSprintSpeed;
				CrouchSpeed = __instance.tunings.crouchForwardSpeed;
				CrouchSprintSpeed = __instance.tunings.crouchForwardSprintSpeed;
				SwimSpeed = __instance.tunings.swimForwardSpeed;
				SwimSprintSpeed = __instance.tunings.swimForwardSprintSpeed;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(PlayerCharacter), "Update")]
		public static void UpdatePatch(PlayerCharacter __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				PlayerTunings tunings = __instance.tunings;
				tunings.forwardSpeed = ForwardSprintSpeed;
				tunings.forwardSprintSpeed = ForwardSpeed;
				tunings.crouchForwardSpeed = CrouchSprintSpeed;
				tunings.crouchForwardSprintSpeed = CrouchSpeed;
				tunings.swimForwardSpeed = SwimSprintSpeed;
				tunings.swimForwardSprintSpeed = SwimSpeed;
			}
		}
	}
	[BepInPlugin("com.averyocean65.invertedsprint", "Inverted Sprint", "1.0.0")]
	public class Plugin : BasePlugin
	{
		private static class PluginInfo
		{
			public const string GUID = "com.averyocean65.invertedsprint";

			public const string NAME = "Inverted Sprint";

			public const string VERSION = "1.0.0";
		}

		public static ManualLogSource Log;

		public override void Load()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Expected O, but got Unknown
			Harmony val = new Harmony("com.averyocean65.invertedsprint");
			val.PatchAll();
			Log = ((BasePlugin)this).Log;
			ManualLogSource log = Log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("Inverted Sprint");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is loaded!");
			}
			log.LogInfo(val2);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "InvertedSprint";

		public const string PLUGIN_NAME = "My first plugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}