Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of Bhop v1.0.0
Bhop_IL2CPP.dll
Decompiled 16 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Bhop; using HarmonyLib; using Il2CppScheduleOne; using Il2CppScheduleOne.PlayerScripts; using Il2CppSystem; using MelonLoader; using MelonLoader.Preferences; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::Bhop.Bhop), "Bhop", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Bhop_IL2CPP")] [assembly: AssemblyConfiguration("Debug_IL2CPP")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Bhop_IL2CPP")] [assembly: AssemblyTitle("Bhop_IL2CPP")] [assembly: AssemblyVersion("1.0.0.0")] namespace Bhop; public static class BuildInfo { public const string Name = "Bhop"; public const string Description = "Lets you Bhop like in Counter Strike."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public static class Config { private static MelonPreferences_Category configCategory; private static MelonPreferences_Entry<bool> enabledEntry; private static MelonPreferences_Entry<bool> autoBunnyhopEntry; private static MelonPreferences_Entry<float> forwardSpeedEntry; private static MelonPreferences_Entry<float> sideSpeedEntry; private static MelonPreferences_Entry<float> maxSpeedEntry; private static MelonPreferences_Entry<float> frictionEntry; private static MelonPreferences_Entry<float> stopSpeedEntry; private static MelonPreferences_Entry<float> accelerateEntry; private static MelonPreferences_Entry<float> airAccelerateEntry; private static MelonPreferences_Entry<float> jumpHeightEntry; public static bool Enabled => enabledEntry?.Value ?? true; public static bool AutoBunnyhop => autoBunnyhopEntry?.Value ?? true; public static float ForwardSpeed => forwardSpeedEntry?.Value ?? 20f; public static float SideSpeed => sideSpeedEntry?.Value ?? 2f; public static float MaxSpeed => maxSpeedEntry?.Value ?? 2f; public static float Friction => frictionEntry?.Value ?? 20f; public static float StopSpeed => stopSpeedEntry?.Value ?? 0.01524f; public static float Accelerate => accelerateEntry?.Value ?? 20f; public static float AirAccelerate => airAccelerateEntry?.Value ?? 1f; public static float JumpHeight => jumpHeightEntry?.Value ?? 2.1f; public static void Load() { configCategory = MelonPreferences.CreateCategory("Bhop"); enabledEntry = configCategory.CreateEntry<bool>("enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); autoBunnyhopEntry = configCategory.CreateEntry<bool>("autoBunnyhop", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); forwardSpeedEntry = configCategory.CreateEntry<float>("forwardSpeed", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); sideSpeedEntry = configCategory.CreateEntry<float>("sideSpeed", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); maxSpeedEntry = configCategory.CreateEntry<float>("maxSpeed", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); frictionEntry = configCategory.CreateEntry<float>("friction", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); stopSpeedEntry = configCategory.CreateEntry<float>("stopSpeed", 0.01524f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); accelerateEntry = configCategory.CreateEntry<float>("accelerate", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); airAccelerateEntry = configCategory.CreateEntry<float>("airAccelerate", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); jumpHeightEntry = configCategory.CreateEntry<float>("jumpHeight", 2.1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } } public class Bhop : MelonMod { [HarmonyPatch(typeof(PlayerMovement), "Move")] private static class PlayerMovement_Move_Patch { private static readonly MethodInfo TryToggleCrouchMethod = AccessTools.Method(typeof(PlayerMovement), "TryToggleCrouch", (Type[])null, (Type[])null); private static Vector3 _velocity; private static bool _wasGrounded; private static int _groundedFrames; private static bool _initialized; private static int _lastFrameSeen = -1; private static bool _ranInFixedThisFrame; private const float SprintMultiplier = 1.25f; private const float CrouchMoveMultiplier = 1f / 3f; private const float GroundCheckDistance = 0.08f; private const float StickToGroundSpeed = 2f; private const float DistEpsilon = 1f / 32f; private const float MinMoveFraction = 0.0001f; private const float EffectivelyHorizontalNormalY = 0.0001f; private const int MaxClipPlanes = 5; private const int MaxBumps = 4; private const float StandableNormalY = 0.7f; private static int GetMovementMask() { try { int num = LayerMask.NameToLayer("Trash"); if (num >= 0) { return ~(1 << num); } } catch { } return -5; } private static void GetControllerCapsule(CharacterController controller, out Vector3 p1, out Vector3 p2, out float radius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)controller).transform; Vector3 up = transform.up; radius = Mathf.Max(0.0001f, controller.radius); float num = Mathf.Max(0f, controller.height * 0.5f - radius); Vector3 val = transform.position + transform.rotation * controller.center; p1 = val + up * num; p2 = val - up * num; } private static void GetControllerCapsuleAt(CharacterController controller, Vector3 worldPos, out Vector3 p1, out Vector3 p2, out float radius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)controller).transform; Vector3 up = transform.up; radius = Mathf.Max(0.0001f, controller.radius); float num = Mathf.Max(0f, controller.height * 0.5f - radius); Vector3 val = worldPos + transform.rotation * controller.center; p1 = val + up * num; p2 = val - up * num; } private static int ClipVelocity(Vector3 inVelocity, Vector3 planeNormal, out Vector3 outVelocity) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) int num = 0; float y = planeNormal.y; if (y > 0f) { num |= 1; } if (Mathf.Abs(y) <= 0.0001f) { num |= 2; } float num2 = Vector3.Dot(inVelocity, planeNormal); outVelocity = inVelocity - planeNormal * num2; float num3 = Vector3.Dot(outVelocity, planeNormal); if (num3 < 0f) { num3 = Mathf.Min(num3, -1f / 32f); outVelocity -= planeNormal * num3; } return num; } private static int TryPlayerMove(CharacterController controller, ref Vector3 velocity, float dt) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) float num = dt; int num2 = 0; int num3 = 0; Vector3[] array = (Vector3[])(object)new Vector3[5]; Vector3 inVelocity = velocity; Vector3 val = velocity; int movementMask = GetMovementMask(); float num4 = Mathf.Max(0.001f, controller.skinWidth); float num5 = Mathf.Sqrt(num4 * num4 + num4 * num4); Vector3 val2 = ((Component)controller).transform.position; RaycastHit val5 = default(RaycastHit); Ray val6 = default(Ray); RaycastHit val7 = default(RaycastHit); for (int i = 0; i < 4; i++) { if (((Vector3)(ref velocity)).sqrMagnitude <= 0f) { break; } Vector3 val3 = velocity * num; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude <= 1E-05f) { break; } Vector3 val4 = val3 / magnitude; GetControllerCapsuleAt(controller, val2, out var p, out var p2, out var radius); float num6 = magnitude + num5; bool flag = Physics.CapsuleCast(p, p2, radius, val4, ref val5, num6, movementMask, (QueryTriggerInteraction)1); float num7 = (flag ? Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - num5) : magnitude); float num8 = ((magnitude > 1E-05f) ? (num7 / magnitude) : 1f); if (num8 > 0f && num8 < 0.0001f) { num8 = 0f; } if (num8 > 0f) { val2 += val4 * num7; inVelocity = velocity; num3 = 0; } if (!flag || num8 >= 1f) { break; } Vector3 normal = ((RaycastHit)(ref val5)).normal; try { if ((Object)(object)((RaycastHit)(ref val5)).collider != (Object)null) { ((Ray)(ref val6))..ctor(((RaycastHit)(ref val5)).point - val4 * 0.001f, val4); if (((RaycastHit)(ref val5)).collider.Raycast(val6, ref val7, 0.01f)) { normal = ((RaycastHit)(ref val7)).normal; } } } catch { } if (normal.y > 0.7f) { num2 |= 1; } if (Mathf.Abs(normal.y) < 0.0001f) { normal.y = 0f; num2 |= 2; } num -= num * num8; if (num3 >= 5) { velocity = Vector3.zero; break; } array[num3++] = normal; Vector3 outVelocity = velocity; if (num3 == 1) { ClipVelocity(inVelocity, array[0], out outVelocity); velocity = outVelocity; inVelocity = outVelocity; continue; } int j; for (j = 0; j < num3; j++) { ClipVelocity(inVelocity, array[j], out outVelocity); int k; for (k = 0; k < num3 && (k == j || !(Vector3.Dot(outVelocity, array[k]) < 0f)); k++) { } if (k == num3) { break; } } if (j != num3) { velocity = outVelocity; } else { if (num3 != 2) { velocity = Vector3.zero; break; } Vector3 val8 = Vector3.Cross(array[0], array[1]); float magnitude2 = ((Vector3)(ref val8)).magnitude; if (magnitude2 > 0.0001f) { val8 /= magnitude2; } float num9 = Vector3.Dot(val8, velocity); velocity = val8 * num9; } if (Vector3.Dot(velocity, val) <= 0f) { velocity = Vector3.zero; break; } } return num2; } private static bool CheckGrounded(CharacterController controller) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) try { GetControllerCapsule(controller, out var p, out var p2, out var radius); int movementMask = GetMovementMask(); float num = Mathf.Max(0.001f, controller.skinWidth); float num2 = Mathf.Sqrt(num * num + num * num); float num3 = Mathf.Max(0.0001f, radius * 0.95f); Vector3 val = -((Component)controller).transform.up; RaycastHit val2 = default(RaycastHit); return Physics.CapsuleCast(p, p2, num3, val, ref val2, 0.08f + num2, movementMask, (QueryTriggerInteraction)1); } catch { return false; } } private static void ApplyFriction(PlayerMovement pm, float dt) { //IL_001a: 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) Vector3 val = new Vector3(_velocity.x, 0f, _velocity.z); float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude < 0.0001905f)) { float num; try { num = PlayerMovement.SlipperyMovementMultiplier; } catch { num = 1f; } float num2 = Config.Friction / Mathf.Max(0.0001f, num); float num3 = ((magnitude < Config.StopSpeed) ? Config.StopSpeed : magnitude); float num4 = num3 * num2 * dt; float num5 = magnitude - num4; if (num5 < 0f) { num5 = 0f; } if (num5 != magnitude) { float num6 = num5 / magnitude; _velocity.x *= num6; _velocity.z *= num6; } } } private static void Accelerate(Vector3 wishDir, float wishSpeed, float accel, float dt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0045: 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 * dt * wishSpeed; if (num3 > num2) { num3 = num2; } _velocity += wishDir * num3; } } private static void AirAccelerate(Vector3 wishDir, float wishSpeed, float accel, float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(wishSpeed, 1f); float num2 = Vector3.Dot(_velocity, wishDir); float num3 = num - num2; if (!(num3 <= 0f)) { float num4 = accel * dt * wishSpeed; if (num4 > num3) { num4 = num3; } _velocity += wishDir * num4; } } private static bool Prefix(PlayerMovement __instance) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_0399: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_0505: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) if (!Config.Enabled) { return true; } int frameCount = Time.frameCount; if (frameCount != _lastFrameSeen) { _lastFrameSeen = frameCount; _ranInFixedThisFrame = false; } if ((Object)(object)__instance == (Object)null) { return true; } CharacterController controller; try { controller = __instance.Controller; } catch { return true; } if ((Object)(object)controller == (Object)null || !((Collider)controller).enabled) { return true; } try { if ((Object)(object)__instance.CurrentVehicle != (Object)null) { return true; } } catch { } float num; if (Time.inFixedTimeStep) { _ranInFixedThisFrame = true; num = Time.fixedDeltaTime; } else { if (_ranInFixedThisFrame) { return false; } num = Time.deltaTime; if (num <= 0f) { num = Time.fixedDeltaTime; } } if (!_initialized) { _initialized = true; try { _velocity = controller.velocity; } catch { _velocity = Vector3.zero; } } bool flag = CheckGrounded(controller); if (flag) { _groundedFrames++; } else { _groundedFrames = 0; } if (flag) { if (_velocity.y < 0f) { _velocity.y = -2f; } } else { _velocity.y += Physics.gravity.y * num * PlayerMovement.GravityMultiplier; } bool flag2 = true; bool flag3 = true; try { flag2 = __instance.CanMove; } catch { } try { flag3 = __instance.CanJump; } catch { } bool flag4 = false; try { flag4 = GameInput.IsTyping; } catch { } try { if (flag2 && !flag4 && GameInput.GetButtonDown((ButtonCode)8)) { TryToggleCrouchMethod?.Invoke(__instance, Array.Empty<object>()); } } catch { } bool flag5 = false; try { flag5 = __instance.IsCrouched; } catch { } float num2 = 0f; float num3 = 0f; try { if (GameInput.GetButton((ButtonCode)3)) { num2 += Config.ForwardSpeed; } if (GameInput.GetButton((ButtonCode)4)) { num2 -= Config.ForwardSpeed; } if (GameInput.GetButton((ButtonCode)5)) { num3 -= Config.SideSpeed; } if (GameInput.GetButton((ButtonCode)6)) { num3 += Config.SideSpeed; } } catch { } if (flag5) { num2 *= 1f / 3f; num3 *= 1f / 3f; } bool flag6 = false; try { flag6 = GameInput.GetButton((ButtonCode)9); } catch { } bool flag7 = flag6 && flag2 && !flag5 && (Mathf.Abs(num2) > 0.0001f || Mathf.Abs(num3) > 0.0001f); try { __instance.IsSprinting = flag7; } catch { } Vector3 forward; Vector3 right; try { Transform transform = ((Component)__instance.Player).transform; forward = transform.forward; right = transform.right; } catch { forward = Vector3.forward; right = Vector3.right; } forward.y = 0f; right.y = 0f; ((Vector3)(ref forward)).Normalize(); ((Vector3)(ref right)).Normalize(); Vector3 val = forward * num2 + right * num3; float num4 = ((Vector3)(ref val)).magnitude; Vector3 wishDir = ((num4 > 0.0001f) ? (val / num4) : Vector3.zero); float num5 = (flag7 ? (Config.MaxSpeed * 1.25f) : Config.MaxSpeed); if (num4 > num5) { num4 = num5; } bool flag8 = false; try { flag8 = (Config.AutoBunnyhop ? GameInput.GetButton((ButtonCode)7) : GameInput.GetButtonDown((ButtonCode)7)); } catch { } try { if (flag8 && flag && flag2 && flag3 && !flag4 && !__instance.IsJumping) { __instance.IsJumping = true; try { Action onJump = __instance.onJump; if (onJump != null) { onJump.Invoke(); } } catch { } try { Player local = Player.Local; if (local != null) { local.PlayJumpAnimation(); } } catch { } float jumpForce = PlayerMovement.JumpForce; float jumpMultiplier = PlayerMovement.JumpMultiplier; _velocity.y = Mathf.Sqrt(Mathf.Max(0f, 2f * jumpForce * jumpMultiplier * Config.JumpHeight)); flag = false; } } catch { } if (flag) { if (_groundedFrames > 1 || _wasGrounded) { ApplyFriction(__instance, num); } if (flag2) { Accelerate(wishDir, num4, Config.Accelerate, num); } } else if (flag2) { AirAccelerate(wishDir, num4, Config.AirAccelerate, num); } TryPlayerMove(controller, ref _velocity, num); controller.Move(_velocity * num); if (_wasGrounded = CheckGrounded(controller)) { try { if (__instance.IsJumping) { __instance.IsJumping = false; } } catch { } if (_velocity.y < 0f) { _velocity.y = -2f; } } return false; } } public override void OnInitializeMelon() { Config.Load(); try { ((MelonBase)this).HarmonyInstance.PatchAll(); } catch { } } }
Bhop_Mono.dll
Decompiled 16 hours agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Bhop; using HarmonyLib; using MelonLoader; using MelonLoader.Preferences; using ScheduleOne; using ScheduleOne.PlayerScripts; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::Bhop.Bhop), "Bhop", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Bhop_Mono")] [assembly: AssemblyConfiguration("Debug_Mono")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Bhop_Mono")] [assembly: AssemblyTitle("Bhop_Mono")] [assembly: AssemblyVersion("1.0.0.0")] namespace Bhop; public static class BuildInfo { public const string Name = "Bhop"; public const string Description = "Lets you Bhop like in Counter Strike."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public static class Config { private static MelonPreferences_Category configCategory; private static MelonPreferences_Entry<bool> enabledEntry; private static MelonPreferences_Entry<bool> autoBunnyhopEntry; private static MelonPreferences_Entry<float> forwardSpeedEntry; private static MelonPreferences_Entry<float> sideSpeedEntry; private static MelonPreferences_Entry<float> maxSpeedEntry; private static MelonPreferences_Entry<float> frictionEntry; private static MelonPreferences_Entry<float> stopSpeedEntry; private static MelonPreferences_Entry<float> accelerateEntry; private static MelonPreferences_Entry<float> airAccelerateEntry; private static MelonPreferences_Entry<float> jumpHeightEntry; public static bool Enabled => enabledEntry?.Value ?? true; public static bool AutoBunnyhop => autoBunnyhopEntry?.Value ?? true; public static float ForwardSpeed => forwardSpeedEntry?.Value ?? 20f; public static float SideSpeed => sideSpeedEntry?.Value ?? 2f; public static float MaxSpeed => maxSpeedEntry?.Value ?? 2f; public static float Friction => frictionEntry?.Value ?? 20f; public static float StopSpeed => stopSpeedEntry?.Value ?? 0.01524f; public static float Accelerate => accelerateEntry?.Value ?? 20f; public static float AirAccelerate => airAccelerateEntry?.Value ?? 1f; public static float JumpHeight => jumpHeightEntry?.Value ?? 2.1f; public static void Load() { configCategory = MelonPreferences.CreateCategory("Bhop"); enabledEntry = configCategory.CreateEntry<bool>("enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); autoBunnyhopEntry = configCategory.CreateEntry<bool>("autoBunnyhop", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); forwardSpeedEntry = configCategory.CreateEntry<float>("forwardSpeed", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); sideSpeedEntry = configCategory.CreateEntry<float>("sideSpeed", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); maxSpeedEntry = configCategory.CreateEntry<float>("maxSpeed", 2f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); frictionEntry = configCategory.CreateEntry<float>("friction", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); stopSpeedEntry = configCategory.CreateEntry<float>("stopSpeed", 0.01524f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); accelerateEntry = configCategory.CreateEntry<float>("accelerate", 20f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); airAccelerateEntry = configCategory.CreateEntry<float>("airAccelerate", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); jumpHeightEntry = configCategory.CreateEntry<float>("jumpHeight", 2.1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } } public class Bhop : MelonMod { [HarmonyPatch(typeof(PlayerMovement), "Move")] private static class PlayerMovement_Move_Patch { private static readonly MethodInfo TryToggleCrouchMethod = AccessTools.Method(typeof(PlayerMovement), "TryToggleCrouch", (Type[])null, (Type[])null); private static readonly FieldInfo IsJumpingField = AccessTools.Field(typeof(PlayerMovement), "isJumping"); private static readonly PropertyInfo IsSprintingProperty = AccessTools.Property(typeof(PlayerMovement), "isSprinting"); private static Vector3 _velocity; private static bool _wasGrounded; private static int _groundedFrames; private static bool _initialized; private static int _lastFrameSeen = -1; private static bool _ranInFixedThisFrame; private const float SprintMultiplier = 1.25f; private const float CrouchMoveMultiplier = 1f / 3f; private const float GroundCheckDistance = 0.08f; private const float StickToGroundSpeed = 2f; private const float DistEpsilon = 1f / 32f; private const float MinMoveFraction = 0.0001f; private const float EffectivelyHorizontalNormalY = 0.0001f; private const int MaxClipPlanes = 5; private const int MaxBumps = 4; private const float StandableNormalY = 0.7f; private static int GetMovementMask() { try { int num = LayerMask.NameToLayer("Trash"); if (num >= 0) { return ~(1 << num); } } catch { } return -5; } private static void GetControllerCapsule(CharacterController controller, out Vector3 p1, out Vector3 p2, out float radius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)controller).transform; Vector3 up = transform.up; radius = Mathf.Max(0.0001f, controller.radius); float num = Mathf.Max(0f, controller.height * 0.5f - radius); Vector3 val = transform.position + transform.rotation * controller.center; p1 = val + up * num; p2 = val - up * num; } private static void GetControllerCapsuleAt(CharacterController controller, Vector3 worldPos, out Vector3 p1, out Vector3 p2, out float radius) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)controller).transform; Vector3 up = transform.up; radius = Mathf.Max(0.0001f, controller.radius); float num = Mathf.Max(0f, controller.height * 0.5f - radius); Vector3 val = worldPos + transform.rotation * controller.center; p1 = val + up * num; p2 = val - up * num; } private static int ClipVelocity(Vector3 inVelocity, Vector3 planeNormal, out Vector3 outVelocity) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) int num = 0; float y = planeNormal.y; if (y > 0f) { num |= 1; } if (Mathf.Abs(y) <= 0.0001f) { num |= 2; } float num2 = Vector3.Dot(inVelocity, planeNormal); outVelocity = inVelocity - planeNormal * num2; float num3 = Vector3.Dot(outVelocity, planeNormal); if (num3 < 0f) { num3 = Mathf.Min(num3, -1f / 32f); outVelocity -= planeNormal * num3; } return num; } private static int TryPlayerMove(CharacterController controller, ref Vector3 velocity, float dt) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) float num = dt; int num2 = 0; int num3 = 0; Vector3[] array = (Vector3[])(object)new Vector3[5]; Vector3 inVelocity = velocity; Vector3 val = velocity; int movementMask = GetMovementMask(); float num4 = Mathf.Max(0.001f, controller.skinWidth); float num5 = Mathf.Sqrt(num4 * num4 + num4 * num4); Vector3 val2 = ((Component)controller).transform.position; RaycastHit val5 = default(RaycastHit); Ray val6 = default(Ray); RaycastHit val7 = default(RaycastHit); for (int i = 0; i < 4; i++) { if (((Vector3)(ref velocity)).sqrMagnitude <= 0f) { break; } Vector3 val3 = velocity * num; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude <= 1E-05f) { break; } Vector3 val4 = val3 / magnitude; GetControllerCapsuleAt(controller, val2, out var p, out var p2, out var radius); float num6 = magnitude + num5; bool flag = Physics.CapsuleCast(p, p2, radius, val4, ref val5, num6, movementMask, (QueryTriggerInteraction)1); float num7 = (flag ? Mathf.Max(0f, ((RaycastHit)(ref val5)).distance - num5) : magnitude); float num8 = ((magnitude > 1E-05f) ? (num7 / magnitude) : 1f); if (num8 > 0f && num8 < 0.0001f) { num8 = 0f; } if (num8 > 0f) { val2 += val4 * num7; inVelocity = velocity; num3 = 0; } if (!flag || num8 >= 1f) { break; } Vector3 normal = ((RaycastHit)(ref val5)).normal; try { if ((Object)(object)((RaycastHit)(ref val5)).collider != (Object)null) { ((Ray)(ref val6))..ctor(((RaycastHit)(ref val5)).point - val4 * 0.001f, val4); if (((RaycastHit)(ref val5)).collider.Raycast(val6, ref val7, 0.01f)) { normal = ((RaycastHit)(ref val7)).normal; } } } catch { } if (normal.y > 0.7f) { num2 |= 1; } if (Mathf.Abs(normal.y) < 0.0001f) { normal.y = 0f; num2 |= 2; } num -= num * num8; if (num3 >= 5) { velocity = Vector3.zero; break; } array[num3++] = normal; Vector3 outVelocity = velocity; if (num3 == 1) { ClipVelocity(inVelocity, array[0], out outVelocity); velocity = outVelocity; inVelocity = outVelocity; continue; } int j; for (j = 0; j < num3; j++) { ClipVelocity(inVelocity, array[j], out outVelocity); int k; for (k = 0; k < num3 && (k == j || !(Vector3.Dot(outVelocity, array[k]) < 0f)); k++) { } if (k == num3) { break; } } if (j != num3) { velocity = outVelocity; } else { if (num3 != 2) { velocity = Vector3.zero; break; } Vector3 val8 = Vector3.Cross(array[0], array[1]); float magnitude2 = ((Vector3)(ref val8)).magnitude; if (magnitude2 > 0.0001f) { val8 /= magnitude2; } float num9 = Vector3.Dot(val8, velocity); velocity = val8 * num9; } if (Vector3.Dot(velocity, val) <= 0f) { velocity = Vector3.zero; break; } } return num2; } private static bool CheckGrounded(CharacterController controller) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) try { GetControllerCapsule(controller, out var p, out var p2, out var radius); int movementMask = GetMovementMask(); float num = Mathf.Max(0.001f, controller.skinWidth); float num2 = Mathf.Sqrt(num * num + num * num); float num3 = Mathf.Max(0.0001f, radius * 0.95f); Vector3 val = -((Component)controller).transform.up; RaycastHit val2 = default(RaycastHit); return Physics.CapsuleCast(p, p2, num3, val, ref val2, 0.08f + num2, movementMask, (QueryTriggerInteraction)1); } catch { return false; } } private static void ApplyFriction(PlayerMovement pm, float dt) { //IL_001a: 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) Vector3 val = new Vector3(_velocity.x, 0f, _velocity.z); float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude < 0.0001905f)) { float num; try { num = 0.98f; } catch { num = 1f; } float num2 = Config.Friction / Mathf.Max(0.0001f, num); float num3 = ((magnitude < Config.StopSpeed) ? Config.StopSpeed : magnitude); float num4 = num3 * num2 * dt; float num5 = magnitude - num4; if (num5 < 0f) { num5 = 0f; } if (num5 != magnitude) { float num6 = num5 / magnitude; _velocity.x *= num6; _velocity.z *= num6; } } } private static void Accelerate(Vector3 wishDir, float wishSpeed, float accel, float dt) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0045: 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 * dt * wishSpeed; if (num3 > num2) { num3 = num2; } _velocity += wishDir * num3; } } private static void AirAccelerate(Vector3 wishDir, float wishSpeed, float accel, float dt) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(wishSpeed, 1f); float num2 = Vector3.Dot(_velocity, wishDir); float num3 = num - num2; if (!(num3 <= 0f)) { float num4 = accel * dt * wishSpeed; if (num4 > num3) { num4 = num3; } _velocity += wishDir * num4; } } [HarmonyPrefix] private static bool Prefix(PlayerMovement __instance) { //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) if (!Config.Enabled) { return true; } int frameCount = Time.frameCount; if (frameCount != _lastFrameSeen) { _lastFrameSeen = frameCount; _ranInFixedThisFrame = false; } if ((Object)(object)__instance == (Object)null) { return true; } CharacterController controller; try { controller = __instance.Controller; } catch { return true; } if ((Object)(object)controller == (Object)null || !((Collider)controller).enabled) { return true; } try { if ((Object)(object)__instance.CurrentVehicle != (Object)null) { return true; } } catch { } float num; if (Time.inFixedTimeStep) { _ranInFixedThisFrame = true; num = Time.fixedDeltaTime; } else { if (_ranInFixedThisFrame) { return false; } num = Time.deltaTime; if (num <= 0f) { num = Time.fixedDeltaTime; } } if (!_initialized) { _initialized = true; try { _velocity = controller.velocity; } catch { _velocity = Vector3.zero; } } bool flag = CheckGrounded(controller); if (flag) { _groundedFrames++; } else { _groundedFrames = 0; } if (flag) { if (_velocity.y < 0f) { _velocity.y = -2f; } } else { _velocity.y += Physics.gravity.y * num * PlayerMovement.GravityMultiplier; } bool flag2 = true; bool flag3 = true; try { flag2 = __instance.CanMove; } catch { } try { flag3 = __instance.CanJump; } catch { } bool flag4 = false; try { flag4 = GameInput.IsTyping; } catch { } try { if (flag2 && !flag4 && GameInput.GetButtonDown((ButtonCode)8)) { TryToggleCrouchMethod?.Invoke(__instance, Array.Empty<object>()); } } catch { } bool flag5 = false; try { flag5 = __instance.IsCrouched; } catch { } float num2 = 0f; float num3 = 0f; try { if (GameInput.GetButton((ButtonCode)3)) { num2 += Config.ForwardSpeed; } if (GameInput.GetButton((ButtonCode)4)) { num2 -= Config.ForwardSpeed; } if (GameInput.GetButton((ButtonCode)5)) { num3 -= Config.SideSpeed; } if (GameInput.GetButton((ButtonCode)6)) { num3 += Config.SideSpeed; } } catch { } if (flag5) { num2 *= 1f / 3f; num3 *= 1f / 3f; } bool flag6 = false; try { flag6 = GameInput.GetButton((ButtonCode)9); } catch { } bool flag7 = flag6 && flag2 && !flag5 && (Mathf.Abs(num2) > 0.0001f || Mathf.Abs(num3) > 0.0001f); try { IsSprintingProperty?.SetValue(__instance, flag7); } catch { } Vector3 forward; Vector3 right; try { Transform transform = ((Component)__instance.Player).transform; forward = transform.forward; right = transform.right; } catch { forward = Vector3.forward; right = Vector3.right; } forward.y = 0f; right.y = 0f; ((Vector3)(ref forward)).Normalize(); ((Vector3)(ref right)).Normalize(); Vector3 val = forward * num2 + right * num3; float num4 = ((Vector3)(ref val)).magnitude; Vector3 wishDir = ((num4 > 0.0001f) ? (val / num4) : Vector3.zero); float num5 = (flag7 ? (Config.MaxSpeed * 1.25f) : Config.MaxSpeed); if (num4 > num5) { num4 = num5; } bool flag8 = false; try { flag8 = (Config.AutoBunnyhop ? GameInput.GetButton((ButtonCode)7) : GameInput.GetButtonDown((ButtonCode)7)); } catch { } try { if (flag8 && flag && flag2 && flag3 && !flag4 && !__instance.IsJumping) { try { IsJumpingField?.SetValue(__instance, true); } catch { } try { __instance.onJump?.Invoke(); } catch { } try { Player local = Player.Local; if (local != null) { local.PlayJumpAnimation(); } } catch { } float num6 = 5.25f; float jumpMultiplier = PlayerMovement.JumpMultiplier; _velocity.y = Mathf.Sqrt(Mathf.Max(0f, 2f * num6 * jumpMultiplier * Config.JumpHeight)); flag = false; } } catch { } if (flag) { if (_groundedFrames > 1 || _wasGrounded) { ApplyFriction(__instance, num); } if (flag2) { Accelerate(wishDir, num4, Config.Accelerate, num); } } else if (flag2) { AirAccelerate(wishDir, num4, Config.AirAccelerate, num); } TryPlayerMove(controller, ref _velocity, num); controller.Move(_velocity * num); if (_wasGrounded = CheckGrounded(controller)) { try { if (__instance.IsJumping) { try { IsJumpingField?.SetValue(__instance, false); } catch { } } } catch { } if (_velocity.y < 0f) { _velocity.y = -2f; } } return false; } } public override void OnInitializeMelon() { Config.Load(); try { ((MelonBase)this).HarmonyInstance.PatchAll(); } catch { } } }