using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Marrow;
using MelonLoader;
using MelonLoader.Preferences;
using Microsoft.CodeAnalysis;
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(BHop), "BHop", "2.4.0", "mark", null)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("MotionLab")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MotionLab")]
[assembly: AssemblyTitle("MotionLab")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class BHop : MelonMod
{
private MelonPreferences_Category category;
private MelonPreferences_Entry<bool> prefEnabled;
private MelonPreferences_Entry<bool> prefAutoBhop;
private MelonPreferences_Entry<bool> prefCamDrive;
private MelonPreferences_Entry<bool> prefDriveRig;
private MelonPreferences_Entry<bool> prefDriveHands;
private MelonPreferences_Entry<bool> prefHideAvatar;
private MelonPreferences_Entry<float> prefGravity;
private MelonPreferences_Entry<float> prefJumpHeight;
private MelonPreferences_Entry<float> prefMaxSpeed;
private MelonPreferences_Entry<float> prefAccelerate;
private MelonPreferences_Entry<float> prefAirAccelerate;
private MelonPreferences_Entry<float> prefFriction;
private MelonPreferences_Entry<float> prefGroundDrag;
private MelonPreferences_Entry<float> prefStopSpeed;
private MelonPreferences_Entry<float> prefBhopFactor;
private MelonPreferences_Entry<float> prefRadius;
private MelonPreferences_Entry<float> prefHeight;
private MelonPreferences_Entry<bool> prefSprint;
private MelonPreferences_Entry<bool> prefCrouch;
private MelonPreferences_Entry<float> prefSprintMult;
private MelonPreferences_Entry<float> prefCrouchSpeed;
private MelonPreferences_Entry<float> prefCrouchHeight;
private PhysicsRig rig;
private Transform head;
private readonly List<Rigidbody> bodies = new List<Rigidbody>();
private readonly List<Vector3> bodyOffsets = new List<Vector3>();
private Vector3 headOffset;
private bool init;
private Vector3 vp;
private Vector3 vv;
private bool grounded;
private bool active;
private Vector3 forwardInput;
private bool jumpPressed;
private bool jumpHeld;
private float floorLevel;
private readonly List<Renderer> hidden = new List<Renderer>();
private readonly List<Material> hiddenMats = new List<Material>();
private Material transparentMat;
private bool avatarHidden;
private bool sprinting;
private bool crouching;
private float curHeight;
private float crouchT;
private void F1()
{
category = MelonPreferences.CreateCategory("BHop", "Bunny Hop");
prefEnabled = category.CreateEntry<bool>("Enabled", true, "Enabled", (string)null, false, false, (ValueValidator)null, (string)null);
prefAutoBhop = category.CreateEntry<bool>("AutoBhop", true, "Auto bhop", "Hold Space/J to keep hopping automatically", false, false, (ValueValidator)null, (string)null);
prefCamDrive = category.CreateEntry<bool>("CamDrive", false, "Steer with head/camera", "Run toward where the camera faces when no move key is held", false, false, (ValueValidator)null, (string)null);
prefDriveRig = category.CreateEntry<bool>("DriveRig", true, "Drive rig every tick", "Move all rig rigidbodies toward the virtual player each physics tick", false, false, (ValueValidator)null, (string)null);
prefDriveHands = category.CreateEntry<bool>("DriveHands", false, "Lock hands/arms up out of the way", "If off, hands and arms stay free for aiming and grabbing", false, false, (ValueValidator)null, (string)null);
prefHideAvatar = category.CreateEntry<bool>("HideAvatar", true, "Hide avatar", "Hide body/limb renderers so limbs don't block view", false, false, (ValueValidator)null, (string)null);
prefGravity = category.CreateEntry<float>("Gravity", 20f, "Gravity", "Global gravity in m/s2", false, false, (ValueValidator)null, (string)null);
prefJumpHeight = category.CreateEntry<float>("JumpHeight", 0.8f, "Jump height", "Jump apex height in meters", false, false, (ValueValidator)null, (string)null);
prefMaxSpeed = category.CreateEntry<float>("MaxSpeed", 4f, "Max speed", "Base walk speed in m/s", false, false, (ValueValidator)null, (string)null);
prefAccelerate = category.CreateEntry<float>("Accelerate", 8f, "Ground accel", (string)null, false, false, (ValueValidator)null, (string)null);
prefAirAccelerate = category.CreateEntry<float>("AirAccelerate", 2f, "Air accel", "Air control strength (bhop steering)", false, false, (ValueValidator)null, (string)null);
prefFriction = category.CreateEntry<float>("Friction", 4f, "Ground friction", (string)null, false, false, (ValueValidator)null, (string)null);
prefGroundDrag = category.CreateEntry<float>("GroundDrag", 1f, "Ground drag scale", "Higher = stop faster after landing, less sliding", false, false, (ValueValidator)null, (string)null);
prefStopSpeed = category.CreateEntry<float>("StopSpeed", 2.5f, "Stop speed", (string)null, false, false, (ValueValidator)null, (string)null);
prefBhopFactor = category.CreateEntry<float>("BhopFactor", 1.7f, "Bhop speed cap per jump", "PM_PreventMegaBunnyJumping 1.7 * maxspeed", false, false, (ValueValidator)null, (string)null);
prefRadius = category.CreateEntry<float>("Radius", 0.3f, "Collider radius", "Body collision radius in meters", false, false, (ValueValidator)null, (string)null);
prefHeight = category.CreateEntry<float>("Height", 1.7f, "Collider height", "Body capsule height in meters", false, false, (ValueValidator)null, (string)null);
prefSprint = category.CreateEntry<bool>("Sprint", true, "Sprint", "Hold Shift to sprint", false, false, (ValueValidator)null, (string)null);
prefCrouch = category.CreateEntry<bool>("Crouch", true, "Crouch", "Hold Ctrl or C to crouch", false, false, (ValueValidator)null, (string)null);
prefSprintMult = category.CreateEntry<float>("SprintMult", 1.8f, "Sprint speed", "Sprint speed multiplier", false, false, (ValueValidator)null, (string)null);
prefCrouchSpeed = category.CreateEntry<float>("CrouchSpeed", 0.4f, "Crouch speed", "Crouch speed multiplier", false, false, (ValueValidator)null, (string)null);
prefCrouchHeight = category.CreateEntry<float>("CrouchHeight", 0.6f, "Crouch height scale", "Crouched collider height as a fraction of full height", false, false, (ValueValidator)null, (string)null);
}
public override void OnInitializeMelon()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
F1();
active = prefEnabled.Value;
((MelonEventBase<LemonAction>)(object)MelonEvents.OnFixedUpdate).Subscribe(new LemonAction(F13), 0, false);
((MelonEventBase<LemonAction>)(object)MelonEvents.OnUpdate).Subscribe(new LemonAction(F2), 0, false);
MelonLogger.Msg("[BHop] 2.4.0 loaded - virtual-dimension bhop. F8 toggles.");
}
private void F2()
{
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)289))
{
active = !active;
prefEnabled.Value = active;
MelonLogger.Msg("[BHop] " + (active ? "ENABLED" : "DISABLED"));
}
if (active)
{
float num = 0f;
float num2 = 0f;
if (Input.GetKey((KeyCode)119))
{
num += 1f;
}
if (Input.GetKey((KeyCode)115))
{
num -= 1f;
}
if (Input.GetKey((KeyCode)100))
{
num2 += 1f;
}
if (Input.GetKey((KeyCode)97))
{
num2 -= 1f;
}
jumpPressed = Input.GetKeyDown((KeyCode)32) || Input.GetKeyDown((KeyCode)106);
jumpHeld = Input.GetKey((KeyCode)32) || Input.GetKey((KeyCode)106);
sprinting = prefSprint.Value && (Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303));
crouching = prefCrouch.Value && (Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305) || Input.GetKey((KeyCode)99));
Camera main = Camera.main;
Vector3 val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.forward : Vector3.forward);
Vector3 val2 = (((Object)(object)main != (Object)null) ? ((Component)main).transform.right : Vector3.right);
val.y = 0f;
val2.y = 0f;
((Vector3)(ref val)).Normalize();
((Vector3)(ref val2)).Normalize();
Vector3 val3 = val * num + val2 * num2;
if (prefCamDrive.Value && num == 0f && num2 == 0f)
{
val3 = val;
}
if (((Vector3)(ref val3)).sqrMagnitude > 1f)
{
((Vector3)(ref val3)).Normalize();
}
forwardInput = val3;
}
}
private PhysicsRig F3()
{
//IL_0068: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
Il2CppArrayBase<PhysicsRig> val = Object.FindObjectsOfType<PhysicsRig>();
if (val == null || val.Length == 0)
{
return null;
}
if (val.Length == 1)
{
return val[0];
}
Camera main = Camera.main;
if ((Object)(object)main == (Object)null)
{
return val[0];
}
Vector3 position = ((Component)main).transform.position;
PhysicsRig result = val[0];
float num = float.MaxValue;
for (int i = 0; i < val.Length; i++)
{
Transform val2 = ((Rig)val[i]).m_head;
if (!((Object)(object)val2 == (Object)null))
{
Vector3 val3 = val2.position - position;
float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude;
if (sqrMagnitude < num)
{
num = sqrMagnitude;
result = val[i];
}
}
}
return result;
}
private void F4()
{
//IL_0051: 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_0058: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//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_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
rig = F3();
if ((Object)(object)rig == (Object)null)
{
return;
}
head = ((Rig)rig).m_head;
if ((Object)(object)head == (Object)null)
{
rig = null;
return;
}
Vector3 val = F12();
vp = val;
vv = Vector3.zero;
grounded = true;
floorLevel = F7();
headOffset = head.position - vp;
curHeight = prefHeight.Value;
bodies.Clear();
bodyOffsets.Clear();
Il2CppArrayBase<Rigidbody> componentsInChildren = ((Component)rig).GetComponentsInChildren<Rigidbody>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
if ((Object)(object)componentsInChildren[i] == (Object)null || F6(((Component)componentsInChildren[i]).transform))
{
continue;
}
Vector3 val2 = ((Component)componentsInChildren[i]).transform.position - vp;
if (F5(((Component)componentsInChildren[i]).transform))
{
if (!prefDriveHands.Value)
{
continue;
}
((Vector3)(ref val2))..ctor(val2.x, prefHeight.Value + 0.45f, val2.z);
}
bodies.Add(componentsInChildren[i]);
bodyOffsets.Add(val2);
}
init = true;
MelonLogger.Msg($"[BHop] rig acquired. body parts: {bodies.Count}");
}
private bool F5(Transform t)
{
while ((Object)(object)t != (Object)null)
{
string name = ((Object)t).name;
if (name != null && (name.IndexOf("hand", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("palm", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("finger", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("thumb", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("wrist", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("arm", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("elbow", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("shoulder", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("clavicle", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("grip", StringComparison.OrdinalIgnoreCase) >= 0))
{
return true;
}
t = t.parent;
}
return false;
}
private bool F6(Transform t)
{
while ((Object)(object)t != (Object)null)
{
string name = ((Object)t).name;
if (name != null && (name.IndexOf("leg", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("feet", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("foot", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("knee", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("toe", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("shin", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("calf", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("ankle", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("heel", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("thigh", StringComparison.OrdinalIgnoreCase) >= 0 || name.IndexOf("sole", StringComparison.OrdinalIgnoreCase) >= 0))
{
return true;
}
t = t.parent;
}
return false;
}
private float F7()
{
//IL_00e6: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
try
{
if ((Object)(object)rig != (Object)null && (Object)(object)rig.rbFeet != (Object)null)
{
Collider componentInChildren = ((Component)rig.rbFeet).GetComponentInChildren<Collider>();
if ((Object)(object)componentInChildren != (Object)null)
{
Bounds bounds = componentInChildren.bounds;
return ((Bounds)(ref bounds)).min.y;
}
}
}
catch
{
}
try
{
if ((Object)(object)rig != (Object)null && (Object)(object)rig.rbFeet != (Object)null)
{
return rig.rbFeet.position.y;
}
}
catch
{
}
if ((Object)(object)rig != (Object)null && (Object)(object)rig.rbKnee != (Object)null)
{
return rig.rbKnee.position.y - 0.4f;
}
return vp.y;
}
private bool F8()
{
try
{
return (Object)(object)rig != (Object)null && (Object)(object)head != (Object)null && (Object)(object)((Component)head).transform != (Object)null;
}
catch
{
return false;
}
}
private bool F9(Collider c)
{
if ((Object)(object)c == (Object)null || (Object)(object)rig == (Object)null)
{
return false;
}
try
{
return ((Component)c).transform.IsChildOf(((Component)rig).transform);
}
catch
{
return false;
}
}
private bool F10(Vector3 p0, Vector3 p1, float radius, Vector3 dir, out RaycastHit hit, float dist)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
for (int i = 0; i < 12; i++)
{
if (!Physics.CapsuleCast(p0 + dir * num, p1 + dir * num, radius, dir, ref hit, dist - num, -1, (QueryTriggerInteraction)1))
{
return false;
}
if (!F9(((RaycastHit)(ref hit)).collider))
{
return true;
}
num += Mathf.Max(0.02f, ((RaycastHit)(ref hit)).distance + 0.02f);
if (num >= dist)
{
hit = default(RaycastHit);
return false;
}
}
hit = default(RaycastHit);
return false;
}
private bool F11(Vector3 point, float radius, Vector3 dir, out RaycastHit hit, float dist)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: 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_0042: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < 12; i++)
{
if (!Physics.SphereCast(point, radius, dir, ref hit, dist, -1, (QueryTriggerInteraction)1))
{
return false;
}
if (!F9(((RaycastHit)(ref hit)).collider))
{
return true;
}
point += dir * Mathf.Max(0.02f, ((RaycastHit)(ref hit)).distance + 0.02f);
dist -= Mathf.Max(0.02f, ((RaycastHit)(ref hit)).distance + 0.02f);
if (dist <= 0f)
{
hit = default(RaycastHit);
return false;
}
}
hit = default(RaycastHit);
return false;
}
private Vector3 F12()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_0061: 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)
//IL_0063: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: 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_009a: 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)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = head.position;
Vector3 val = position;
if ((Object)(object)rig.rbKnee != (Object)null)
{
val = rig.rbKnee.position;
}
Vector3 val2 = position;
if ((Object)(object)rig.rbFeet != (Object)null)
{
val2 = rig.rbFeet.position;
}
Vector3 val3 = (position + val + val2) / 3f;
float num = (((Object)(object)rig.rbFeet != (Object)null) ? (val2.y - 0.05f) : (position.y - 1.6f));
return new Vector3(val3.x, num, val3.z);
}
private void F13()
{
if (!active)
{
return;
}
if (!F8())
{
init = false;
bodies.Clear();
bodyOffsets.Clear();
}
if (!init)
{
F4();
return;
}
F29();
float num = Time.fixedDeltaTime;
if (num <= 0f)
{
num = 1f / 90f;
}
floorLevel = F7();
F28();
F31();
bool flag = grounded;
if ((!prefAutoBhop.Value) ? (flag && jumpPressed) : (flag && jumpHeld))
{
F14();
}
F16(num);
if (grounded)
{
vv.y = 0f;
F18(num);
F19();
}
else
{
F20();
}
F23(num);
F28();
F17(num);
if (grounded)
{
if (vp.y - floorLevel > 0.005f)
{
vp.y = floorLevel;
}
vv.y = 0f;
}
F30();
}
private void F14()
{
F15();
float y = Mathf.Sqrt(2f * prefGravity.Value * prefJumpHeight.Value);
vv.y = y;
grounded = false;
}
private void F15()
{
//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)
float num = prefBhopFactor.Value * G1();
if (!(num <= 0f))
{
float magnitude = ((Vector3)(ref vv)).magnitude;
if (!(magnitude <= num))
{
float num2 = num / magnitude * 0.65f;
vv *= num2;
}
}
}
private void F16(float dt)
{
vv.y -= prefGravity.Value * 0.5f * dt;
}
private void F17(float dt)
{
vv.y -= prefGravity.Value * 0.5f * dt;
}
private void F18(float dt)
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
float magnitude = ((Vector3)(ref vv)).magnitude;
if (!(magnitude < 0.1f))
{
float num = ((magnitude < prefStopSpeed.Value) ? prefStopSpeed.Value : magnitude);
float num2 = num * prefFriction.Value * prefGroundDrag.Value * dt;
float num3 = magnitude - num2;
if (num3 < 0f)
{
num3 = 0f;
}
vv *= num3 / magnitude;
}
}
private void F19()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = forwardInput * G1();
float magnitude = ((Vector3)(ref val)).magnitude;
if (!(magnitude < 0.01f))
{
Vector3 wishdir = val / magnitude;
F21(wishdir, magnitude, prefAccelerate.Value);
}
}
private void F20()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//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_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = forwardInput * G1();
float magnitude = ((Vector3)(ref val)).magnitude;
if (!(magnitude < 0.01f))
{
Vector3 wishdir = val / magnitude;
F22(wishdir, magnitude, prefAirAccelerate.Value);
}
}
private void F21(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_0041: 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(vv, wishdir);
float num2 = wishspeed - num;
if (!(num2 <= 0f))
{
float num3 = accel * Time.fixedDeltaTime * wishspeed;
if (num3 > num2)
{
num3 = num2;
}
vv += num3 * wishdir;
}
}
private void F22(Vector3 wishdir, float wishspeed, float accel)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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)
//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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
float num = wishspeed;
if (num > 0.75f)
{
num = 0.75f;
}
float num2 = Vector3.Dot(vv, wishdir);
float num3 = num - num2;
if (!(num3 <= 0f))
{
float num4 = accel * wishspeed * Time.fixedDeltaTime;
if (num4 > num3)
{
num4 = num3;
}
vv += num4 * wishdir;
}
}
private void F23(float dt)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_005b: 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_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = vv * dt;
if (!(((Vector3)(ref val)).sqrMagnitude < 1E-08f))
{
int num = Mathf.Max(1, Mathf.CeilToInt(((Vector3)(ref val)).magnitude / 0.3f));
Vector3 val2 = val / (float)num;
for (int i = 0; i < num; i++)
{
F24(new Vector3(val2.x, 0f, 0f));
F24(new Vector3(0f, 0f, val2.z));
F26(val2.y);
}
}
}
private void F24(Vector3 delta)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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_0044: 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_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: 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_006e: 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_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
float magnitude = ((Vector3)(ref delta)).magnitude;
if (magnitude < 1E-06f)
{
return;
}
Vector3 val = delta / magnitude;
Vector3 p = vp + Vector3.up * prefRadius.Value;
Vector3 p2 = vp + Vector3.up * (curHeight - prefRadius.Value);
if (F10(p, p2, prefRadius.Value, val, out var hit, magnitude + 0.01f))
{
float num = Mathf.Max(0f, ((RaycastHit)(ref hit)).distance - 0.01f);
vp += val * num;
if (((RaycastHit)(ref hit)).normal.y > 0.7f)
{
vv.y = Mathf.Min(vv.y, 0f);
return;
}
if (grounded && F25(val, magnitude - num))
{
vv.y = 0f;
return;
}
vv -= Vector3.Project(vv, new Vector3(((RaycastHit)(ref hit)).normal.x, 0f, ((RaycastHit)(ref hit)).normal.z));
vv.y = 0f;
}
else
{
vp += delta;
}
}
private bool F25(Vector3 dir, float remaining)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_003b: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_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_0065: 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_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_008b: 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_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
if (remaining <= 0f)
{
return false;
}
Vector3 val = vp;
Vector3 val2 = vp + Vector3.up * 0.34f;
vp = val2;
Vector3 p = vp + Vector3.up * prefRadius.Value;
Vector3 p2 = vp + Vector3.up * (curHeight - prefRadius.Value);
if (F10(p, p2, prefRadius.Value, dir, out var _, remaining + 0.03f))
{
vp = val;
return false;
}
vp += dir * remaining;
return true;
}
private void F26(float dy)
{
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
if (Mathf.Abs(dy) < 1E-06f)
{
return;
}
if (dy < 0f)
{
if (vp.y + dy < floorLevel + 0.005f)
{
if (vp.y - floorLevel > 0.005f)
{
vp.y = floorLevel;
}
grounded = true;
vv.y = 0f;
}
else
{
vp.y += dy;
}
}
else
{
Vector3 point = vp + Vector3.up * (curHeight * 0.5f);
if (F11(point, prefRadius.Value, Vector3.up, out var hit, dy + 0.05f))
{
float num = ((RaycastHit)(ref hit)).point.y + prefRadius.Value;
vp.y = num - curHeight;
vv.y = 0f;
}
else
{
vp.y += dy;
}
}
F27();
}
private void F27()
{
//IL_0030: 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_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_0051: 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)
//IL_0058: 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)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: 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_0154: Unknown result type (might be due to invalid IL or missing references)
if (grounded || vv.y > 0f)
{
return;
}
float num = 0.32f;
Vector3 p = vp + Vector3.up * (prefRadius.Value + num);
Vector3 p2 = vp + Vector3.up * (curHeight - prefRadius.Value + num);
if (F10(p, p2, prefRadius.Value, Vector3.up, out var _, num + 0.05f))
{
return;
}
Vector3 val = vp + Vector3.up * num;
Vector3 point = val + Vector3.up * (curHeight * 0.5f);
if (F11(point, prefRadius.Value, Vector3.down, out var hit2, num + curHeight * 0.5f + 0.2f) && ((RaycastHit)(ref hit2)).normal.y > 0.7f && ((RaycastHit)(ref hit2)).distance >= curHeight * 0.5f + num - 0.2f)
{
float num2 = ((RaycastHit)(ref hit2)).point.y - prefRadius.Value;
if (num2 - vp.y <= num && num2 >= vp.y - 0.01f)
{
vp.y = num2;
grounded = true;
vv.y = 0f;
}
}
}
private void F28()
{
if (vv.y > 0f)
{
grounded = false;
}
else if (vp.y <= floorLevel + 0.02f)
{
if (vp.y - floorLevel > 0.005f)
{
vp.y = floorLevel;
}
grounded = true;
}
else
{
grounded = false;
}
}
private void F29()
{
//IL_0099: 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_007e: Expected O, but got Unknown
if ((Object)(object)rig == (Object)null)
{
return;
}
if (prefHideAvatar.Value && active)
{
try
{
if ((Object)(object)transparentMat == (Object)null)
{
Shader val = Shader.Find("Sprites/Default");
if ((Object)(object)val == (Object)null)
{
avatarHidden = true;
return;
}
transparentMat = new Material(val);
}
transparentMat.color = new Color(0f, 0f, 0f, 0f);
Il2CppArrayBase<Renderer> componentsInChildren = ((Component)rig).GetComponentsInChildren<Renderer>(true);
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (!((Object)(object)componentsInChildren[i] == (Object)null) && !hidden.Contains(componentsInChildren[i]) && !((Object)(object)componentsInChildren[i].sharedMaterial == (Object)null))
{
hidden.Add(componentsInChildren[i]);
hiddenMats.Add(componentsInChildren[i].sharedMaterial);
componentsInChildren[i].sharedMaterial = transparentMat;
}
}
if (hidden.Count > 300)
{
for (int num = hidden.Count - 1; num >= 0; num--)
{
if ((Object)(object)hidden[num] == (Object)null || (Object)(object)hiddenMats[num] == (Object)null)
{
hidden.RemoveAt(num);
hiddenMats.RemoveAt(num);
}
}
}
avatarHidden = true;
return;
}
catch
{
return;
}
}
if (!avatarHidden)
{
return;
}
for (int j = 0; j < hidden.Count; j++)
{
if ((Object)(object)hidden[j] != (Object)null && (Object)(object)hiddenMats[j] != (Object)null)
{
hidden[j].sharedMaterial = hiddenMats[j];
}
}
hidden.Clear();
hiddenMats.Clear();
avatarHidden = false;
}
private void F30()
{
//IL_003b: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
if (!prefDriveRig.Value)
{
return;
}
for (int i = 0; i < bodies.Count; i++)
{
Rigidbody val = bodies[i];
if (!((Object)(object)val == (Object)null))
{
try
{
val.MovePosition(vp + bodyOffsets[i]);
}
catch
{
}
}
}
if (!((Object)(object)head != (Object)null))
{
return;
}
try
{
head.position = vp + headOffset;
}
catch
{
}
}
private float G1()
{
float num = prefMaxSpeed.Value;
if (sprinting)
{
num *= prefSprintMult.Value;
}
if (crouching)
{
num *= prefCrouchSpeed.Value;
}
return num;
}
private void F31()
{
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)head == (Object)null)
{
return;
}
float num = prefHeight.Value * prefCrouchHeight.Value;
if (num < prefRadius.Value * 2f + 0.05f)
{
num = prefRadius.Value * 2f + 0.05f;
}
float num2 = (crouching ? 1f : 0f);
float num3 = Time.fixedDeltaTime / 0.3f;
if (Mathf.Abs(crouchT - num2) < 1E-06f)
{
crouchT = num2;
}
else if (crouchT < num2)
{
crouchT = Mathf.Min(num2, crouchT + num3);
}
else
{
crouchT = Mathf.Max(num2, crouchT - num3);
}
float num4 = curHeight;
curHeight = Mathf.Lerp(prefHeight.Value, num, crouchT);
if (curHeight > num4)
{
Vector3 point = vp + Vector3.up * (num4 - prefRadius.Value);
if (F11(point, prefRadius.Value, Vector3.up, out var hit, curHeight - num4 + 0.05f))
{
float num5 = ((RaycastHit)(ref hit)).point.y + prefRadius.Value - vp.y;
curHeight = Mathf.Max(num4, Mathf.Min(curHeight, num5));
float num6 = prefHeight.Value - num;
crouchT = ((num6 > 1E-05f) ? Mathf.Clamp01((prefHeight.Value - curHeight) / num6) : 0f);
}
}
headOffset.y = curHeight - prefRadius.Value;
}
}