using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("KnuckleTesting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KnuckleTesting")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9407f467-496e-4117-8715-bdfe3bce9f1b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ParkourKnuckle;
[BepInPlugin("com.nimius.parkourknuckle", "Parkour Knuckle", "1.2.1")]
public class Plugin : BaseUnityPlugin
{
private Harmony _harmony;
public static ConfigEntry<bool> EnableParkourRotation;
private void Awake()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
EnableParkourRotation = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings", "Use Parkour Rotation", true, "Determines whether the camera will tilt and rotate differently when doing parkour actions.");
_harmony = new Harmony("com.nimius.parkourknuckle");
_harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony Patches applied successfully.");
}
}
[HarmonyPatch(typeof(ENT_Player), "Update")]
public class PlayerModifierPatch
{
private static Quaternion targetRotation;
private static bool isRotating = false;
private static float turnSpeed = 24f;
private static bool onCooldown = false;
private static float CooldownDur = 0.2f;
private static float CooldownTime = 0f;
private static float chargeStartTime;
private static bool isCharging;
private static float maxChargeTime = 3.5f;
private static float leapCooldownTime = 0f;
private static float leapCooldownDur = 2f;
private static float leapForceMultiplier = 1f;
private static bool leapCooldown = false;
private static float minStamina = 1f;
private static float maxStamina = 6f;
private static float upwardArcForce = 1f;
private static bool isHolding = false;
private static bool hasWallRunInAir = false;
private static float tiltLerpSpeed = 4f;
private static float gripValue = 0f;
private static bool isHorizRun = false;
private static int spaceTapCount = 0;
private static float spaceTapTimer = 0f;
private const float doubleTapWindow = 0.3f;
private static bool isVerticalRun = false;
private static bool hasWallRunVertical = false;
private static float verticalGraceTimer = 0f;
private static float maxGraceTime = 0.2f;
private static bool isVaulting = false;
private static Vector3 vaultTargetPos;
private static float vaultTimer = 0f;
private static float vaultDuration = 0.2f;
private static bool isSliding = false;
private static float minSlideSpeed = 6f;
private static Vector3 slideDir;
private static bool canSlide = true;
private static float slideTime = 0f;
private static float slideDuration = 1.8f;
private static Vector3 slideStartPos;
private static Vector3 slideTargetPos;
private static float startY;
private static bool wasGrounded;
private static bool isRotatingRoll = false;
private static Quaternion startRotationRoll;
private static Vector3 rollStartPos;
private static Vector3 rollTargetPos;
private static Vector3 rollDir;
private static float rollTimer = 0f;
private static float rollDur = 0.5f;
[HarmonyPostfix]
public static void Postfix(ENT_Player __instance)
{
//IL_0114: 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_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: 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_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_03cb: Unknown result type (might be due to invalid IL or missing references)
//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
//IL_03da: Unknown result type (might be due to invalid IL or missing references)
//IL_03df: Unknown result type (might be due to invalid IL or missing references)
//IL_03e4: Unknown result type (might be due to invalid IL or missing references)
//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
//IL_03ef: Unknown result type (might be due to invalid IL or missing references)
//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0613: Unknown result type (might be due to invalid IL or missing references)
//IL_0622: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_04f9: Unknown result type (might be due to invalid IL or missing references)
//IL_04fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0506: 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_0525: Unknown result type (might be due to invalid IL or missing references)
//IL_052a: Unknown result type (might be due to invalid IL or missing references)
//IL_0534: Unknown result type (might be due to invalid IL or missing references)
//IL_0539: Unknown result type (might be due to invalid IL or missing references)
//IL_053e: Unknown result type (might be due to invalid IL or missing references)
//IL_054a: Unknown result type (might be due to invalid IL or missing references)
//IL_0551: Unknown result type (might be due to invalid IL or missing references)
//IL_06f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0703: Unknown result type (might be due to invalid IL or missing references)
//IL_0708: Unknown result type (might be due to invalid IL or missing references)
//IL_0721: Unknown result type (might be due to invalid IL or missing references)
//IL_072c: Unknown result type (might be due to invalid IL or missing references)
//IL_0991: Unknown result type (might be due to invalid IL or missing references)
//IL_09a0: Unknown result type (might be due to invalid IL or missing references)
//IL_09a5: Unknown result type (might be due to invalid IL or missing references)
//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
//IL_09b8: Unknown result type (might be due to invalid IL or missing references)
//IL_09c5: Unknown result type (might be due to invalid IL or missing references)
//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0a10: Unknown result type (might be due to invalid IL or missing references)
//IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
//IL_07c9: Unknown result type (might be due to invalid IL or missing references)
//IL_07cb: Unknown result type (might be due to invalid IL or missing references)
//IL_07cd: Unknown result type (might be due to invalid IL or missing references)
//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
//IL_07db: Unknown result type (might be due to invalid IL or missing references)
//IL_07e0: Unknown result type (might be due to invalid IL or missing references)
//IL_07e8: Unknown result type (might be due to invalid IL or missing references)
//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0824: Unknown result type (might be due to invalid IL or missing references)
//IL_082c: Unknown result type (might be due to invalid IL or missing references)
//IL_0844: Unknown result type (might be due to invalid IL or missing references)
//IL_0846: Unknown result type (might be due to invalid IL or missing references)
//IL_084b: Unknown result type (might be due to invalid IL or missing references)
//IL_0873: Unknown result type (might be due to invalid IL or missing references)
//IL_0875: Unknown result type (might be due to invalid IL or missing references)
//IL_0886: Unknown result type (might be due to invalid IL or missing references)
//IL_088b: Unknown result type (might be due to invalid IL or missing references)
//IL_0890: Unknown result type (might be due to invalid IL or missing references)
//IL_089e: Unknown result type (might be due to invalid IL or missing references)
//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
//IL_08b0: Unknown result type (might be due to invalid IL or missing references)
//IL_08bc: Unknown result type (might be due to invalid IL or missing references)
//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
//IL_08d3: Unknown result type (might be due to invalid IL or missing references)
//IL_08d8: Unknown result type (might be due to invalid IL or missing references)
//IL_08e2: Unknown result type (might be due to invalid IL or missing references)
//IL_08e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0b32: Unknown result type (might be due to invalid IL or missing references)
//IL_0b39: Unknown result type (might be due to invalid IL or missing references)
//IL_0b49: Unknown result type (might be due to invalid IL or missing references)
//IL_0b4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b55: Unknown result type (might be due to invalid IL or missing references)
//IL_0b65: Unknown result type (might be due to invalid IL or missing references)
//IL_0b6a: Unknown result type (might be due to invalid IL or missing references)
//IL_0b6f: Unknown result type (might be due to invalid IL or missing references)
//IL_0b72: Unknown result type (might be due to invalid IL or missing references)
//IL_0c11: Unknown result type (might be due to invalid IL or missing references)
//IL_0c16: Unknown result type (might be due to invalid IL or missing references)
//IL_0c20: Unknown result type (might be due to invalid IL or missing references)
//IL_0c31: Unknown result type (might be due to invalid IL or missing references)
//IL_0c36: Unknown result type (might be due to invalid IL or missing references)
//IL_104b: Unknown result type (might be due to invalid IL or missing references)
//IL_105b: Unknown result type (might be due to invalid IL or missing references)
//IL_1070: Unknown result type (might be due to invalid IL or missing references)
//IL_1072: Unknown result type (might be due to invalid IL or missing references)
//IL_1077: Unknown result type (might be due to invalid IL or missing references)
//IL_1079: Unknown result type (might be due to invalid IL or missing references)
//IL_0cbc: Unknown result type (might be due to invalid IL or missing references)
//IL_0cc1: Unknown result type (might be due to invalid IL or missing references)
//IL_0d05: Unknown result type (might be due to invalid IL or missing references)
//IL_0d0a: Unknown result type (might be due to invalid IL or missing references)
//IL_0d0f: Unknown result type (might be due to invalid IL or missing references)
//IL_0d17: Unknown result type (might be due to invalid IL or missing references)
//IL_0d1c: Unknown result type (might be due to invalid IL or missing references)
//IL_0d26: Unknown result type (might be due to invalid IL or missing references)
//IL_0d2b: Unknown result type (might be due to invalid IL or missing references)
//IL_0d30: Unknown result type (might be due to invalid IL or missing references)
//IL_0d32: Unknown result type (might be due to invalid IL or missing references)
//IL_0d34: Unknown result type (might be due to invalid IL or missing references)
//IL_0d42: Unknown result type (might be due to invalid IL or missing references)
//IL_0d49: Unknown result type (might be due to invalid IL or missing references)
//IL_0d4e: Unknown result type (might be due to invalid IL or missing references)
//IL_0d53: Unknown result type (might be due to invalid IL or missing references)
//IL_10f3: Unknown result type (might be due to invalid IL or missing references)
//IL_10f8: Unknown result type (might be due to invalid IL or missing references)
//IL_110d: Unknown result type (might be due to invalid IL or missing references)
//IL_1112: Unknown result type (might be due to invalid IL or missing references)
//IL_1117: Unknown result type (might be due to invalid IL or missing references)
//IL_111c: Unknown result type (might be due to invalid IL or missing references)
//IL_1126: Unknown result type (might be due to invalid IL or missing references)
//IL_112b: Unknown result type (might be due to invalid IL or missing references)
//IL_1130: Unknown result type (might be due to invalid IL or missing references)
//IL_0d6b: Unknown result type (might be due to invalid IL or missing references)
//IL_0d70: Unknown result type (might be due to invalid IL or missing references)
//IL_12db: Unknown result type (might be due to invalid IL or missing references)
//IL_12e0: Unknown result type (might be due to invalid IL or missing references)
//IL_12e7: Unknown result type (might be due to invalid IL or missing references)
//IL_12ec: Unknown result type (might be due to invalid IL or missing references)
//IL_12f4: Unknown result type (might be due to invalid IL or missing references)
//IL_12f9: Unknown result type (might be due to invalid IL or missing references)
//IL_1303: Unknown result type (might be due to invalid IL or missing references)
//IL_1308: Unknown result type (might be due to invalid IL or missing references)
//IL_130d: Unknown result type (might be due to invalid IL or missing references)
//IL_1317: Unknown result type (might be due to invalid IL or missing references)
//IL_131c: Unknown result type (might be due to invalid IL or missing references)
//IL_1321: Unknown result type (might be due to invalid IL or missing references)
//IL_119c: Unknown result type (might be due to invalid IL or missing references)
//IL_11a3: Unknown result type (might be due to invalid IL or missing references)
//IL_11a8: Unknown result type (might be due to invalid IL or missing references)
//IL_11af: Unknown result type (might be due to invalid IL or missing references)
//IL_11b4: Unknown result type (might be due to invalid IL or missing references)
//IL_11b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0d91: Unknown result type (might be due to invalid IL or missing references)
//IL_0d96: Unknown result type (might be due to invalid IL or missing references)
//IL_0da0: Unknown result type (might be due to invalid IL or missing references)
//IL_0da5: Unknown result type (might be due to invalid IL or missing references)
//IL_0daf: Unknown result type (might be due to invalid IL or missing references)
//IL_133d: Unknown result type (might be due to invalid IL or missing references)
//IL_1342: Unknown result type (might be due to invalid IL or missing references)
//IL_0df6: Unknown result type (might be due to invalid IL or missing references)
//IL_0df8: Unknown result type (might be due to invalid IL or missing references)
//IL_1419: Unknown result type (might be due to invalid IL or missing references)
//IL_0f58: Unknown result type (might be due to invalid IL or missing references)
//IL_0f62: Unknown result type (might be due to invalid IL or missing references)
//IL_0f72: Unknown result type (might be due to invalid IL or missing references)
//IL_0f77: Unknown result type (might be due to invalid IL or missing references)
//IL_0f7a: Unknown result type (might be due to invalid IL or missing references)
//IL_0f3a: Unknown result type (might be due to invalid IL or missing references)
//IL_0f3f: Unknown result type (might be due to invalid IL or missing references)
//IL_0f4c: Unknown result type (might be due to invalid IL or missing references)
//IL_0e11: Unknown result type (might be due to invalid IL or missing references)
//IL_0e13: Unknown result type (might be due to invalid IL or missing references)
//IL_0e1a: Unknown result type (might be due to invalid IL or missing references)
//IL_0e1f: Unknown result type (might be due to invalid IL or missing references)
//IL_0e24: Unknown result type (might be due to invalid IL or missing references)
//IL_0e26: Unknown result type (might be due to invalid IL or missing references)
//IL_0e28: Unknown result type (might be due to invalid IL or missing references)
//IL_1448: Unknown result type (might be due to invalid IL or missing references)
//IL_1216: Unknown result type (might be due to invalid IL or missing references)
//IL_0e45: Unknown result type (might be due to invalid IL or missing references)
//IL_0e4a: Unknown result type (might be due to invalid IL or missing references)
//IL_0e54: Unknown result type (might be due to invalid IL or missing references)
//IL_0e59: Unknown result type (might be due to invalid IL or missing references)
//IL_0e5e: Unknown result type (might be due to invalid IL or missing references)
//IL_0e60: Unknown result type (might be due to invalid IL or missing references)
//IL_0e62: Unknown result type (might be due to invalid IL or missing references)
//IL_0e64: Unknown result type (might be due to invalid IL or missing references)
//IL_13b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0e98: Unknown result type (might be due to invalid IL or missing references)
//IL_0e9d: Unknown result type (might be due to invalid IL or missing references)
//IL_0ea7: Unknown result type (might be due to invalid IL or missing references)
//IL_0eac: Unknown result type (might be due to invalid IL or missing references)
//IL_0eb6: Unknown result type (might be due to invalid IL or missing references)
//IL_155c: Unknown result type (might be due to invalid IL or missing references)
//IL_156d: Unknown result type (might be due to invalid IL or missing references)
//IL_1572: Unknown result type (might be due to invalid IL or missing references)
//IL_13d1: Unknown result type (might be due to invalid IL or missing references)
//IL_13eb: Unknown result type (might be due to invalid IL or missing references)
//IL_13f0: Unknown result type (might be due to invalid IL or missing references)
//IL_0ed3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ed8: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee2: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee7: Unknown result type (might be due to invalid IL or missing references)
//IL_0eec: Unknown result type (might be due to invalid IL or missing references)
//IL_15d6: Unknown result type (might be due to invalid IL or missing references)
//IL_15db: Unknown result type (might be due to invalid IL or missing references)
//IL_15e2: Unknown result type (might be due to invalid IL or missing references)
//IL_15e7: Unknown result type (might be due to invalid IL or missing references)
//IL_15ef: Unknown result type (might be due to invalid IL or missing references)
//IL_15f4: Unknown result type (might be due to invalid IL or missing references)
//IL_15fe: Unknown result type (might be due to invalid IL or missing references)
//IL_1603: Unknown result type (might be due to invalid IL or missing references)
//IL_1608: Unknown result type (might be due to invalid IL or missing references)
//IL_1612: Unknown result type (might be due to invalid IL or missing references)
//IL_1617: Unknown result type (might be due to invalid IL or missing references)
//IL_161c: Unknown result type (might be due to invalid IL or missing references)
//IL_1597: Unknown result type (might be due to invalid IL or missing references)
//IL_149a: Unknown result type (might be due to invalid IL or missing references)
//IL_149f: Unknown result type (might be due to invalid IL or missing references)
//IL_14b2: Unknown result type (might be due to invalid IL or missing references)
//IL_14b7: Unknown result type (might be due to invalid IL or missing references)
//IL_14dc: Unknown result type (might be due to invalid IL or missing references)
//IL_14e1: Unknown result type (might be due to invalid IL or missing references)
//IL_14e6: Unknown result type (might be due to invalid IL or missing references)
//IL_14eb: Unknown result type (might be due to invalid IL or missing references)
//IL_14f5: Unknown result type (might be due to invalid IL or missing references)
//IL_14fa: Unknown result type (might be due to invalid IL or missing references)
//IL_14ff: Unknown result type (might be due to invalid IL or missing references)
//IL_1638: Unknown result type (might be due to invalid IL or missing references)
//IL_163d: Unknown result type (might be due to invalid IL or missing references)
//IL_167b: Unknown result type (might be due to invalid IL or missing references)
if (CL_GameManager.gamemode.allowLeaderboardScoring)
{
CL_GameManager.gamemode.allowLeaderboardScoring = false;
}
CharacterController component = ((Component)__instance).GetComponent<CharacterController>();
bool isGrounded = component.isGrounded;
isHolding = false;
Hand[] hands = __instance.hands;
foreach (Hand val in hands)
{
if ((Object)(object)val.handhold != (Object)null && val.handhold.GetHolding())
{
isHolding = true;
break;
}
}
if (onCooldown)
{
if (!isRotating)
{
CooldownTime += Time.deltaTime;
}
if (CooldownTime >= CooldownDur)
{
onCooldown = false;
CooldownTime = 0f;
}
}
if (Input.GetKeyUp((KeyCode)120) && !onCooldown && !isHorizRun && ((GameEntity)__instance).health > 0f)
{
onCooldown = true;
targetRotation = ((Component)__instance).transform.rotation * Quaternion.Euler(0f, 180f, 0f);
isRotating = true;
}
if (isRotating)
{
((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, targetRotation, Time.deltaTime * turnSpeed);
if (Quaternion.Angle(((Component)__instance).transform.rotation, targetRotation) < 0.5f)
{
isRotating = false;
}
}
if (leapCooldown)
{
if (isGrounded)
{
leapCooldownTime += Time.deltaTime;
}
if (leapCooldownTime >= leapCooldownDur)
{
leapCooldown = false;
leapCooldownTime = 0f;
}
}
if (Input.GetKeyDown((KeyCode)103) && (isGrounded || isHolding) && !leapCooldown && (isGrounded || isHolding))
{
bool flag = true;
Hand[] hands2 = __instance.hands;
foreach (Hand val2 in hands2)
{
if (val2.gripStrength < minStamina)
{
flag = false;
}
}
if (flag)
{
chargeStartTime = Time.time;
isCharging = true;
}
}
if (isCharging && Input.GetKey((KeyCode)103) && (isGrounded || isHolding) && !leapCooldown)
{
float num = Mathf.Min(Time.time - chargeStartTime, maxChargeTime);
CL_CameraControl.Shake(num * Time.deltaTime * 0.025f);
Hand[] hands3 = __instance.hands;
foreach (Hand val3 in hands3)
{
val3.ShakeHand(num * Time.deltaTime * 0.025f);
}
}
if (Input.GetKeyUp((KeyCode)103) && isCharging && (isGrounded || isHolding) && !leapCooldown)
{
if (!isGrounded && !isHolding)
{
isCharging = false;
return;
}
float num2 = Mathf.Min(Time.time - chargeStartTime, maxChargeTime);
float num3 = Mathf.Min(Time.time - chargeStartTime, maxChargeTime);
float num4 = num3 * leapForceMultiplier;
float num5 = Mathf.CeilToInt(Mathf.Lerp(minStamina, maxStamina, num3 / maxChargeTime));
Vector3 val4 = ((Component)__instance.cam).transform.forward + Vector3.up * upwardArcForce;
Vector3 directionalForce = ((Vector3)(ref val4)).normalized * num4;
((GameEntity)__instance).SetDirectionalForce(directionalForce);
Hand[] hands4 = __instance.hands;
foreach (Hand val5 in hands4)
{
val5.gripStrength -= num5;
if (val5.gripStrength < 0f)
{
val5.gripStrength = 0f;
}
if (val5.IsHolding())
{
val5.DropHand(true);
}
}
leapCooldown = true;
isCharging = false;
}
if (Input.GetKeyDown((KeyCode)32) && Input.GetKey((KeyCode)115))
{
bool flag2 = true;
Hand[] hands5 = __instance.hands;
foreach (Hand val6 in hands5)
{
if (val6.gripStrength < 1f)
{
flag2 = false;
}
}
if (!isHolding && flag2)
{
Vector3 val7 = -((Component)__instance).transform.forward;
RaycastHit val8 = default(RaycastHit);
if (Physics.Raycast(((Component)__instance).transform.position, val7, ref val8, 1.2f))
{
Vector3 val9 = ((RaycastHit)(ref val8)).normal + Vector3.up * 1.2f;
float num6 = 1.5f;
((GameEntity)__instance).SetDirectionalForce(((Vector3)(ref val9)).normalized * num6);
CL_CameraControl.Shake(Time.deltaTime * 0.15f);
Hand[] hands6 = __instance.hands;
foreach (Hand val10 in hands6)
{
val10.gripStrength -= 1f;
if (val10.gripStrength < 0f)
{
val10.gripStrength = 0f;
}
}
}
}
}
if (isGrounded && !isVerticalRun)
{
isHorizRun = false;
isVerticalRun = false;
hasWallRunInAir = false;
hasWallRunVertical = false;
((Collider)component).enabled = true;
((Component)__instance).transform.rotation = Quaternion.Euler(0f, ((Component)__instance).transform.eulerAngles.y, 0f);
}
bool flag3 = true;
Hand[] hands7 = __instance.hands;
foreach (Hand val11 in hands7)
{
gripValue = val11.gripStrength;
if (val11.gripStrength <= 0f)
{
flag3 = false;
}
}
if (Input.GetKeyDown((KeyCode)32))
{
spaceTapCount++;
if (spaceTapCount == 1)
{
spaceTapTimer = 0.3f;
}
}
if (spaceTapTimer > 0f && (!isVerticalRun || !isHorizRun))
{
spaceTapTimer -= Time.deltaTime;
}
else
{
spaceTapCount = 0;
}
RaycastHit val12 = default(RaycastHit);
bool flag4 = Physics.Raycast(((Component)__instance).transform.position, -((Component)__instance).transform.right, ref val12, 1.2f);
RaycastHit val13 = default(RaycastHit);
bool flag5 = Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.right, ref val13, 1.2f);
bool flag6 = spaceTapCount >= 2;
bool flag7 = Input.GetKey((KeyCode)32) && (Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)100));
if (!hasWallRunInAir && flag7 && (flag4 || flag5) && (isHorizRun || flag6))
{
if (flag3)
{
isHorizRun = true;
spaceTapCount = 2;
((Collider)component).enabled = false;
Vector3 val14 = (flag4 ? ((RaycastHit)(ref val12)).normal : ((RaycastHit)(ref val13)).normal);
Vector3 val15 = Vector3.Cross(val14, Vector3.up);
Vector3 val16 = ((Vector3)(ref val15)).normalized;
RaycastHit val17 = default(RaycastHit);
if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val17, 1.2f))
{
isHorizRun = false;
hasWallRunInAir = true;
((Collider)component).enabled = true;
return;
}
if (Vector3.Dot(val16, ((Component)__instance).transform.forward) < 0f)
{
val16 = -val16;
}
float num8 = ((!Plugin.EnableParkourRotation.Value) ? 0f : (flag4 ? (-15f) : 15f));
Quaternion val18 = Quaternion.LookRotation(val16) * Quaternion.Euler(0f, 0f, num8);
((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, val18, Time.deltaTime * tiltLerpSpeed);
((GameEntity)__instance).SetDirectionalForce(val16 * 0.8f * (gripValue * 0.1f) + Vector3.up * 0.1f);
CL_CameraControl.Shake(Time.deltaTime * 0.25f);
Hand[] hands8 = __instance.hands;
foreach (Hand val19 in hands8)
{
val19.gripStrength -= Time.deltaTime * 2.5f;
if (val19.gripStrength < 0f)
{
val19.gripStrength = 0f;
}
}
}
else
{
isHorizRun = false;
hasWallRunInAir = true;
((Collider)component).enabled = true;
}
}
else
{
Quaternion val20 = Quaternion.Euler(0f, ((Component)__instance).transform.eulerAngles.y, 0f);
((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, val20, Time.deltaTime * tiltLerpSpeed);
if (!isGrounded && ((Collider)component).enabled && spaceTapTimer <= 0f)
{
hasWallRunInAir = true;
}
((Collider)component).enabled = true;
isHorizRun = false;
}
RaycastHit val21 = default(RaycastHit);
bool flag8 = Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val21, 1.2f);
bool flag9 = Input.GetKey((KeyCode)32) && Input.GetKey((KeyCode)119);
bool flag10 = spaceTapCount >= 2;
if (isVerticalRun)
{
if (flag9)
{
verticalGraceTimer = 0f;
}
else
{
verticalGraceTimer += Time.deltaTime;
}
}
bool flag11 = true;
Hand[] hands9 = __instance.hands;
foreach (Hand val22 in hands9)
{
if (val22.gripStrength <= 0f)
{
flag11 = false;
}
}
if (isVerticalRun && !flag11)
{
isVerticalRun = false;
hasWallRunVertical = true;
return;
}
if (isVerticalRun && Input.GetKeyDown((KeyCode)32) && verticalGraceTimer > 0f && verticalGraceTimer < maxGraceTime)
{
float num11 = 1.5f;
float num12 = 1.5f;
Vector3 directionalForce2 = ((RaycastHit)(ref val21)).normal * num11 * (gripValue * 0.1f) + Vector3.up * num12 * (gripValue * 0.1f);
((GameEntity)__instance).SetDirectionalForce(directionalForce2);
isVerticalRun = false;
verticalGraceTimer = 0f;
hasWallRunVertical = true;
((Collider)component).enabled = true;
return;
}
if (isVerticalRun && verticalGraceTimer >= maxGraceTime)
{
isVerticalRun = false;
hasWallRunVertical = true;
((Collider)component).enabled = true;
verticalGraceTimer = 0f;
}
if (isVaulting)
{
vaultTimer += Time.deltaTime;
float num13 = vaultTimer / vaultDuration;
((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, vaultTargetPos, 2f);
if (Vector3.Distance(((Component)__instance).transform.position, vaultTargetPos) < 0.1f)
{
isVaulting = false;
((Collider)component).enabled = true;
}
return;
}
if (flag9 && !hasWallRunVertical && flag8 && (!hasWallRunVertical || isVerticalRun) && verticalGraceTimer == 0f && (isVerticalRun || flag10))
{
float num14 = Vector3.Angle(((RaycastHit)(ref val21)).normal, Vector3.up);
if (flag3 && num14 > 80f && num14 < 100f)
{
isVerticalRun = true;
spaceTapCount = 2;
((Collider)component).enabled = false;
Vector3 val23 = -((RaycastHit)(ref val21)).normal;
Vector3 val24 = ((Component)__instance).transform.position + Vector3.up * 1.5f;
bool flag12 = Physics.Raycast(val24, val23, 0.25f);
Quaternion val25 = Quaternion.LookRotation(Vector3.up, ((RaycastHit)(ref val21)).normal);
RaycastHit val26 = default(RaycastHit);
if (flag12 && (!Plugin.EnableParkourRotation.Value || Quaternion.Angle(((Component)__instance).transform.rotation, val25) < 25f) && Physics.SphereCast(((Component)__instance).transform.position + Vector3.up * 1f, 0.3f, Vector3.up, ref val26, 0.7f))
{
isVaulting = false;
hasWallRunVertical = true;
isVerticalRun = false;
((Collider)component).enabled = true;
return;
}
if (!flag12 && !Physics.Raycast(val24, val23, 1f))
{
Vector3 val27 = val24 + val23 * 1f;
RaycastHit val28 = default(RaycastHit);
if (Physics.Raycast(val27, Vector3.down, ref val28, 2f))
{
Vector3 val29 = ((RaycastHit)(ref val28)).point + Vector3.up * 0.5f;
RaycastHit val30 = default(RaycastHit);
if (Physics.Raycast(val29, -val23, ref val30, 1.5f) && ((RaycastHit)(ref val30)).distance < 0.2f)
{
return;
}
RaycastHit val31 = default(RaycastHit);
if (!Physics.SphereCast(((RaycastHit)(ref val28)).point + Vector3.up * 0.1f, 0.3f, Vector3.up, ref val31, 1.8f))
{
vaultTargetPos = ((RaycastHit)(ref val28)).point + Vector3.up * 1.1f;
isVaulting = true;
vaultTimer = 0f;
isVerticalRun = false;
hasWallRunVertical = true;
((Collider)component).enabled = false;
return;
}
}
}
if (Plugin.EnableParkourRotation.Value)
{
((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, val25, Time.deltaTime * 10f);
}
Vector3 directionalForce3 = Vector3.up * 0.4f * (gripValue * 0.15f);
((GameEntity)__instance).SetDirectionalForce(directionalForce3);
CL_CameraControl.Shake(Time.deltaTime * 0.4f);
Hand[] hands10 = __instance.hands;
foreach (Hand val32 in hands10)
{
val32.gripStrength -= Time.deltaTime * 4.5f;
if (val32.gripStrength < 0f)
{
val32.gripStrength = 0f;
}
}
return;
}
}
if (!isGrounded && !isVerticalRun && !isVaulting && verticalGraceTimer <= 0f && spaceTapTimer <= 0f && ((Collider)component).enabled)
{
hasWallRunVertical = true;
}
Vector3 val33 = default(Vector3);
((Vector3)(ref val33))..ctor(component.velocity.x, 0f, component.velocity.z);
Vector3 val34 = ((Component)__instance).transform.InverseTransformDirection(val33);
bool flag13 = val34.z > 0.1f;
float magnitude = ((Vector3)(ref val33)).magnitude;
if (!__instance.IsCrouching() || isGrounded)
{
canSlide = true;
}
if (isGrounded && __instance.IsCrouching() && !isSliding && canSlide && magnitude >= minSlideSpeed && flag13)
{
isSliding = true;
canSlide = false;
slideDir = ((Vector3)(ref val33)).normalized;
slideTime = 0f;
slideStartPos = ((Component)__instance).transform.position;
slideTargetPos = slideStartPos + slideDir * 10f;
((Collider)component).enabled = false;
CL_CameraControl.Shake(Time.deltaTime * 0.1f);
}
if (isSliding)
{
if (Input.GetKeyDown((KeyCode)32))
{
float num16 = 1f - slideTime / slideDuration;
float num17 = 1f * num16;
float num18 = 1.5f * num16;
Vector3 directionalForce4 = slideDir * num17 + Vector3.up * num18;
float num19 = ((Vector3)(ref directionalForce4)).magnitude * 1f;
bool flag14 = true;
Hand[] hands11 = __instance.hands;
foreach (Hand val35 in hands11)
{
if (val35.gripStrength < num19)
{
flag14 = false;
break;
}
}
if (flag14)
{
((GameEntity)__instance).SetDirectionalForce(directionalForce4);
CL_CameraControl.Shake(((Vector3)(ref directionalForce4)).magnitude * Time.deltaTime * 0.1f);
Hand[] hands12 = __instance.hands;
foreach (Hand val36 in hands12)
{
val36.gripStrength -= num19;
if (val36.gripStrength < 0f)
{
val36.gripStrength = 0f;
}
}
isSliding = false;
((Collider)component).enabled = true;
return;
}
}
slideTime += Time.deltaTime;
float num22 = slideTime / slideDuration;
float num23 = 1f - (1f - num22) * (1f - num22);
Vector3 position = Vector3.Lerp(slideStartPos, slideTargetPos, num23);
if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 0.05f + slideDir * 0.3f, slideDir, 0.8f))
{
slideTargetPos = ((Component)__instance).transform.position;
slideTime = slideDuration;
CL_CameraControl.Shake(Time.deltaTime * 0.1f);
isSliding = false;
((Collider)component).enabled = true;
return;
}
if (num22 >= 1f || !__instance.IsCrouching() || !isGrounded)
{
isSliding = false;
((Collider)component).enabled = true;
}
else
{
((Component)__instance).transform.position = position;
if (Plugin.EnableParkourRotation.Value)
{
Transform transform = ((Component)__instance).transform;
transform.rotation *= Quaternion.Euler(5f * Time.deltaTime, 0f, 0f);
}
}
}
if (wasGrounded && !isGrounded)
{
startY = ((Component)__instance).transform.position.y;
}
if (!wasGrounded && isGrounded)
{
float num24 = startY - ((Component)__instance).transform.position.y;
if (num24 >= 15f && num24 <= 50f && __instance.IsCrouching() && !isRotatingRoll)
{
isRotatingRoll = true;
rollTimer = 0f;
startRotationRoll = ((Component)__instance).transform.rotation;
((Collider)component).enabled = false;
rollDir = ((Component)__instance).transform.forward;
rollDir.y = 0f;
((Vector3)(ref rollDir)).Normalize();
rollStartPos = ((Component)__instance).transform.position;
rollTargetPos = rollStartPos + rollDir * 5f;
}
}
if (isRotatingRoll)
{
rollTimer += Time.deltaTime;
float num25 = rollTimer / rollDur;
float num26 = Mathf.Lerp(0f, 360f, num25);
if (Plugin.EnableParkourRotation.Value)
{
((Component)__instance).transform.rotation = startRotationRoll * Quaternion.Euler(num26, 0f, 0f);
}
if (num25 >= 1f)
{
((Component)__instance).transform.rotation = startRotationRoll;
__instance.UnLock();
isRotatingRoll = false;
}
float num27 = rollTimer / rollDur;
float num28 = 1f - (1f - num27) * (1f - num27);
Vector3 position2 = Vector3.Lerp(rollStartPos, rollTargetPos, num28);
if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 0.05f + rollDir * 0.3f, rollDir, 0.8f))
{
rollTargetPos = ((Component)__instance).transform.position;
rollTimer = rollDur;
((Collider)component).enabled = true;
return;
}
if (num27 >= 1f)
{
((Collider)component).enabled = true;
}
else
{
((Component)__instance).transform.position = position2;
}
}
wasGrounded = isGrounded;
}
}