using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TripleJump.Patches;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TripleJump")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TripleJump")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3205ec47-f5c0-4d89-a511-4a7fcdf8b208")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TripleJump
{
[BepInPlugin("PugRoll.TripleJump", "TripleJump", "1.0")]
public class TripleJump : BaseUnityPlugin
{
public const string modGUID = "PugRoll.TripleJump";
public const string modName = "TripleJump";
public const string modVersion = "1.0";
private readonly Harmony _harmony = new Harmony("PugRoll.TripleJump");
private void Awake()
{
ManualLogSource val = Logger.CreateLogSource("PugRoll.TripleJump");
val.LogMessage((object)"PugRoll.TripleJump has loaded successfully");
_harmony.PatchAll(typeof(TripleJumpPatch));
}
}
}
namespace TripleJump.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
[HarmonyPatch("Update")]
internal class TripleJumpPatch
{
public static int limitJumps = 2;
[HarmonyPatch("Update")]
[HarmonyPostfix]
public static void TripleJump(ref bool ___isJumping, ref bool ___isFallingFromJump, ref bool ___isExhausted, ref float ___playerSlidingTimer, ref PlayerControllerB __instance, ref float ___sprintMeter, ref float ___jumpForce, ref bool ___isFallingNoJump)
{
if (limitJumps > 0 && !___isExhausted && (___isFallingFromJump | ___isFallingNoJump) && ((ButtonControl)Keyboard.current.spaceKey).wasPressedThisFrame)
{
limitJumps--;
((MonoBehaviour)__instance).StartCoroutine("PlayerJump");
___sprintMeter = Mathf.Clamp(___sprintMeter - 0.08f, 0f, 1f);
___isJumping = true;
}
if (__instance.thisController.isGrounded)
{
limitJumps = 2;
}
}
}
}