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 JustJump.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("JustJump")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JustJump")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("eaac3ea4-a80f-40b6-9ff1-dbe992134d7f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace JustJump
{
[BepInPlugin("Zeus.JustJump", "JustJump", "1.0.0.0")]
public class JustJump : BaseUnityPlugin
{
private const string modGUID = "Zeus.JustJump";
private const string modName = "JustJump";
private const string modVersion = "1.0.0.0";
private readonly Harmony harmony = new Harmony("Zeus.JustJump");
private static JustJump Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Zeus.JustJump");
mls.LogInfo((object)"JustJump started jumping!");
harmony.PatchAll(typeof(JustJump));
harmony.PatchAll(typeof(PlayerControllerBPatch));
mls = ((BaseUnityPlugin)this).Logger;
}
}
}
namespace JustJump.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
private static bool isDaPlayerNearGround;
[HarmonyPatch("IsPlayerNearGround")]
[HarmonyPostfix]
private static void patchNearGround(ref float ___sprintMeter, PlayerControllerB __instance, ref Ray ___interactRay)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
isDaPlayerNearGround = Physics.Raycast(___interactRay, 0.15f, StartOfRound.Instance.allPlayersCollideWithMask, (QueryTriggerInteraction)1);
}
[HarmonyPatch("Jump_performed")]
[HarmonyPrefix]
private static void patchJump(ref float ___sprintMeter, PlayerControllerB __instance, ref bool ___isJumping, ref float ___playerSlidingTimer, ref bool ___isExhausted, ref bool ___isCrouching)
{
if (!__instance.quickMenuManager.isMenuOpen && !__instance.inSpecialInteractAnimation && !__instance.isTypingChat && (__instance.isMovementHindered <= 0 || __instance.isUnderwater) && (__instance.thisController.isGrounded || (!___isJumping && isDaPlayerNearGround)) && !___isJumping && (!__instance.isPlayerSliding || ___playerSlidingTimer > 2.5f))
{
___sprintMeter = Mathf.Clamp(___sprintMeter + 0.08f, 0f, 1f);
___isExhausted = false;
___isCrouching = false;
}
}
}
}