Decompiled source of CrouchRun v0.0.1

CrouchRunBug.dll

Decompiled 8 months 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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using TimeScaleSetter.patches;
using Unity.Netcode;
using UnityEngine;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CrouchRunBug")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Your Mod Description Goes Here")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("CrouchRunBug")]
[assembly: AssemblyTitle("CrouchRunBug")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TimeScaleSetter.patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class HudManagerPatch
	{
		[HarmonyPatch(typeof(PlayerControllerB), "Crouch_performed")]
		[HarmonyPrefix]
		private static bool recheckCrouch(PlayerControllerB __instance, ref CallbackContext context, ref bool ___isJumping)
		{
			if (((CallbackContext)(ref context)).performed && !__instance.quickMenuManager.isMenuOpen && ((((NetworkBehaviour)__instance).IsOwner && __instance.isPlayerControlled && (!((NetworkBehaviour)__instance).IsServer || __instance.isHostPlayerObject)) || __instance.isTestingPlayer) && !__instance.inSpecialInteractAnimation && !___isJumping && !__instance.isTypingChat && __instance.thisController.isGrounded)
			{
				__instance.Crouch(!__instance.isCrouching);
			}
			return false;
		}
	}
}
namespace CrouchRunBug
{
	[BepInPlugin("org.agmas.CrouchRunBug", "CrouchRunBug", "0.1.0")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "org.agmas.CrouchRunBug";

		private const string modName = "CrouchRunBug";

		private const string modVersion = "0.1.0";

		public ConfigEntry<string> url;

		private readonly Harmony harmony = new Harmony("org.agmas.CrouchRunBug");

		public static Plugin Instance;

		public ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("org.agmas.CrouchRunBug");
			mls.LogInfo((object)"We're up and running!");
			harmony.PatchAll(typeof(HudManagerPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "CrouchRunBug";

		public const string PLUGIN_NAME = "CrouchRunBug";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}