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.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.EventSystems;
[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("Gogurt")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Gogurt")]
[assembly: AssemblyTitle("Gogurt")]
[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 BHopMod
{
[BepInPlugin("gogurt_BHop", "BHop", "1.0.0")]
public class Plugin : BasePlugin
{
public static ManualLogSource log;
public override void Load()
{
log = ((BasePlugin)this).Log;
ClassInjector.RegisterTypeInIl2Cpp<BHopController>();
((BasePlugin)this).AddComponent<BHopController>();
log.LogInfo((object)"BHop loaded! Auto-bhop is active when holding space.");
}
}
public class BHopController : MonoBehaviour
{
private bool wasGrounded;
private dynamic myPlayer;
private dynamic playerMovement;
private dynamic playerInput;
public BHopController(IntPtr ptr)
: base(ptr)
{
}
private void Update()
{
if ((Object)(object)EventSystem.current != (Object)null && EventSystem.current.IsPointerOverGameObject())
{
return;
}
try
{
GameManager instance = GameManager.Instance;
if ((Object)(object)instance == (Object)null)
{
return;
}
if (myPlayer == null)
{
myPlayer = instance.GetPlayer();
if (myPlayer == null)
{
return;
}
}
if (playerMovement == null)
{
playerMovement = myPlayer.playerMovement;
}
if (playerInput == null)
{
playerInput = myPlayer.playerInput;
}
dynamic val = playerMovement == null;
if (!(val ? true : false) && !((val | (playerInput == null)) ? true : false))
{
bool flag = playerMovement.grounded;
bool flag2 = playerInput.IsHoldingJump();
if (!wasGrounded && flag && flag2)
{
playerMovement.Jump();
}
wasGrounded = flag;
}
}
catch (Exception ex)
{
Plugin.log.LogError((object)("BHop Update error: " + ex.Message));
}
}
}
}