Decompiled source of ToggleCrouch v1.0.0

BepInEx/plugins/ToggleCrouch.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Movement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("ToggleCrouch")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0+545037e0974441e6aac9b696a52d8104541b13e7")]
[assembly: AssemblyProduct("ToggleCrouch")]
[assembly: AssemblyTitle("ToggleCrouch")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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;
		}
	}
}
[BepInPlugin("sparroh.togglecrouch", "ToggleCrouch", "1.0.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class ToggleCrouchPlugin : BaseUnityPlugin
{
	public const string PluginGUID = "sparroh.togglecrouch";

	public const string PluginName = "ToggleCrouch";

	public const string PluginVersion = "1.0.0";

	internal static ManualLogSource Logger;

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		Logger = ((BaseUnityPlugin)this).Logger;
		new Harmony("sparroh.togglecrouch").PatchAll();
		Logger.LogInfo((object)"ToggleCrouch loaded successfully.");
	}
}
[HarmonyPatch(typeof(Player), "EndCrouch")]
public class EndCrouchPatch
{
	private static bool Prefix()
	{
		return !ToggleCrouchPatch.isToggleOn;
	}
}
[HarmonyPatch(typeof(Player), "EndSlide")]
public class EndSlidePatch
{
	private static bool Prefix()
	{
		return !ToggleCrouchPatch.isToggleOn;
	}
}
[HarmonyPatch(typeof(Player), "Update")]
public class ToggleCrouchPatch
{
	internal static bool isToggleOn;

	private static void Prefix(Player __instance)
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		PlayerActions player = PlayerInput.Controls.Player;
		if (((PlayerActions)(ref player)).Slide.WasPressedThisFrame())
		{
			bool num = (bool)typeof(Player).GetProperty("Crouching").GetValue(__instance);
			bool flag = (bool)typeof(Player).GetProperty("Sliding").GetValue(__instance);
			if (num || flag || isToggleOn)
			{
				isToggleOn = false;
			}
			else
			{
				isToggleOn = true;
			}
		}
	}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
	public const string AssemblySemFileVer = "0.0.1.0";

	public const string AssemblySemVer = "0.0.1.0";

	public const string BranchName = "master";

	public const string BuildMetaData = "";

	public const string CommitDate = "2025-10-17";

	public const string CommitsSinceVersionSource = "1";

	public const string EscapedBranchName = "master";

	public const string FullBuildMetaData = "Branch.master.Sha.545037e0974441e6aac9b696a52d8104541b13e7";

	public const string FullSemVer = "0.0.1-1";

	public const string InformationalVersion = "0.0.1-1+Branch.master.Sha.545037e0974441e6aac9b696a52d8104541b13e7";

	public const string Major = "0";

	public const string MajorMinorPatch = "0.0.1";

	public const string Minor = "0";

	public const string Patch = "1";

	public const string PreReleaseLabel = "";

	public const string PreReleaseLabelWithDash = "";

	public const string PreReleaseNumber = "1";

	public const string PreReleaseTag = "1";

	public const string PreReleaseTagWithDash = "-1";

	public const string SemVer = "0.0.1-1";

	public const string Sha = "545037e0974441e6aac9b696a52d8104541b13e7";

	public const string ShortSha = "545037e";

	public const string UncommittedChanges = "16";

	public const string VersionSourceSha = "";

	public const string WeightedPreReleaseNumber = "55001";
}
namespace ToggleCrouch
{
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ToggleCrouch";

		public const string PLUGIN_NAME = "ToggleCrouch";

		public const string PLUGIN_VERSION = "0.0.0";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}