Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LethalParkour v1.0.0
LethalParkour.dll
Decompiled 28 minutes ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EmotesAPI; using GameNetcodeStuff; using HarmonyLib; using LethalEmotesAPI.ImportV2; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("LethalParkour")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LethalParkour")] [assembly: AssemblyTitle("LethalParkour")] [assembly: AssemblyVersion("1.0.0.0")] [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; } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal static class Adrenaline { internal sealed class Frame { internal float speed; internal float stamina; internal bool injury; internal bool changed; internal bool restoreInjury; } private static ConfigEntry<bool> enabled; private static ConfigEntry<float> viewDistance; private static ConfigEntry<float> duration; private static ConfigEntry<float> speed; private static ConfigEntry<float> saving; private static ConfigEntry<float> threshold; private static ConfigEntry<float> crashTime; private static ConfigEntry<float> crashSpeed; private static ConfigEntry<float> cooldown; private static ConfigEntry<float> recoveryTime; private static ConfigEntry<float> recoveryStamina; private static PlayerControllerB player; private static float rushEnd; private static float crashEnd; private static float readyAt; private static float nextScan; private static float used; private static float total; private static float recoveryElapsed; private static bool rushing; private static bool armed = true; private static bool bitePending; private static int surgeCount; private static float currentCrashSpeed = 1f; private static readonly FieldInfo camera = AccessTools.Field(typeof(PlayerControllerB), "gameplayCamera"); private static readonly FieldInfo shipPhase = AccessTools.Field(typeof(StartOfRound), "inShipPhase"); private static readonly FieldInfo health = AccessTools.Field(typeof(PlayerControllerB), "health"); private static readonly FieldInfo move = AccessTools.Field(typeof(PlayerControllerB), "movementSpeed"); private static readonly FieldInfo sprint = AccessTools.Field(typeof(PlayerControllerB), "sprintMeter"); private static readonly FieldInfo injured = AccessTools.Field(typeof(PlayerControllerB), "criticallyInjured"); private static readonly FieldInfo controller = AccessTools.Field(typeof(PlayerControllerB), "thisController"); private static readonly FieldInfo enemies = AccessTools.Field(typeof(RoundManager), "SpawnedEnemies"); private static readonly FieldInfo dead = AccessTools.Field(typeof(EnemyAI), "isEnemyDead"); private static readonly FieldInfo type = AccessTools.Field(typeof(EnemyAI), "enemyType"); private static readonly FieldInfo name = AccessTools.Field(typeof(EnemyType), "enemyName"); internal static PlayerControllerB LocalPlayer => player; internal static bool AudioRushing => rushing; internal static float SpeedFactor { get { if (!rushing) { if (!(Time.time < crashEnd)) { return 1f; } return currentCrashSpeed; } return Mathf.Max(0f, speed.Value); } } internal static float StaminaFactor { get { if (!rushing) { return 1f; } return 1f - Mathf.Clamp01(saving.Value); } } internal static void Init(ConfigFile config) { enabled = config.Bind<bool>("Adrenaline", "Enabled", true, (ConfigDescription)null); viewDistance = config.Bind<float>("Adrenaline", "MaximumSightDistance", 0f, "Zero means no additional distance limit beyond the camera far clip plane."); duration = config.Bind<float>("Adrenaline", "Duration", 12f, (ConfigDescription)null); speed = config.Bind<float>("Adrenaline", "SpeedMultiplier", 1.3f, (ConfigDescription)null); saving = config.Bind<float>("Adrenaline", "StaminaSaving", 0.5f, (ConfigDescription)null); threshold = config.Bind<float>("Adrenaline", "UsageThreshold", 0.6f, (ConfigDescription)null); crashTime = config.Bind<float>("Adrenaline", "CrashDuration", 5f, (ConfigDescription)null); crashSpeed = config.Bind<float>("Adrenaline", "CrashSpeedMultiplier", 0.8f, (ConfigDescription)null); cooldown = config.Bind<float>("Adrenaline", "Cooldown", 30f, (ConfigDescription)null); recoveryTime = config.Bind<float>("Adrenaline", "RecoveryDuration", 30f, "Continuous seconds above the recovery stamina threshold after the second surge and exhaustion."); recoveryStamina = config.Bind<float>("Adrenaline", "RecoveryStaminaThreshold", 0.5f, (ConfigDescription)null); } private static bool Flag(PlayerControllerB p, string field) { object obj = AccessTools.Field(typeof(PlayerControllerB), field)?.GetValue(p); bool flag = default(bool); int num; if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } private static string EnemyName(EnemyAI e) { object obj = type?.GetValue(e); if (obj != null) { return ((name?.GetValue(obj) as string) ?? "").ToLowerInvariant(); } return ""; } private static bool IsBug(EnemyAI e) { if (!(((object)e).GetType().Name == "HoarderBugAI")) { return EnemyName(e).Contains("hoarding bug"); } return true; } private static bool IsLizard(EnemyAI e) { if (!(((object)e).GetType().Name == "PufferAI")) { return EnemyName(e).Contains("spore lizard"); } return true; } private static bool Angry(EnemyAI e) { MethodInfo methodInfo = AccessTools.Method(((object)e).GetType(), "IsHoarderBugAngry", Type.EmptyTypes, (Type[])null); if (methodInfo != null && methodInfo.ReturnType == typeof(bool)) { return (bool)methodInfo.Invoke(e, null); } if (AccessTools.Field(((object)e).GetType(), "currentBehaviourStateIndex")?.GetValue(e) is int num) { return num == 2; } return false; } private static bool Visible(PlayerControllerB p, Camera cam, EnemyAI e, Vector3 point) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_004b: 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_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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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 val = cam.WorldToViewportPoint(point); if (val.z < cam.nearClipPlane || val.z > cam.farClipPlane || val.x < 0f || val.x > 1f || val.y < 0f || val.y > 1f) { return false; } Vector3 val2 = point - ((Component)cam).transform.position; if (viewDistance.Value > 0f && ((Vector3)(ref val2)).magnitude > viewDistance.Value) { return false; } RaycastHit[] array = Physics.RaycastAll(((Component)cam).transform.position, ((Vector3)(ref val2)).normalized, ((Vector3)(ref val2)).magnitude, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (!((Object)(object)((RaycastHit)(ref val3)).collider == (Object)null) && !((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)p).transform) && !((Component)((RaycastHit)(ref val3)).collider).transform.IsChildOf(((Component)e).transform)) { return false; } } return true; } private static bool Threat(PlayerControllerB p) { //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: 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_015f: Unknown result type (might be due to invalid IL or missing references) object? obj = camera?.GetValue(p); Camera val = (Camera)((obj is Camera) ? obj : null); if (val == null || (Object)(object)RoundManager.Instance == (Object)null || !(enemies?.GetValue(RoundManager.Instance) is IEnumerable enumerable)) { return false; } bool flag = default(bool); foreach (object item in enumerable) { EnemyAI val2 = (EnemyAI)((item is EnemyAI) ? item : null); if (val2 == null || (Object)(object)val2 == (Object)null || !((Behaviour)val2).isActiveAndEnabled) { continue; } object obj2 = dead?.GetValue(val2); int num; if (obj2 is bool) { flag = (bool)obj2; num = 1; } else { num = 0; } if (((uint)num & (flag ? 1u : 0u)) != 0) { continue; } string text = EnemyName(val2); if (text.Contains("manticoil") || text.Contains("roaming locust") || text.Contains("docile locust") || IsLizard(val2) || (IsBug(val2) && !Angry(val2))) { continue; } if (Visible(p, val, val2, ((Component)val2).transform.position + Vector3.up * 0.7f)) { return true; } Collider[] componentsInChildren = ((Component)val2).GetComponentsInChildren<Collider>(); foreach (Collider val3 in componentsInChildren) { if (val3.enabled) { Bounds bounds = val3.bounds; if (Visible(p, val, val2, ((Bounds)(ref bounds)).center)) { return true; } } } } return false; } internal static void RegisterAttack(PlayerControllerB p, int before) { if ((Object)(object)p != (Object)null && (Object)(object)p == (Object)(object)player && health?.GetValue(p) is int num && num < before && enabled.Value && surgeCount < 2 && !rushing && Time.time >= readyAt && Time.time >= crashEnd) { bitePending = true; } } internal static int Health(PlayerControllerB p) { if ((Object)(object)p != (Object)null) { object obj = health?.GetValue(p); if (obj is int) { return (int)obj; } } return -1; } [HarmonyPriority(800)] private static void Prefix(PlayerControllerB __instance, out Frame __state) { //IL_0474: Unknown result type (might be due to invalid IL or missing references) //IL_0479: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0483: Unknown result type (might be due to invalid IL or missing references) __state = null; if (!((NetworkBehaviour)__instance).IsOwner || !Flag(__instance, "isPlayerControlled")) { return; } bool flag = default(bool); int num; if ((Object)(object)StartOfRound.Instance != (Object)null) { object obj = shipPhase?.GetValue(StartOfRound.Instance); if (obj is bool) { flag = (bool)obj; num = 1; } else { num = 0; } } else { num = 0; } bool flag2 = (byte)((uint)num & (flag ? 1u : 0u)) != 0; if ((Object)(object)player != (Object)(object)__instance || Flag(__instance, "isPlayerDead") || !enabled.Value || flag2) { player = __instance; rushing = false; crashEnd = (readyAt = (nextScan = 0f)); armed = true; used = 0f; surgeCount = 0; recoveryElapsed = 0f; bitePending = false; if (Flag(__instance, "isPlayerDead") || !enabled.Value || flag2) { return; } } float time = Time.time; if (rushing && time >= rushEnd) { rushing = false; if (used / Mathf.Max(0.01f, total) >= Mathf.Clamp01(threshold.Value)) { int num2 = Mathf.Clamp(surgeCount, 1, 2); float num3 = ((num2 == 1) ? 0f : 0.15f); currentCrashSpeed = Mathf.Clamp01(crashSpeed.Value - num3); crashEnd = time + Mathf.Max(0f, crashTime.Value + 5f * (float)(num2 - 1)); } readyAt = Mathf.Max(crashEnd, time + Mathf.Max(0f, cooldown.Value)); } if (surgeCount >= 2 && !rushing && time >= crashEnd) { if (sprint?.GetValue(__instance) is float num4 && num4 > Mathf.Clamp01(recoveryStamina.Value)) { recoveryElapsed += Time.deltaTime; if (recoveryElapsed >= Mathf.Max(0.1f, recoveryTime.Value)) { surgeCount = 0; recoveryElapsed = 0f; readyAt = time; bitePending = false; armed = false; nextScan = 0f; } } else { recoveryElapsed = 0f; } } bool flag3 = bitePending; bitePending = false; if (time >= nextScan) { nextScan = time + 0.2f; bool flag4 = Threat(__instance); if (!flag4) { armed = true; } flag3 |= flag4 && armed; } if (flag3 && surgeCount < 2 && !rushing && time >= readyAt && time >= crashEnd) { armed = false; rushing = true; surgeCount++; recoveryElapsed = 0f; used = 0f; total = Mathf.Max(0.1f, duration.Value); rushEnd = time + total; if (WallRun.IsWallRunning(__instance) && sprint != null) { sprint.SetValue(__instance, 1f); } } if ((!rushing && time >= crashEnd) || move == null || sprint == null || injured == null) { return; } Frame frame = (__state = new Frame { speed = (float)move.GetValue(__instance), stamina = (float)sprint.GetValue(__instance), injury = (bool)injured.GetValue(__instance), changed = true }); move.SetValue(__instance, frame.speed * SpeedFactor); if (rushing && frame.injury) { injured.SetValue(__instance, false); frame.restoreInjury = true; } if (!rushing) { return; } if (!WallRun.ParkourMoving) { if (!Flag(__instance, "isSprinting")) { return; } object? obj2 = controller?.GetValue(__instance); CharacterController val = (CharacterController)((obj2 is CharacterController) ? obj2 : null); if (val == null) { return; } Vector3 val2 = Vector3.ProjectOnPlane(val.velocity, Vector3.up); if (!(((Vector3)(ref val2)).magnitude > 1f)) { return; } } used += Time.deltaTime; } [HarmonyPriority(0)] private static void Postfix(PlayerControllerB __instance, Frame __state) { Restore(__instance, __state, refund: true); } private static Exception Finalizer(PlayerControllerB __instance, Frame __state, Exception __exception) { Restore(__instance, __state, refund: false); return __exception; } private static void Restore(PlayerControllerB p, Frame f, bool refund) { if (f == null || !f.changed) { return; } f.changed = false; move.SetValue(p, f.speed); if (f.restoreInjury) { injured.SetValue(p, true); } if (refund && rushing && !WallRun.ControlledWallStamina) { float num = (float)sprint.GetValue(p); if (num < f.stamina) { sprint.SetValue(p, Mathf.Clamp01(num + (f.stamina - num) * Mathf.Clamp01(saving.Value))); } } } } [HarmonyPatch] internal static class AdrenalineAttack { private static IEnumerable<MethodBase> TargetMethods() { Type[] types = typeof(EnemyAI).Assembly.GetTypes(); foreach (Type type in types) { if (!typeof(EnemyAI).IsAssignableFrom(type)) { continue; } MethodInfo[] methods = type.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "OnCollideWithPlayer" && !methodInfo.IsAbstract && methodInfo.GetMethodBody() != null) { yield return methodInfo; } } } } private static void Prefix(out int __state) { __state = Adrenaline.Health(Adrenaline.LocalPlayer); } private static void Postfix(int __state) { if (__state > 0) { Adrenaline.RegisterAttack(Adrenaline.LocalPlayer, __state); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("jaspy.lethalparkour", "LethalParkour", "1.0.0")] [DefaultExecutionOrder(10000)] public sealed class LethalParkour : BaseUnityPlugin { internal static LethalParkour Mod; internal ConfigEntry<float> Speed; internal ConfigEntry<float> Duration; internal ConfigEntry<float> Drain; internal ConfigEntry<float> Jump; internal ConfigEntry<float> Push; internal ConfigEntry<float> Cooldown; internal ConfigEntry<float> Slide; internal ConfigEntry<float> Tilt; internal ConfigEntry<float> TiltSpeed; internal ConfigEntry<float> Adhesion; internal ConfigEntry<float> SeamGrace; internal ConfigEntry<float> MantleHeight; internal ConfigEntry<float> MantleReach; internal ConfigEntry<float> MantleSpeed; internal ConfigEntry<bool> Enabled; internal ConfigEntry<bool> MantleDebug; internal ConfigEntry<bool> SlideDebug; internal ConfigEntry<bool> WallDebug; internal ConfigEntry<float> WallReach; internal ConfigEntry<Key> SlideKey; internal ConfigEntry<float> BoostCost; internal ConfigEntry<float> BoostSpeed; internal ConfigEntry<float> BoostCooldown; internal ConfigEntry<float> BoostClickWindow; internal ConfigEntry<float> SlideMinRun; internal ConfigEntry<float> SlideHeight; internal ConfigEntry<float> SlideMax; internal ConfigEntry<float> SlideFriction; internal ConfigEntry<float> SlideGravity; internal ConfigEntry<float> SlideSteer; internal ConfigEntry<Key> RunKey; internal ConfigEntry<Key> MantleKey; internal void SlideLog(string message) { if (SlideDebug.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Slide: " + message)); } } internal void MantleLog(string message) { if (MantleDebug.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mantle: " + message)); } } private void Awake() { //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_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_04e0: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0504: Expected O, but got Unknown //IL_053c: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Expected O, but got Unknown Mod = this; Adrenaline.Init(((BaseUnityPlugin)this).Config); ParkourAudio.Init(((BaseUnityPlugin)this).Config); Harmony val = new Harmony("jaspy.lethalparkour.adrenaline"); val.PatchAll(typeof(Adrenaline)); val.PatchAll(typeof(AdrenalineAttack)); BoostClickWindow = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "BoostDoubleClickSeconds", 0.3f, (ConfigDescription)null); BoostCost = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "BoostStaminaCost", 0.15f, (ConfigDescription)null); BoostSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "BoostSpeed", 4f, (ConfigDescription)null); BoostCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "BoostCooldown", 0.6f, (ConfigDescription)null); SlideKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Sliding", "ActivationKey", (Key)17, (ConfigDescription)null); SlideDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Sliding", "Debug", true, (ConfigDescription)null); SlideMinRun = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "MinimumRunSpeed", 3.5f, (ConfigDescription)null); SlideHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "CapsuleHeight", 0.85f, (ConfigDescription)null); SlideMax = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "MaxSpeed", 22f, (ConfigDescription)null); SlideFriction = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "Friction", 2f, (ConfigDescription)null); SlideGravity = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "SlopeAcceleration", 16f, (ConfigDescription)null); SlideSteer = ((BaseUnityPlugin)this).Config.Bind<float>("Sliding", "SteeringDegreesPerSecond", 75f, (ConfigDescription)null); WallDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("WallRun", "Debug", true, (ConfigDescription)null); WallReach = ((BaseUnityPlugin)this).Config.Bind<float>("WallRun", "Reach", 1.5f, (ConfigDescription)null); RunKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "WallRunKey", (Key)31, "Hold to latch onto a nearby wall"); MantleKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Controls", "MantleKey", (Key)1, "Hold near an obstacle to mantle"); SeamGrace = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "SeamGrace", 0.18f, (ConfigDescription)null); MantleDebug = ((BaseUnityPlugin)this).Config.Bind<bool>("Mantle", "Debug", true, (ConfigDescription)null); MantleHeight = ((BaseUnityPlugin)this).Config.Bind<float>("Mantle", "MaxHeight", 2f, (ConfigDescription)null); MantleReach = ((BaseUnityPlugin)this).Config.Bind<float>("Mantle", "Reach", 1.5f, (ConfigDescription)null); MantleSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Mantle", "Speed", 5f, (ConfigDescription)null); Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Movement", "Enabled", true, (ConfigDescription)null); Speed = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "Speed", 8f, (ConfigDescription)null); Duration = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "WallRunMaximumDuration", 7f, (ConfigDescription)null); Drain = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "WallRunStaminaPerSecondV2", 1f / 14f, (ConfigDescription)null); Jump = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "JumpVelocity", 7f, (ConfigDescription)null); Push = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "JumpAwaySpeed", 5f, (ConfigDescription)null); Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "Cooldown", 0.5f, (ConfigDescription)null); Slide = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "DownwardSpeed", 1f, (ConfigDescription)null); Tilt = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "TiltDegrees", 15f, (ConfigDescription)null); TiltSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Camera", "TiltSpeed", 10f, (ConfigDescription)null); Adhesion = ((BaseUnityPlugin)this).Config.Bind<float>("Movement", "AdhesionSpeed", 2f, (ConfigDescription)null); new Harmony("jaspy.lethalparkour").PatchAll(typeof(WallRun)); new Harmony("jaspy.lethalparkour.camera").PatchAll(typeof(WallCamera)); MethodInfo methodInfo = AccessTools.Method(typeof(PlayerControllerB), "Jump_performed", new Type[1] { typeof(CallbackContext) }, (Type[])null); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mantle jump hook found: " + (methodInfo != null))); if (methodInfo != null) { new Harmony("jaspy.lethalparkour.mantle").Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(WallRun), "BeforeJump", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } MethodInfo methodInfo2 = AccessTools.Method(typeof(PlayerControllerB), "Crouch", new Type[1] { typeof(bool) }, (Type[])null); if (methodInfo2 != null) { new Harmony("jaspy.lethalparkour.posture").Patch((MethodBase)methodInfo2, new HarmonyMethod(typeof(WallRun), "BeforeCrouch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("LethalParkour 1.0.0 loaded; crouch hook found: " + (methodInfo2 != null))); } private void LateUpdate() { WallCamera.Apply(); ParkourAnimation.Tick(); ParkourAudio.Tick(); } private void OnDestroy() { WallCamera.Restore(); ParkourAnimation.Dispose(); ParkourAudio.Dispose(); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal static class WallRun { internal sealed class WeightFrame { internal float original; internal bool changed; } private static PlayerControllerB owner; internal static bool active; private static bool runningFrame; private static float wallEnergy; private static readonly FieldInfo weight = AccessTools.Field(typeof(PlayerControllerB), "carryWeight"); private static bool sliding; private static bool slidingFrame; private static float nextBoost; private static float lastBoostClick = -100f; private static bool allowCrouchChange; private static float slideSpeed; private static float slideCarryUntil; private static float slideGroundTime; private static bool slideConsumed; private static Vector3 lastGroundNormal = Vector3.up; private static Vector3 slideDirection; private static Vector3 slideVelocity; private static float elapsed; private static float blockedUntil; private static float pushUntil; private static float lastWall; private static float nextWallLog; private static readonly ManualLogSource wallLog = Logger.CreateLogSource("LethalParkour.WallRun"); private static bool mantling; private static bool mantleFrame; private static bool mantleRaised; private static bool mantleCrossed; private static Vector3 mantleUp; private static Vector3 mantleEnd; private static Vector3 mantleLandingFeet; private static float mantleDeadline; private static float mantleRetry; private static float mantleStall; private static float mantleBestDistance; private static Vector3 normal; private static Vector3 tangent; private static Vector3 start; private static Vector3 pushDirection; private static readonly FieldInfo controllerField = AccessTools.Field(typeof(PlayerControllerB), "thisController"); private static readonly FieldInfo fall = AccessTools.Field(typeof(PlayerControllerB), "fallValue"); private static readonly FieldInfo uncapped = AccessTools.Field(typeof(PlayerControllerB), "fallValueUncapped"); private static readonly FieldInfo stamina = AccessTools.Field(typeof(PlayerControllerB), "sprintMeter"); private static bool forcedCrouch; private static float standingHeight; private static bool compact; private static float savedHeight; private static Vector3 savedCenter; private static readonly MethodInfo crouchMethod = AccessTools.Method(typeof(PlayerControllerB), "Crouch", new Type[1] { typeof(bool) }, (Type[])null); private static float nextMantleLog; internal static bool ControlledWallStamina => runningFrame; internal static bool ParkourMoving { get { if (!active && !sliding) { return mantling; } return true; } } internal static PlayerControllerB AnimationOwner => owner; internal static int AnimationState { get { if (!mantling) { if (!sliding) { return active ? 1 : 0; } return 2; } return 3; } } internal static Vector3 WallNormal => normal; internal static Vector3 WallDirection => tangent; internal static bool IsWallRunning(PlayerControllerB p) { if ((Object)(object)owner == (Object)(object)p) { return active; } return false; } internal static bool BeforeCrouch(PlayerControllerB __instance, bool __0) { if (!allowCrouchChange && !((Object)(object)__instance != (Object)(object)owner) && ((NetworkBehaviour)__instance).IsOwner) { if (!sliding && !compact) { return !mantling; } return false; } return true; } private static bool Ground(CharacterController c, out RaycastHit hit) { //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_0029: 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_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_0046: 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) //IL_0090: 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_00c4: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)c).transform.TransformPoint(c.center); float num = Mathf.Max(0.05f, c.radius * 0.75f); hit = default(RaycastHit); bool flag = false; RaycastHit[] array = Physics.SphereCastAll(val + Vector3.up * 0.15f, num, Vector3.down, Mathf.Max(0.1f, c.height * 0.5f - num + 0.5f), -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!OwnCollider(c, ((RaycastHit)(ref val2)).collider) && !(((RaycastHit)(ref val2)).normal.y <= 0.35f) && !(((RaycastHit)(ref val2)).distance <= 0.001f) && (!flag || ((RaycastHit)(ref val2)).distance < ((RaycastHit)(ref hit)).distance)) { hit = val2; flag = true; } } return flag; } private static void WallLog(string message, bool immediate = false) { if (LethalParkour.Mod.WallDebug.Value && (immediate || !(Time.time < nextWallLog))) { nextWallLog = Time.time + 0.5f; wallLog.LogInfo((object)message); } } private static bool Flag(PlayerControllerB p, string name) { FieldInfo fieldInfo = AccessTools.Field(typeof(PlayerControllerB), name); if (fieldInfo != null && fieldInfo.FieldType == typeof(bool)) { return (bool)fieldInfo.GetValue(p); } return false; } private static void Stop() { if (active) { blockedUntil = Time.time + Mathf.Max(0f, LethalParkour.Mod.Cooldown.Value); } active = false; } private static void Gravity(PlayerControllerB p, float v) { fall.SetValue(p, v); uncapped.SetValue(p, v); } private static bool Wall(CharacterController c, Vector3 side, out RaycastHit best) { //IL_0001: 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_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_004b: 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_0068: 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_005a: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) best = default(RaycastHit); Vector3 val = ((Component)c).transform.TransformPoint(c.center); int num = -5; bool result = false; float num2 = float.PositiveInfinity; float[] array = new float[3] { 0f, 0.35f, -0.25f }; foreach (float num3 in array) { RaycastHit[] array2 = Physics.SphereCastAll(val + (active ? (tangent * num3) : (Vector3.up * num3)), 0.12f, side, c.radius + Mathf.Clamp(LethalParkour.Mod.WallReach.Value, 0.2f, 3f), num, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val2 = array2[j]; if (!OwnCollider(c, ((RaycastHit)(ref val2)).collider) && !(((RaycastHit)(ref val2)).distance <= 0.001f) && !(Mathf.Abs(((RaycastHit)(ref val2)).normal.y) >= 0.75f) && !(Vector3.Dot(((RaycastHit)(ref val2)).normal, side) > -0.15f)) { float num4 = ((RaycastHit)(ref val2)).distance + (active ? ((1f - Vector3.Dot(normal, ((RaycastHit)(ref val2)).normal)) * 0.45f) : 0f); if (num4 < num2) { num2 = num4; best = val2; result = true; } } } } return result; } private static bool OwnCollider(CharacterController c, Collider other) { if (!((Object)(object)other == (Object)(object)c) && !((Component)other).transform.IsChildOf(((Component)c).transform)) { return (Object)(object)((Component)other).GetComponentInParent<PlayerControllerB>() != (Object)null; } return true; } private static void Compact(CharacterController c, bool needed) { //IL_0035: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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_00b4: 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_00bf: 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) if (needed && !compact) { savedHeight = c.height; savedCenter = c.center; compact = true; } if (compact) { Vector3 val = ((Component)c).transform.TransformPoint(c.center) - Vector3.up * c.height * 0.5f; float num = Mathf.Max(c.radius * 2f, Mathf.Clamp(LethalParkour.Mod.SlideHeight.Value, 0.5f, 1.3f)); if (!needed && Clear(c, val, -5, savedHeight)) { c.height = savedHeight; c.center = ((Component)c).transform.InverseTransformPoint(val + Vector3.up * savedHeight * 0.5f); compact = false; } else { c.height = num; c.center = ((Component)c).transform.InverseTransformPoint(val + Vector3.up * num * 0.5f); } } } private static void SetCrouch(PlayerControllerB p, bool value) { if (Flag(p, "isCrouching") == value) { return; } if (crouchMethod != null) { allowCrouchChange = true; try { crouchMethod.Invoke(p, new object[1] { value }); return; } finally { allowCrouchChange = false; } } AccessTools.Field(typeof(PlayerControllerB), "isCrouching")?.SetValue(p, value); } private static void LowPose(PlayerControllerB p, CharacterController c, bool needed) { //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_0056: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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) if (needed) { if (!forcedCrouch && !Flag(p, "isCrouching")) { standingHeight = (compact ? savedHeight : c.height); forcedCrouch = true; } SetCrouch(p, value: true); } else if (forcedCrouch) { Vector3 feet = ((Component)c).transform.TransformPoint(c.center) - Vector3.up * c.height * 0.5f; if (StandingHeadClear(c, feet, Mathf.Max(standingHeight, c.height))) { SetCrouch(p, value: false); forcedCrouch = Flag(p, "isCrouching"); } } } private static bool StandingHeadClear(CharacterController c, Vector3 feet, float height) { //IL_0047: 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_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) //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_008a: 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) //IL_0093: 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) float num = Mathf.Max(0.05f, c.radius - Mathf.Max(0.06f, c.skinWidth)); float num2 = Mathf.Max(num, height - num - 0.03f); float num3 = Mathf.Min(num2, Mathf.Max(num, c.height - num)); Collider[] array = Physics.OverlapCapsule(feet + Vector3.up * num3, feet + Vector3.up * num2, num, -5, (QueryTriggerInteraction)1); foreach (Collider val in array) { if (!OwnCollider(c, val)) { Bounds bounds = val.bounds; if (!(((Bounds)(ref bounds)).max.y <= feet.y + Mathf.Max(0.08f, c.skinWidth))) { return false; } } } return true; } private static void FinishMantle(PlayerControllerB p, CharacterController c, string reason) { mantling = false; mantleFrame = false; mantleRaised = false; mantleCrossed = false; mantleRetry = Time.time + 0.4f; Gravity(p, -2f); LowPose(p, c, compact || sliding); LethalParkour.Mod.MantleLog(reason); } private static bool Clear(CharacterController c, Vector3 feet, int mask, float poseHeight = 0f) { //IL_0017: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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) float num = Mathf.Max(0.05f, c.radius - 0.06f); Collider[] array = Physics.OverlapCapsule(feet + Vector3.up * (num + 0.08f), feet + Vector3.up * Mathf.Max(num + 0.08f, ((poseHeight > 0f) ? poseHeight : c.height) - num - 0.03f), num, mask, (QueryTriggerInteraction)1); foreach (Collider other in array) { if (!OwnCollider(c, other)) { return false; } } return true; } private static bool Route(CharacterController c, Vector3 feet, Vector3 direction, float distance, int mask, float poseHeight = 0f) { //IL_0017: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_0066: 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_007c: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(0.05f, c.radius - 0.06f); RaycastHit[] array = Physics.CapsuleCastAll(feet + Vector3.up * (num + 0.08f), feet + Vector3.up * Mathf.Max(num + 0.08f, ((poseHeight > 0f) ? poseHeight : c.height) - num - 0.03f), num, direction, distance, mask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val = array[i]; if (!OwnCollider(c, ((RaycastHit)(ref val)).collider)) { return false; } } return true; } private static bool NearbyMantleLanding(CharacterController c, Vector3 feet, out Vector3 landingFeet) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //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_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_0012: 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_002e: 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_005f: 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_006a: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_0130: 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_0145: 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) landingFeet = feet; Vector3 val = Vector3.ProjectOnPlane(feet - mantleEnd, Vector3.up); if (((Vector3)(ref val)).magnitude > 0.24f) { return false; } float num = Mathf.Clamp(feet.y - mantleLandingFeet.y + 0.25f, 0.25f, 3f); RaycastHit val2 = default(RaycastHit); bool flag = false; RaycastHit[] array = Physics.RaycastAll(feet + Vector3.up * 0.08f, Vector3.down, num + 0.08f, -5, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val3 = array[i]; if (!OwnCollider(c, ((RaycastHit)(ref val3)).collider) && (!flag || ((RaycastHit)(ref val3)).distance < ((RaycastHit)(ref val2)).distance)) { val2 = val3; flag = true; } } if (!flag || ((RaycastHit)(ref val2)).normal.y < 0.5f || Mathf.Abs(((RaycastHit)(ref val2)).point.y - mantleLandingFeet.y) > 0.2f) { return false; } Vector3 val4 = ((RaycastHit)(ref val2)).point + Vector3.up * Mathf.Max(0.03f, c.skinWidth); if (!Clear(c, val4, -5, c.height)) { return false; } landingFeet = val4; return true; } private static void Reject(string reason) { if (!(Time.time < nextMantleLog)) { nextMantleLog = Time.time + 0.7f; LethalParkour.Mod.MantleLog(reason); } } private static bool TryMantle(PlayerControllerB p, CharacterController c, Vector3 direction = default(Vector3)) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002c: 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_0035: 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_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_0052: 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_00ab: 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_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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0323: 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_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0337: 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) LethalParkour mod = LethalParkour.Mod; Vector3 val = Vector3.ProjectOnPlane((((Vector3)(ref direction)).sqrMagnitude > 0.01f) ? direction : ((Component)p).transform.forward, Vector3.up); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = ((Component)c).transform.TransformPoint(c.center) - Vector3.up * c.height * 0.5f; int num = -5; float num2 = c.radius + Mathf.Clamp(mod.MantleReach.Value, 0.2f, 2f); float num3 = Mathf.Clamp(mod.MantleHeight.Value, 0.4f, 2.5f); RaycastHit val3 = default(RaycastHit); bool flag = false; for (float num4 = 0.22f; num4 <= num3; num4 += 0.18f) { RaycastHit[] array = Physics.SphereCastAll(val2 + Vector3.up * num4, 0.12f, normalized, num2, num, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val4 = array[i]; if (!OwnCollider(c, ((RaycastHit)(ref val4)).collider) && !(((RaycastHit)(ref val4)).distance <= 0.001f) && !(Mathf.Abs(((RaycastHit)(ref val4)).normal.y) > 0.85f) && (!flag || ((RaycastHit)(ref val4)).distance < ((RaycastHit)(ref val3)).distance)) { val3 = val4; flag = true; } } } if (!flag) { Reject("no obstacle detected"); return false; } float poseHeight = Mathf.Max(c.radius * 2f, c.height * 0.6f); bool flag2 = false; bool flag3 = false; for (float num5 = 0.3f; num5 <= num3 + 0.15f; num5 += 0.1f) { Vector3 val5 = val2 + Vector3.up * num5; if (!Clear(c, val5, num, poseHeight) || !Route(c, val2, Vector3.up, num5, num, poseHeight)) { continue; } flag2 = true; for (float num6 = 0.35f; num6 <= 1.5f; num6 += 0.15f) { float num7 = ((RaycastHit)(ref val3)).distance + c.radius + num6; Vector3 val6 = val5 + normalized * num7; if (!Clear(c, val6, num, poseHeight) || !Route(c, val5, normalized, num7, num, poseHeight)) { continue; } flag3 = true; RaycastHit val7 = default(RaycastHit); bool flag4 = false; RaycastHit[] array = Physics.RaycastAll(val6 + Vector3.up * 0.1f, Vector3.down, num5 + 1.2f, num, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val8 = array[i]; if (!OwnCollider(c, ((RaycastHit)(ref val8)).collider) && (!flag4 || ((RaycastHit)(ref val8)).distance < ((RaycastHit)(ref val7)).distance)) { val7 = val8; flag4 = true; } } if (flag4 && !(((RaycastHit)(ref val7)).normal.y < 0.5f) && Clear(c, ((RaycastHit)(ref val7)).point + Vector3.up * 0.08f, num, poseHeight)) { mantleLandingFeet = ((RaycastHit)(ref val7)).point + Vector3.up * Mathf.Max(0.03f, c.skinWidth); LowPose(p, c, needed: true); mantleUp = val5; mantleEnd = val6; mantleStall = 0f; mantleBestDistance = float.PositiveInfinity; mantling = true; mantleRaised = false; mantleCrossed = false; mantleDeadline = Time.time + 3f; Stop(); pushUntil = 0f; slideCarryUntil = 0f; mod.MantleLog("started over " + ((Object)((RaycastHit)(ref val3)).collider).name + ", lift=" + num5.ToString("F2")); return true; } } } Reject((!flag2) ? "upward clearance blocked" : ((!flag3) ? "forward clearance blocked" : ("no safe landing beyond " + ((Object)((RaycastHit)(ref val3)).collider).name))); return false; } internal static bool BeforeJump(PlayerControllerB __instance) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Invalid comparison between Unknown and I4 //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) LethalParkour mod = LethalParkour.Mod; if (((NetworkBehaviour)__instance).IsOwner && (Object)(object)owner == (Object)(object)__instance && active && mod.Enabled.Value) { return false; } if (!((NetworkBehaviour)__instance).IsOwner || !mod.Enabled.Value || (int)mod.MantleKey.Value != 1 || !Flag(__instance, "isPlayerControlled") || Flag(__instance, "isPlayerDead") || Flag(__instance, "isClimbingLadder") || Flag(__instance, "inSpecialInteractAnimation") || sliding) { return true; } object? value = controllerField.GetValue(__instance); CharacterController val = (CharacterController)((value is CharacterController) ? value : null); if ((Object)(object)val == (Object)null || !((Collider)val).enabled) { return true; } if (mantling && (Object)(object)owner == (Object)(object)__instance) { return false; } if (Time.time < mantleRetry || forcedCrouch) { return true; } if ((Object)(object)owner != (Object)(object)__instance) { return true; } return !TryMantle(__instance, val); } private static void Prefix(PlayerControllerB __instance, out WeightFrame __state) { __state = new WeightFrame(); UpdateMovementFrame(__instance); if ((Object)(object)__instance == (Object)(object)owner && ((NetworkBehaviour)__instance).IsOwner && (runningFrame || slidingFrame) && weight?.GetValue(__instance) is float original) { __state.original = original; __state.changed = true; weight.SetValue(__instance, 1f); } } private static void RestoreWeight(PlayerControllerB p, WeightFrame f) { if (f != null && f.changed) { f.changed = false; weight.SetValue(p, f.original); } } private static Exception Finalizer(PlayerControllerB __instance, WeightFrame __state, Exception __exception) { RestoreWeight(__instance, __state); return __exception; } private unsafe static void UpdateMovementFrame(PlayerControllerB __instance) { //IL_0136: 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_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Unknown result type (might be due to invalid IL or missing references) //IL_0733: 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_032b: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0501: 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_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_052f: 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_0845: Unknown result type (might be due to invalid IL or missing references) //IL_084a: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06f4: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: 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_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: 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_0396: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0384: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0827: Unknown result type (might be due to invalid IL or missing references) //IL_0820: Unknown result type (might be due to invalid IL or missing references) //IL_07f6: Unknown result type (might be due to invalid IL or missing references) //IL_039b: 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_08a8: Unknown result type (might be due to invalid IL or missing references) //IL_0974: Unknown result type (might be due to invalid IL or missing references) //IL_0985: Unknown result type (might be due to invalid IL or missing references) //IL_098a: 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_09aa: 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_09ca: Unknown result type (might be due to invalid IL or missing references) //IL_09e7: Unknown result type (might be due to invalid IL or missing references) //IL_09e9: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Unknown result type (might be due to invalid IL or missing references) //IL_09f9: Unknown result type (might be due to invalid IL or missing references) //IL_09fd: Unknown result type (might be due to invalid IL or missing references) //IL_0a02: Unknown result type (might be due to invalid IL or missing references) //IL_0a09: Unknown result type (might be due to invalid IL or missing references) //IL_0a0b: Unknown result type (might be due to invalid IL or missing references) //IL_0a0d: Unknown result type (might be due to invalid IL or missing references) //IL_0a12: Unknown result type (might be due to invalid IL or missing references) //IL_0a16: 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_0a22: Unknown result type (might be due to invalid IL or missing references) //IL_0a24: Unknown result type (might be due to invalid IL or missing references) //IL_0a2b: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Unknown result type (might be due to invalid IL or missing references) //IL_0a32: Unknown result type (might be due to invalid IL or missing references) //IL_0a39: Unknown result type (might be due to invalid IL or missing references) //IL_0a3b: Unknown result type (might be due to invalid IL or missing references) //IL_0a40: Unknown result type (might be due to invalid IL or missing references) //IL_0a47: Unknown result type (might be due to invalid IL or missing references) //IL_0a49: Unknown result type (might be due to invalid IL or missing references) //IL_0a4e: Unknown result type (might be due to invalid IL or missing references) //IL_0a50: Unknown result type (might be due to invalid IL or missing references) //IL_0a55: Unknown result type (might be due to invalid IL or missing references) //IL_0a59: Unknown result type (might be due to invalid IL or missing references) //IL_0a5e: Unknown result type (might be due to invalid IL or missing references) //IL_0a65: Unknown result type (might be due to invalid IL or missing references) //IL_0a67: Unknown result type (might be due to invalid IL or missing references) //IL_0a6c: Unknown result type (might be due to invalid IL or missing references) //IL_0a6e: Unknown result type (might be due to invalid IL or missing references) //IL_0a73: Unknown result type (might be due to invalid IL or missing references) //IL_0a77: Unknown result type (might be due to invalid IL or missing references) //IL_0a7c: Unknown result type (might be due to invalid IL or missing references) //IL_0a93: Unknown result type (might be due to invalid IL or missing references) //IL_0a98: Unknown result type (might be due to invalid IL or missing references) //IL_0a9b: Unknown result type (might be due to invalid IL or missing references) //IL_0b3b: 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_0b40: Unknown result type (might be due to invalid IL or missing references) //IL_0b42: Unknown result type (might be due to invalid IL or missing references) //IL_0b47: 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_0b52: Unknown result type (might be due to invalid IL or missing references) //IL_0b57: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0abc: Unknown result type (might be due to invalid IL or missing references) //IL_0b6d: Unknown result type (might be due to invalid IL or missing references) //IL_0b66: 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_0b74: Unknown result type (might be due to invalid IL or missing references) //IL_0b76: Unknown result type (might be due to invalid IL or missing references) //IL_0bf0: Unknown result type (might be due to invalid IL or missing references) //IL_0bf2: Unknown result type (might be due to invalid IL or missing references) //IL_0bf7: Unknown result type (might be due to invalid IL or missing references) //IL_0c57: Unknown result type (might be due to invalid IL or missing references) //IL_0c59: Unknown result type (might be due to invalid IL or missing references) //IL_0bd5: Unknown result type (might be due to invalid IL or missing references) //IL_0bda: Unknown result type (might be due to invalid IL or missing references) //IL_0bc1: Unknown result type (might be due to invalid IL or missing references) //IL_0bc6: Unknown result type (might be due to invalid IL or missing references) //IL_0bcb: Unknown result type (might be due to invalid IL or missing references) //IL_0cb1: Unknown result type (might be due to invalid IL or missing references) //IL_0cb3: Unknown result type (might be due to invalid IL or missing references) //IL_0cba: Unknown result type (might be due to invalid IL or missing references) //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cca: Unknown result type (might be due to invalid IL or missing references) //IL_0ccf: Unknown result type (might be due to invalid IL or missing references) //IL_0bdc: Unknown result type (might be due to invalid IL or missing references) //IL_0bde: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner) { return; } runningFrame = false; mantleFrame = false; slidingFrame = false; if ((Object)(object)owner != (Object)(object)__instance) { owner = __instance; compact = false; forcedCrouch = false; active = false; mantling = false; sliding = false; slideCarryUntil = 0f; blockedUntil = (pushUntil = 0f); slideConsumed = false; slideGroundTime = -100f; nextBoost = 0f; lastBoostClick = -100f; } LethalParkour mod = LethalParkour.Mod; object? value = controllerField.GetValue(__instance); CharacterController val = (CharacterController)((value is CharacterController) ? value : null); if (!mod.Enabled.Value || (Object)(object)val == (Object)null || !((Collider)val).enabled || !Flag(__instance, "isPlayerControlled") || Flag(__instance, "isPlayerDead") || Flag(__instance, "isClimbingLadder") || Flag(__instance, "inSpecialInteractAnimation")) { Stop(); mantling = false; sliding = false; slideCarryUntil = 0f; pushUntil = 0f; return; } Keyboard current = Keyboard.current; if (current == null) { Stop(); sliding = false; return; } bool flag = (int)mod.SlideKey.Value != 0 && ((ButtonControl)current[mod.SlideKey.Value]).isPressed; RaycastHit hit; bool flag2 = Ground(val, out hit); if (flag2) { lastGroundNormal = ((RaycastHit)(ref hit)).normal; } if (val.isGrounded || flag2) { slideGroundTime = Time.time; } bool flag3 = Time.time - slideGroundTime < 0.12f; if (!flag) { slideConsumed = false; } if (sliding && ((ButtonControl)current.spaceKey).wasPressedThisFrame) { sliding = false; slideConsumed = true; slideCarryUntil = Time.time + 0.35f; Gravity(__instance, Mathf.Max(0f, mod.Jump.Value)); val.Move(Vector3.up * 0.08f); } if (sliding && (!flag || !flag3 || slideSpeed < 2.5f)) { sliding = false; mod.SlideLog("ended"); } Vector3 val2 = Vector3.ProjectOnPlane(val.velocity, Vector3.up); Vector3 val4; if (!sliding && !slideConsumed && flag && !mantling && !active && flag3 && Flag(__instance, "isSprinting") && ((Vector3)(ref val2)).magnitude >= Mathf.Max(2.5f, mod.SlideMinRun.Value)) { sliding = true; slideConsumed = true; lastBoostClick = -100f; slideSpeed = Mathf.Min(Mathf.Max(3f, mod.SlideMax.Value), ((Vector3)(ref val2)).magnitude); Vector3 val3 = ((Component)__instance).transform.forward * ((((ButtonControl)current.wKey).isPressed ? 1f : 0f) - (((ButtonControl)current.sKey).isPressed ? 1f : 0f)) + ((Component)__instance).transform.right * ((((ButtonControl)current.dKey).isPressed ? 1f : 0f) - (((ButtonControl)current.aKey).isPressed ? 1f : 0f)); Vector3 normalized; if (!(((Vector3)(ref val2)).magnitude > 1f)) { val4 = Vector3.ProjectOnPlane(val3, Vector3.up); normalized = ((Vector3)(ref val4)).normalized; } else { normalized = ((Vector3)(ref val2)).normalized; } slideDirection = normalized; slideCarryUntil = 0f; mod.SlideLog("started at " + slideSpeed.ToString("F1") + " m/s"); } else if (!sliding && flag && ((ButtonControl)current[mod.SlideKey.Value]).wasPressedThisFrame) { mod.SlideLog("activation rejected: grounded=" + flag3 + ", speed=" + ((Vector3)(ref val2)).magnitude.ToString("F1") + ", mantle=" + mantling + ", wallrun=" + active); } Compact(val, sliding); LowPose(__instance, val, sliding || mantling || compact); if (sliding) { Stop(); pushUntil = 0f; float deltaTime = Time.deltaTime; slideDirection = Quaternion.AngleAxis(((((ButtonControl)current.dKey).isPressed ? 1f : 0f) - (((ButtonControl)current.aKey).isPressed ? 1f : 0f)) * Mathf.Max(0f, mod.SlideSteer.Value) * deltaTime, Vector3.up) * slideDirection; val4 = Vector3.ProjectOnPlane(slideDirection, lastGroundNormal); Vector3 normalized2 = ((Vector3)(ref val4)).normalized; float num = Vector3.Dot(Vector3.down, normalized2) * Mathf.Max(0f, mod.SlideGravity.Value) - Mathf.Max(0f, mod.SlideFriction.Value); slideSpeed = Mathf.Clamp(slideSpeed + num * deltaTime, 0f, Mathf.Max(3f, mod.SlideMax.Value)); bool flag4 = false; if (Mouse.current != null && Mouse.current.leftButton.wasPressedThisFrame) { float unscaledTime = Time.unscaledTime; flag4 = unscaledTime - lastBoostClick <= Mathf.Clamp(mod.BoostClickWindow.Value, 0.1f, 0.8f); lastBoostClick = (flag4 ? (-100f) : unscaledTime); } if (flag4 && Time.time >= nextBoost) { float num2 = Mathf.Clamp01(mod.BoostCost.Value); float num3 = (float)stamina.GetValue(__instance); float num4 = Mathf.Min(Mathf.Max(3f, mod.SlideMax.Value), slideSpeed + Mathf.Max(0f, mod.BoostSpeed.Value)); if (num3 >= num2 && num4 > slideSpeed + 0.001f) { stamina.SetValue(__instance, Mathf.Clamp01(num3 - num2)); slideSpeed = num4; nextBoost = Time.time + Mathf.Max(0.05f, mod.BoostCooldown.Value); mod.SlideLog("boosted to " + slideSpeed.ToString("F1") + " m/s"); } else { mod.SlideLog("boost rejected: insufficient stamina or speed cap"); } } slideVelocity = normalized2 * slideSpeed * Adrenaline.SpeedFactor; start = ((Component)val).transform.position; slidingFrame = true; return; } bool flag5 = (int)mod.RunKey.Value != 0 && ((ButtonControl)current[mod.RunKey.Value]).isPressed; if (Flag(__instance, "isCrouching") && !mantling && !forcedCrouch && Time.time >= slideCarryUntil) { if (flag5) { WallLog("Rejected: crouching"); } Stop(); return; } if (mantling && Time.time > mantleDeadline) { FinishMantle(__instance, val, "movement timed out during " + (mantleCrossed ? "landing" : (mantleRaised ? "crossing" : "lifting"))); } if (!mantling && Time.time >= mantleRetry && (active || ((int)mod.MantleKey.Value != 0 && ((ButtonControl)current[mod.MantleKey.Value]).isPressed))) { mantleRetry = Time.time + 0.08f; TryMantle(__instance, val, active ? tangent : Vector3.zero); } if (mantling) { mantleFrame = true; start = ((Component)val).transform.position; Gravity(__instance, 0f); return; } if (val.isGrounded && !active) { if (flag5) { WallLog("Waiting for jump: controller grounded"); } Stop(); pushUntil = 0f; return; } if (active && ((ButtonControl)current.spaceKey).wasPressedThisFrame) { ParkourAudio.Jump(__instance); pushDirection = normal; pushUntil = Time.time + 0.22f; Gravity(__instance, Mathf.Max(0f, mod.Jump.Value)); Stop(); return; } float num5 = (float)stamina.GetValue(__instance); if (!flag5 || num5 <= 0.03f || (!active && Time.time < blockedUntil)) { if (flag5) { WallLog("Rejected: stamina=" + num5.ToString("F2") + ", cooldown=" + Mathf.Max(0f, blockedUntil - Time.time).ToString("F2")); } else if (active) { WallLog("Ended: key released", immediate: true); } Stop(); return; } RaycastHit best = default(RaycastHit); bool flag6 = false; if (active) { flag6 = Wall(val, -normal, out best); } if (!flag6) { Vector3 forward = ((Component)__instance).transform.forward; forward.y = 0f; ((Vector3)(ref forward)).Normalize(); Vector3 right = ((Component)__instance).transform.right; right.y = 0f; ((Vector3)(ref right)).Normalize(); Vector3[] obj = new Vector3[8] { forward, default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3), default(Vector3) }; val4 = forward + right; obj[1] = ((Vector3)(ref val4)).normalized; val4 = forward - right; obj[2] = ((Vector3)(ref val4)).normalized; obj[3] = right; obj[4] = -right; obj[5] = -forward; val4 = -forward + right; obj[6] = ((Vector3)(ref val4)).normalized; val4 = -forward - right; obj[7] = ((Vector3)(ref val4)).normalized; float num6 = float.PositiveInfinity; Vector3[] array = (Vector3[])(object)obj; foreach (Vector3 side in array) { if (Wall(val, side, out var best2) && ((RaycastHit)(ref best2)).distance < num6) { num6 = ((RaycastHit)(ref best2)).distance; best = best2; flag6 = true; } } } if (!flag6 && (!active || Time.time - lastWall > Mathf.Clamp(Mathf.Max(mod.SeamGrace.Value, 0.32f), 0f, 0.6f))) { WallLog("Rejected: no valid wall within reach", active); Stop(); return; } if (flag6) { lastWall = Time.time; } Vector3 val5 = (flag6 ? ((RaycastHit)(ref best)).normal : normal); val4 = Vector3.Cross(Vector3.up, val5); Vector3 val6 = ((Vector3)(ref val4)).normalized; Vector3 val7 = (active ? tangent : ((Component)__instance).transform.forward); float num7 = Vector3.Dot(val6, val7); if (!active && (Mathf.Abs(num7) < 0.15f || ((ButtonControl)current.aKey).isPressed || ((ButtonControl)current.dKey).isPressed)) { val7 = ((!((ButtonControl)current.aKey).isPressed) ? ((Component)__instance).transform.right : (-((Component)__instance).transform.right)); num7 = Vector3.Dot(val6, val7); } if (num7 < 0f) { val6 = -val6; } if (!active) { active = true; elapsed = 0f; string[] obj2 = new string[6] { "Started: ", ((Object)((RaycastHit)(ref best)).collider).name, ", distance=", ((RaycastHit)(ref best)).distance.ToString("F2"), ", normal=", null }; val4 = val5; obj2[5] = ((object)(*(Vector3*)(&val4))/*cast due to .constrained prefix*/).ToString(); WallLog(string.Concat(obj2), immediate: true); } elapsed += Time.deltaTime; if (elapsed > Mathf.Max(0.1f, mod.Duration.Value)) { WallLog("Ended: duration limit", immediate: true); Stop(); return; } normal = val5; tangent = ((Vector3)(ref val6)).normalized; start = ((Component)val).transform.position; Gravity(__instance, 0f - Mathf.Max(0f, mod.Slide.Value)); wallEnergy = num5; runningFrame = true; } [HarmonyPriority(400)] private static void Postfix(PlayerControllerB __instance, WeightFrame __state) { //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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00cc: 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_03a4: 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_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: 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_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_05c7: Unknown result type (might be due to invalid IL or missing references) //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f0: Unknown result type (might be due to invalid IL or missing references) //IL_056e: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05b2: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0467: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04aa: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_04f6: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_0195: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: 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_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0279: 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_0283: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_021b: 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_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: 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_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: 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_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) RestoreWeight(__instance, __state); if ((Object)(object)__instance != (Object)(object)owner || !((NetworkBehaviour)__instance).IsOwner) { return; } object? value = controllerField.GetValue(__instance); CharacterController val = (CharacterController)((value is CharacterController) ? value : null); if ((Object)(object)val == (Object)null || !((Collider)val).enabled) { return; } LethalParkour mod = LethalParkour.Mod; if (slidingFrame && sliding) { LowPose(__instance, val, needed: true); Compact(val, needed: true); Vector3 val2 = ((Component)val).transform.position - start; Vector3 val3 = (slideVelocity + Vector3.down * 0.8f) * Time.deltaTime; if ((val.Move(val3 - val2) & 1) != 0) { Vector3 val4 = Vector3.ProjectOnPlane(((Component)val).transform.position - start, Vector3.up); if (((Vector3)(ref val4)).magnitude < slideSpeed * Time.deltaTime * 0.25f) { sliding = false; } } } else if (mantleFrame && mantling) { LowPose(__instance, val, needed: true); Vector3 val5 = ((Component)val).transform.TransformPoint(val.center) - Vector3.up * val.height * 0.5f; if (!mantleRaised && Vector3.Distance(val5, mantleUp) < 0.12f) { mantleRaised = true; mantleStall = 0f; mantleBestDistance = float.PositiveInfinity; } if (mantleRaised && !mantleCrossed) { Vector3 landingFeet; if (Vector3.Distance(val5, mantleEnd) < 0.12f) { mantleCrossed = true; mantleStall = 0f; mantleBestDistance = float.PositiveInfinity; } else if (Vector3.Distance(val5, mantleEnd) < 0.24f && NearbyMantleLanding(val, val5, out landingFeet)) { mantleLandingFeet = landingFeet; mantleCrossed = true; mantleStall = 0f; mantleBestDistance = float.PositiveInfinity; mod.MantleLog("accepted supported nearby crossing endpoint"); } } Vector3 val6 = (mantleCrossed ? mantleLandingFeet : (mantleRaised ? mantleEnd : mantleUp)); Vector3 val7 = Vector3.MoveTowards(val5, val6, Mathf.Clamp(mod.MantleSpeed.Value, 1f, 10f) * Adrenaline.SpeedFactor * Time.deltaTime) - val5; CollisionFlags val8 = val.Move(val7); Vector3 val9 = ((Component)val).transform.TransformPoint(val.center) - Vector3.up * val.height * 0.5f; Gravity(__instance, 0f); if (mantleCrossed && (Vector3.Distance(val9, val6) < 0.12f || ((val8 & 4) != 0 && val7.y <= 0f))) { FinishMantle(__instance, val, "completed on landing"); } else { float num = Vector3.Distance(val9, val6); if (num < mantleBestDistance - 0.005f) { mantleBestDistance = num; mantleStall = 0f; } else { mantleStall += Time.deltaTime; } if (mantleStall > 0.35f) { FinishMantle(__instance, val, "blocked during " + (mantleCrossed ? "landing" : (mantleRaised ? "crossing" : "lifting")) + "; remaining=" + Vector3.Distance(val9, val6).ToString("F2")); } } } else if (runningFrame && active) { Vector3 val10 = ((Component)val).transform.position - start; Vector3 val11 = (tangent * Mathf.Max(0f, mod.Speed.Value) * Adrenaline.SpeedFactor + Vector3.down * Mathf.Max(0f, mod.Slide.Value)) * Time.deltaTime; if ((val.Move(val11 - val10 - normal * Mathf.Max(0f, mod.Adhesion.Value) * Time.deltaTime) & 1) != 0 && Vector3.Dot(((Component)val).transform.position - start, tangent) < mod.Speed.Value * Time.deltaTime * 0.4f) { val.Move(normal * Mathf.Min(0.18f, 4f * Time.deltaTime)); val.Move(tangent * Mathf.Max(0f, mod.Speed.Value * Time.deltaTime - Vector3.Dot(((Component)val).transform.position - start, tangent))); } Gravity(__instance, 0f - Mathf.Max(0f, mod.Slide.Value)); stamina.SetValue(__instance, Mathf.Clamp01(wallEnergy - Mathf.Max(0f, mod.Drain.Value) * Time.deltaTime * Adrenaline.StaminaFactor)); } else if (Time.time < slideCarryUntil && !val.isGrounded) { val.Move(slideDirection * Mathf.Max(0f, slideSpeed - 4f) * Time.deltaTime * Mathf.Clamp01((slideCarryUntil - Time.time) / 0.35f)); } else if (Time.time < pushUntil) { val.Move(pushDirection * Mathf.Max(0f, mod.Push.Value) * Time.deltaTime); } if (!mantling && !sliding && !compact && forcedCrouch && !Flag(__instance, "isPlayerDead") && !Flag(__instance, "inSpecialInteractAnimation") && !Flag(__instance, "isClimbingLadder")) { LowPose(__instance, val, needed: false); } } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] internal static class WallCamera { private static Camera camera; private static float roll; private static float baseRoll; private static bool applied; private static readonly FieldInfo cameraField = AccessTools.Field(typeof(PlayerControllerB), "gameplayCamera"); internal static void Restore() { //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_003a: Unknown result type (might be due to invalid IL or missing references) if (applied && (Object)(object)camera != (Object)null) { Vector3 localEulerAngles = ((Component)camera).transform.localEulerAngles; localEulerAngles.z = baseRoll; ((Component)camera).transform.localEulerAngles = localEulerAngles; } applied = false; } [HarmonyPriority(0)] private static void Postfix(PlayerControllerB __instance) { //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_007d: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)__instance).IsOwner) { return; } object? obj = cameraField?.GetValue(__instance); Camera val = (Camera)((obj is Camera) ? obj : null); if ((Object)(object)camera != (Object)(object)val) { Restore(); camera = val; roll = 0f; } if ((Object)(object)val == (Object)null) { return; } LethalParkour mod = LethalParkour.Mod; float num = 0f; if (WallRun.active && mod.Enabled.Value) { float num2 = Vector3.Dot(((Component)__instance).transform.right, -WallRun.WallNormal); if (Mathf.Abs(num2) < 0.1f) { num2 = 1f; } num = Mathf.Sign(num2) * Mathf.Clamp(mod.Tilt.Value, 0f, 30f); } roll = Mathf.Lerp(roll, num, 1f - Mathf.Exp((0f - Mathf.Max(0.1f, mod.TiltSpeed.Value)) * Time.deltaTime)); if (Mathf.Abs(roll) < 0.01f) { roll = 0f; } } internal static void Apply() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: 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_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)camera == (Object)null) { return; } if (roll == 0f) { Restore(); return; } Vector3 localEulerAngles = ((Component)camera).transform.localEulerAngles; if (!applied) { baseRoll = Mathf.DeltaAngle(0f, localEulerAngles.z); applied = true; } localEulerAngles.z = baseRoll + Mathf.Clamp(roll, -30f, 30f); ((Component)camera).transform.localEulerAngles = localEulerAngles; } } internal static class ParkourAnimation { private static ManualLogSource log; private static AssetBundle bundle; private static bool initialized; private static bool failed; private static bool playing; private static string key; private static string wallLeftKey; private static string wallRightKey; private static string requested; private static string lockedWall; private static Harmony mapperPatch; private static bool hookAttempted; private static bool reportedAlignment; private static bool warnedVisual; private static ConfigEntry<float> wallBodyYaw; private static ConfigEntry<bool> invertWallSide; private static ConfigEntry<bool> useSlideEntry; private static void RestoreVisual() { } private static void InstallMapperHook(object mapper) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown if (!hookAttempted && mapper != null) { hookAttempted = true; MethodInfo methodInfo = AccessTools.Method(typeof(EmoteConstraint), "ActUponConstraints", Type.EmptyTypes, (Type[])null); if (methodInfo == null) { log.LogWarning((object)"Wall constraint method missing"); return; } mapperPatch = new Harmony("jaspy.lethalparkour.constraintalignment"); mapperPatch.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ParkourAnimation), "AlignConstraint", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); log.LogInfo((object)"Wall alignment hook installed: EmoteConstraint.ActUponConstraints"); } } private unsafe static bool AlignConstraint(EmoteConstraint __instance) { //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0196: 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_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: 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_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_031c: 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_033f: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_043e: 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_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04be: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) try { PlayerControllerB animationOwner = WallRun.AnimationOwner; BoneMapper localMapper = CustomEmotesAPI.localMapper; if (failed || (Object)(object)animationOwner == (Object)null || !((NetworkBehaviour)animationOwner).IsOwner || animationOwner.isPlayerDead || WallRun.AnimationState != 1 || (Object)(object)localMapper == (Object)null || (Object)