BHop.dll

Decompiled 2 days 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 Assets.Scripts.Actors.Player;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[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;
		}
	}
}
namespace BHopMod
{
	[BepInPlugin("anro_BHop", "BHop", "1.0.0")]
	public class Plugin : BasePlugin
	{
		public class BHopController : MonoBehaviour
		{
			private bool wasGrounded;

			private MyPlayer myPlayer;

			private PlayerMovement playerMovement;

			private PlayerInput playerInput;

			public BHopController(IntPtr ptr)
				: base(ptr)
			{
			}

			private void Start()
			{
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
				log.LogInfo((object)"BHop Controller initialized!");
			}

			private void Update()
			{
				//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ef: Expected O, but got Unknown
				try
				{
					GameManager instance = GameManager.Instance;
					if ((Object)(object)instance == (Object)null)
					{
						return;
					}
					if ((Object)(object)myPlayer == (Object)null)
					{
						myPlayer = instance.GetPlayer();
						if ((Object)(object)myPlayer == (Object)null)
						{
							return;
						}
					}
					if ((Object)(object)playerMovement == (Object)null)
					{
						playerMovement = myPlayer.playerMovement;
						if ((Object)(object)playerMovement == (Object)null)
						{
							return;
						}
					}
					if ((Object)(object)playerInput == (Object)null)
					{
						playerInput = myPlayer.playerInput;
						if ((Object)(object)playerInput == (Object)null)
						{
							return;
						}
					}
					bool grounded = playerMovement.grounded;
					bool flag = playerInput.IsHoldingJump();
					if (!wasGrounded && grounded && flag)
					{
						playerMovement.Jump();
					}
					wasGrounded = grounded;
				}
				catch (Exception ex)
				{
					ManualLogSource log = Plugin.log;
					bool flag2 = default(bool);
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(19, 1, ref flag2);
					if (flag2)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("BHop Update error: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
					}
					log.LogError(val);
				}
			}
		}

		public const string MODNAME = "BHop";

		public const string AUTHOR = "anro";

		public const string GUID = "anro_BHop";

		public const string VERSION = "1.0.0";

		private static ManualLogSource log;

		public Plugin()
		{
			log = ((BasePlugin)this).Log;
		}

		public override void Load()
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			ManualLogSource obj = log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BHop");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" by ");
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("anro");
			}
			obj.LogInfo(val);
			ClassInjector.RegisterTypeInIl2Cpp<BHopController>();
			((BasePlugin)this).AddComponent<BHopController>();
			ManualLogSource obj2 = log;
			val = new BepInExInfoLogInterpolatedStringHandler(48, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("BHop");
				((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded! Auto-bhop is active when holding space.");
			}
			obj2.LogInfo(val);
		}
	}
}