using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Threading;
using Il2Cpp;
using MelonLoader;
using MelonLoader.Utils;
using Newtonsoft.Json;
using UnityEngine;
using mszbhop;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "Miside Zero Bhop Mod", "1.0.0", "gameknight963", null)]
[assembly: AssemblyTitle("mszbhop")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("mszbhop")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("a5aca6ab-821c-4599-a759-de7b659c652d")]
[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")]
[RegisterTypeInIl2Cpp]
public class BhopMovement : MonoBehaviour
{
private Rigidbody _rb;
private CapsuleCollider _col;
private void Start()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Expected O, but got Unknown
_rb = Mod.Kiri.GetComponent<Rigidbody>();
_col = Mod.Kiri.GetComponent<CapsuleCollider>();
_rb.useGravity = false;
_rb.drag = 0f;
_rb.angularDrag = 0f;
_rb.freezeRotation = true;
_rb.collisionDetectionMode = (CollisionDetectionMode)1;
_rb.interpolation = (RigidbodyInterpolation)1;
PhysicMaterial val = new PhysicMaterial();
val.dynamicFriction = 0f;
val.staticFriction = 0f;
val.bounciness = 0f;
val.frictionCombine = (PhysicMaterialCombine)2;
((Collider)_col).material = val;
}
private void FixedUpdate()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));
bool flag = IsGrounded();
Vector3 velocity = _rb.velocity;
Vector3 val2 = ((Component)this).transform.TransformDirection(new Vector3(val.x, 0f, val.y));
Vector3 normalized = ((Vector3)(ref val2)).normalized;
if (flag)
{
if (_rb.velocity.y < 0f)
{
velocity.y = -2f;
}
MovementFunctions.GroundMove(ref velocity, normalized, applyFriction: true);
}
else
{
MovementFunctions.AirMove(ref velocity, normalized);
velocity.y -= 20f * Time.fixedDeltaTime;
}
if ((Input.GetKeyDown((KeyCode)32) || Input.GetAxis("Mouse ScrollWheel") != 0f) && flag)
{
velocity.y = ConfigManager.MovementConfig.JumpVelocityUnity;
}
_rb.velocity = velocity;
}
private bool IsGrounded()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
((Collider)_col).enabled = false;
RaycastHit val = default(RaycastHit);
if (Physics.Raycast(((Component)this).transform.position + _col.center, Vector3.down, ref val, _col.height * 0.5f + 0.3f))
{
((Collider)_col).enabled = true;
float num = Vector3.Angle(((RaycastHit)(ref val)).normal, Vector3.up);
return num < 45f;
}
((Collider)_col).enabled = true;
return false;
}
}
namespace mszbhop;
public static class ConfigManager
{
public static MovementConfig MovementConfig;
private static readonly FileSystemWatcher watcher;
static ConfigManager()
{
MovementConfig = new MovementConfig();
string path = Path.Combine(MelonEnvironment.ModsDirectory, "mszbhop");
watcher = new FileSystemWatcher(path, "MovementConfig.json");
watcher.NotifyFilter = NotifyFilters.LastWrite;
watcher.Changed += delegate
{
Thread.Sleep(100);
MovementConfig.Reload();
MelonLogger.Msg("Config reloaded!");
};
watcher.EnableRaisingEvents = true;
}
}
public class Mod : MelonMod
{
public static GameObject Kiri;
public override void OnSceneWasLoaded(int buildIndex, string sceneName)
{
if (!(sceneName != "Version 1.9 POST"))
{
Kiri = GameObject.Find("Kiri");
Component component = (Component)(object)Kiri.GetComponent<kiriMoveBasic>();
Object.Destroy((Object)(object)component);
Kiri.AddComponent<BhopMovement>();
OOBProtection val = Object.FindObjectOfType<OOBProtection>();
val.limit = -300f;
}
}
}
public class MovementConfig
{
[JsonIgnore]
private const float HU_TO_UNITY = 0.0254f;
public float MaxGroundSpeed { get; set; } = 320f;
public float GroundAccel { get; set; } = 600f;
public float AirAccel { get; set; } = 150f;
public float Friction { get; set; } = 4f;
public float JumpVelocity { get; set; } = 268f;
public float AirCap { get; set; } = 320f;
public float MaxGroundSpeedUnity => MaxGroundSpeed * 0.0254f;
public float GroundAccelUnity => GroundAccel * 0.0254f;
public float AirAccelUnity => AirAccel * 0.0254f;
public float JumpVelocityUnity => JumpVelocity * 0.0254f;
public float AirCapUnity => AirCap * 0.0254f;
public void Reload()
{
string path = Path.Combine(MelonEnvironment.ModsDirectory, "mszbhop", "MovementConfig.json");
if (File.Exists(path))
{
JsonConvert.PopulateObject(File.ReadAllText(path), (object)this);
}
}
public MovementConfig()
{
string path = Path.Combine(MelonEnvironment.ModsDirectory, "mszbhop", "MovementConfig.json");
if (!File.Exists(path))
{
File.WriteAllText(path, JsonConvert.SerializeObject((object)this, (Formatting)1));
}
else
{
JsonConvert.PopulateObject(File.ReadAllText(path), (object)this);
}
}
}
public static class MovementFunctions
{
private static MovementConfig MCfg => ConfigManager.MovementConfig;
public static void ApplyFriction(ref Vector3 velocity)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
float magnitude = ((Vector3)(ref velocity)).magnitude;
if (!(magnitude < 0.1f))
{
float num = magnitude * MCfg.Friction * Time.fixedDeltaTime;
float num2 = Mathf.Max(magnitude - num, 0f);
velocity *= num2 / magnitude;
}
}
public static void Accelerate(ref Vector3 velocity, Vector3 wishDir, float wishSpeed, float accel)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Dot(velocity, wishDir);
float num2 = wishSpeed - num;
if (!(num2 <= 0f))
{
float num3 = accel * Time.fixedDeltaTime * wishSpeed;
if (num3 > num2)
{
num3 = num2;
}
velocity += wishDir * num3;
}
}
public static void AirMove(ref Vector3 velocity, Vector3 wishDir)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
float num = MCfg.MaxGroundSpeedUnity;
if (num > MCfg.AirCapUnity)
{
num = MCfg.AirCapUnity;
}
Accelerate(ref velocity, wishDir, num, MCfg.AirAccelUnity);
}
public static void GroundMove(ref Vector3 velocity, Vector3 wishDir, bool applyFriction)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
if (applyFriction)
{
ApplyFriction(ref velocity);
}
float maxGroundSpeedUnity = MCfg.MaxGroundSpeedUnity;
Accelerate(ref velocity, wishDir, maxGroundSpeedUnity, MCfg.GroundAccelUnity);
}
}