using System;
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 RandomJumpHeight.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("RandomJumpHeight")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RandomJumpHeight")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b13ac9e2-3836-4201-9f25-eb9ed17e0f36")]
[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 RandomJumpHeight
{
[BepInPlugin("BITA.RandomJumpHeight", "Random Jump Height", "1.0.1")]
public class RandomJumpBase : BaseUnityPlugin
{
private const string modGUID = "BITA.RandomJumpHeight";
private const string modName = "Random Jump Height";
private const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony("BITA.RandomJumpHeight");
private static RandomJumpBase Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("BITA.RandomJumpHeight");
mls.LogInfo((object)"The Mod has successfully loaded.");
harmony.PatchAll(typeof(RandomJumpBase));
harmony.PatchAll(typeof(PlayerControllerBPatch));
}
}
}
namespace RandomJumpHeight.Patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
public class PlayerControllerBPatch
{
[HarmonyPatch("PlayerJump")]
[HarmonyPrefix]
private static void randomJumpPatch(PlayerControllerB __instance)
{
Random random = new Random();
float jumpForce = 5f * (float)random.Next(1, 51);
__instance.jumpForce = jumpForce;
}
[HarmonyPatch("PlayerHitGroundEffects")]
[HarmonyPrefix]
private static void randomjumpPostPatch(PlayerControllerB __instance)
{
Random random = new Random();
if (random.Next(0, 11) <= 6)
{
__instance.ResetFallGravity();
}
}
}
}