Decompiled source of JetHack v1.0.0

JetHack.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.Mage;
using On.EntityStates.Mage;

[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 = "")]
[assembly: AssemblyCompany("JetHack")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("JetHack")]
[assembly: AssemblyTitle("JetHack")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace JetHack;

[BepInPlugin("com.RiskOfBrainrot.JetHack", "JetHack", "1.0.0")]
public class JetHackPlugin : BaseUnityPlugin
{
	public const string guid = "com.RiskOfBrainrot.JetHack";

	public const string teamName = "RiskOfBrainrot";

	public const string modName = "JetHack";

	public const string version = "1.0.0";

	public static bool hoverStateCache;

	private void Awake()
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Expected O, but got Unknown
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0024: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		MageCharacterMain.OnEnter += new hook_OnEnter(RestoreHoverState);
		MageCharacterMain.OnExit += new hook_OnExit(CacheHoverState);
		FlyUpState.OnExit += new hook_OnExit(OverrideHoverStateCache);
	}

	private void OverrideHoverStateCache(orig_OnExit orig, FlyUpState self)
	{
		orig.Invoke(self);
		if (((EntityState)self).isAuthority)
		{
			hoverStateCache = true;
		}
	}

	private void CacheHoverState(orig_OnExit orig, MageCharacterMain self)
	{
		if (((EntityState)self).isAuthority)
		{
			hoverStateCache = self.jumpButtonState;
		}
		orig.Invoke(self);
	}

	private void RestoreHoverState(orig_OnEnter orig, MageCharacterMain self)
	{
		if (((EntityState)self).isAuthority)
		{
			self.jumpButtonState = hoverStateCache;
		}
		orig.Invoke(self);
	}
}