Decompiled source of Parkour Knuckle v1.4.7

BepInEx/plugins/ParkourKnuckle/ParkourKnuckle.dll

Decompiled 2 weeks ago
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.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using ParkourKnuckle.UI;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("KnuckleTesting")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("KnuckleTesting")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9407f467-496e-4117-8715-bdfe3bce9f1b")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ParkourKnuckle
{
	[BepInPlugin("com.nimius.parkourknuckle", "Parkour Knuckle", "1.2.1")]
	public class Plugin : BaseUnityPlugin
	{
		private Harmony _harmony;

		public static ConfigEntry<bool> EnableParkourRotation;

		public static ConfigEntry<bool> EnableParkourFOV;

		public static ConfigEntry<bool> EnableParkourShake;

		public static ConfigEntry<bool> EnableWallRunHelper;

		public static bool isUIVisible = false;

		public static ConfigFile ProgressionFile;

		public static Dictionary<string, ConfigEntryBase> SkillConfigs = new Dictionary<string, ConfigEntryBase>();

		private void Awake()
		{
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Expected O, but got Unknown
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_0283: Expected O, but got Unknown
			EnableParkourRotation = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings", "Use Parkour Rotation", true, "Determines whether the camera will tilt and rotate differently when doing parkour actions.");
			EnableParkourFOV = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings", "Use Parkour FOV", true, "Determines whether the camera will zoom in and out during specific parkour actions.");
			EnableParkourShake = ((BaseUnityPlugin)this).Config.Bind<bool>("Camera Settings", "Use Parkour Shake", true, "Determines whether the camera will shake during specific parkour actions.");
			EnableWallRunHelper = ((BaseUnityPlugin)this).Config.Bind<bool>("UI Settings", "Use the Wall Run Helper", false, "When a wall run is able to be performed, the sides of your screen will glow.");
			string text = Path.Combine(Paths.ConfigPath, "parkourprogress.cfg");
			ProgressionFile = new ConfigFile(text, true);
			SkillConfigs["QuickTurning"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "QuickTurning", false, "");
			SkillConfigs["Sliding"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "Sliding", false, "");
			SkillConfigs["SlideJumping"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "SlideJumping", false, "");
			SkillConfigs["Leaping"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "Leaping", false, "");
			SkillConfigs["Rolling"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "Rolling", false, "");
			SkillConfigs["WallKicking"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "WallKicking", false, "");
			SkillConfigs["WallRunning"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "WallRunning", false, "");
			SkillConfigs["VerticalWallRunning"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "VerticalWallRunning", false, "");
			SkillConfigs["WallRunBoost"] = (ConfigEntryBase)(object)ProgressionFile.Bind<bool>("Progression", "WallRunBoost", false, "");
			SkillConfigs["HeightCurrency"] = (ConfigEntryBase)(object)ProgressionFile.Bind<float>("Currency", "HeightCurrency", 0f, "");
			SkillConfigs["MaxHeight"] = (ConfigEntryBase)(object)ProgressionFile.Bind<float>("Currency", "MaxHeight", 0f, "");
			_harmony = new Harmony("com.nimius.parkourknuckle");
			_harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Harmony Patches applied successfully.");
			ParkourUI.Initialize();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Parkour UI Engine Initialized.");
		}
	}
	[HarmonyPatch(typeof(ENT_Player), "Update")]
	public class PlayerModifierPatch
	{
		private static Quaternion targetRotation;

		private static bool isRotating = false;

		private static readonly float turnSpeed = 24f;

		public static bool onCooldown = false;

		public static readonly float CooldownDur = 0.2f;

		public static float CooldownTime = 0f;

		public static float chargeStartTime;

		public static bool isCharging;

		public static float currentCharge;

		public static readonly float maxChargeTime = 3.5f;

		public static float leapCooldownTime = 0f;

		public static readonly float leapCooldownDur = 2f;

		private static readonly float leapForceMultiplier = 1f;

		public static bool leapCooldown = false;

		private static readonly float minStamina = 1f;

		private static readonly float maxStamina = 6f;

		private static readonly float upwardArcForce = 1f;

		private static bool isHolding = false;

		public static bool hasWallRunInAir = false;

		private static readonly float tiltLerpSpeed = 4f;

		private static float gripValue = 0f;

		public static bool isHorizRun = false;

		private static int spaceTapCount = 0;

		private static float spaceTapTimer = 0f;

		private const float doubleTapWindow = 0.3f;

		public static bool wallLeft;

		public static bool wallRight;

		public static bool canRun;

		public static bool isVerticalRun = false;

		public static bool hasWallRunVertical = false;

		private static float verticalGraceTimer = 0f;

		private static readonly float maxGraceTime = 0.2f;

		public static bool wallFront;

		public static bool canVert;

		private static bool isVaulting = false;

		private static Vector3 vaultTargetPos;

		private static float vaultTimer = 0f;

		private static readonly float vaultDuration = 2f;

		private static bool isSliding = false;

		private static readonly float minSlideSpeed = 6f;

		private static Vector3 slideDir;

		private static bool canSlide = true;

		private static float slideTime = 0f;

		private static readonly float slideDuration = 1.8f;

		private static Vector3 slideStartPos;

		private static Vector3 slideTargetPos;

		private static float startY;

		private static bool wasGrounded;

		private static bool isRotatingRoll = false;

		private static Quaternion startRotationRoll;

		private static Vector3 rollStartPos;

		private static Vector3 rollTargetPos;

		private static Vector3 rollDir;

		private static float rollTimer = 0f;

		private static readonly float rollDur = 0.5f;

		private static bool cancelNextRollingFallDamage = false;

		private static float rollingFallDamageCancelExpiresAt = -1f;

		private const float rollingFallDamageCancelGrace = 0.2f;

		public static float levelHighestHeight;

		public static int highestMilestone = 0;

		public static float liveRunHeight = 0f;

		public static bool isConsumableUltimate = false;

		public static int roidedCount = 0;

		public static float previousCurrency = 0f;

		private static void ArmRollingFallDamageCancel()
		{
			cancelNextRollingFallDamage = true;
			rollingFallDamageCancelExpiresAt = Time.time + 0.2f;
		}

		private static void ExpireRollingFallDamageCancel()
		{
			if (cancelNextRollingFallDamage && Time.time > rollingFallDamageCancelExpiresAt)
			{
				cancelNextRollingFallDamage = false;
				rollingFallDamageCancelExpiresAt = -1f;
			}
		}

		public static bool TryCancelRollingFallDamage(DamageInfo info)
		{
			ExpireRollingFallDamageCancel();
			if (!cancelNextRollingFallDamage || info == null || !info.HasTag("falling"))
			{
				return false;
			}
			cancelNextRollingFallDamage = false;
			rollingFallDamageCancelExpiresAt = -1f;
			return true;
		}

		[HarmonyPostfix]
		public static void Postfix(ENT_Player __instance)
		{
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cd: 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_04d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0798: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0628: Unknown result type (might be due to invalid IL or missing references)
			//IL_062d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0632: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_063f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0659: Unknown result type (might be due to invalid IL or missing references)
			//IL_065e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0668: Unknown result type (might be due to invalid IL or missing references)
			//IL_066d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0672: Unknown result type (might be due to invalid IL or missing references)
			//IL_0689: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_08cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0903: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c14: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c27: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8a: Unknown result type (might be due to invalid IL or missing references)
			//IL_09cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_09c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09de: Unknown result type (might be due to invalid IL or missing references)
			//IL_09e2: 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_09ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_09fa: 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_0a33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a4d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a52: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a7f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a90: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a95: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aad: 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_0ac6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b04: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dfc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e03: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e13: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e18: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e34: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e39: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e3c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0eee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ef3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0efd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f0e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f13: Unknown result type (might be due to invalid IL or missing references)
			//IL_140d: Unknown result type (might be due to invalid IL or missing references)
			//IL_141d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1432: Unknown result type (might be due to invalid IL or missing references)
			//IL_1434: Unknown result type (might be due to invalid IL or missing references)
			//IL_1439: Unknown result type (might be due to invalid IL or missing references)
			//IL_143b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fba: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fbf: Unknown result type (might be due to invalid IL or missing references)
			//IL_1003: Unknown result type (might be due to invalid IL or missing references)
			//IL_1008: Unknown result type (might be due to invalid IL or missing references)
			//IL_100d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1015: Unknown result type (might be due to invalid IL or missing references)
			//IL_101a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1024: Unknown result type (might be due to invalid IL or missing references)
			//IL_1029: Unknown result type (might be due to invalid IL or missing references)
			//IL_102e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1030: Unknown result type (might be due to invalid IL or missing references)
			//IL_1032: Unknown result type (might be due to invalid IL or missing references)
			//IL_1040: Unknown result type (might be due to invalid IL or missing references)
			//IL_1047: Unknown result type (might be due to invalid IL or missing references)
			//IL_104c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1051: Unknown result type (might be due to invalid IL or missing references)
			//IL_176f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1774: Unknown result type (might be due to invalid IL or missing references)
			//IL_1787: Unknown result type (might be due to invalid IL or missing references)
			//IL_178c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1794: Unknown result type (might be due to invalid IL or missing references)
			//IL_1799: Unknown result type (might be due to invalid IL or missing references)
			//IL_17a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_17a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_17ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_17b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_17bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_17c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_14db: Unknown result type (might be due to invalid IL or missing references)
			//IL_14e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_14f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_14fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_1504: Unknown result type (might be due to invalid IL or missing references)
			//IL_1519: Unknown result type (might be due to invalid IL or missing references)
			//IL_151e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1523: Unknown result type (might be due to invalid IL or missing references)
			//IL_1069: Unknown result type (might be due to invalid IL or missing references)
			//IL_106e: Unknown result type (might be due to invalid IL or missing references)
			//IL_17dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_17e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_15db: Unknown result type (might be due to invalid IL or missing references)
			//IL_15e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_15e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_15ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_15f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_10eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_108f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1094: Unknown result type (might be due to invalid IL or missing references)
			//IL_109e: Unknown result type (might be due to invalid IL or missing references)
			//IL_10a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_10ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_18f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_113a: Unknown result type (might be due to invalid IL or missing references)
			//IL_113c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1bd6: Unknown result type (might be due to invalid IL or missing references)
			//IL_1948: Unknown result type (might be due to invalid IL or missing references)
			//IL_1863: Unknown result type (might be due to invalid IL or missing references)
			//IL_129c: Unknown result type (might be due to invalid IL or missing references)
			//IL_12a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_12c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_12c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_12c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_127e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1283: Unknown result type (might be due to invalid IL or missing references)
			//IL_1290: Unknown result type (might be due to invalid IL or missing references)
			//IL_1155: Unknown result type (might be due to invalid IL or missing references)
			//IL_1157: Unknown result type (might be due to invalid IL or missing references)
			//IL_115e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1163: Unknown result type (might be due to invalid IL or missing references)
			//IL_1168: Unknown result type (might be due to invalid IL or missing references)
			//IL_116a: Unknown result type (might be due to invalid IL or missing references)
			//IL_116c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a70: Unknown result type (might be due to invalid IL or missing references)
			//IL_1668: Unknown result type (might be due to invalid IL or missing references)
			//IL_1189: Unknown result type (might be due to invalid IL or missing references)
			//IL_118e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1198: Unknown result type (might be due to invalid IL or missing references)
			//IL_119d: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_11a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad9: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ae0: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ae5: Unknown result type (might be due to invalid IL or missing references)
			//IL_1aed: Unknown result type (might be due to invalid IL or missing references)
			//IL_1af2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1afc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b01: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b06: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b10: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b15: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a95: Unknown result type (might be due to invalid IL or missing references)
			//IL_18ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_18c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_18cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_11dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_11e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_11eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_11f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_11fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b36: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b3b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1991: Unknown result type (might be due to invalid IL or missing references)
			//IL_1996: Unknown result type (might be due to invalid IL or missing references)
			//IL_19af: Unknown result type (might be due to invalid IL or missing references)
			//IL_19b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_19d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_19de: Unknown result type (might be due to invalid IL or missing references)
			//IL_19e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_19e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_19f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_19f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_19fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1217: Unknown result type (might be due to invalid IL or missing references)
			//IL_121c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1226: Unknown result type (might be due to invalid IL or missing references)
			//IL_122b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1230: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b7c: Unknown result type (might be due to invalid IL or missing references)
			if (CL_GameManager.gamemode.allowLeaderboardScoring)
			{
				CL_GameManager.gamemode.allowLeaderboardScoring = false;
			}
			CharacterController component = ((Component)__instance).GetComponent<CharacterController>();
			bool isGrounded = component.isGrounded;
			isHolding = false;
			ExpireRollingFallDamageCancel();
			Hand[] hands = __instance.hands;
			foreach (Hand val in hands)
			{
				if ((Object)(object)val.handhold != (Object)null && val.handhold.GetHolding())
				{
					isHolding = true;
					break;
				}
			}
			if (onCooldown)
			{
				if (!isRotating)
				{
					CooldownTime += Time.deltaTime;
				}
				if (CooldownTime >= CooldownDur)
				{
					onCooldown = false;
					CooldownTime = 0f;
				}
			}
			if (Input.GetKeyUp((KeyCode)120) && !onCooldown && !isHorizRun && ((GameEntity)__instance).health > 0f && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["QuickTurning"]).Value)
			{
				onCooldown = true;
				targetRotation = ((Component)__instance).transform.rotation * Quaternion.Euler(0f, 180f, 0f);
				isRotating = true;
			}
			if (isRotating)
			{
				((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, targetRotation, Time.deltaTime * (turnSpeed * (float)(roidedCount / 2 + 1)));
				if (Quaternion.Angle(((Component)__instance).transform.rotation, targetRotation) < 0.5f)
				{
					isRotating = false;
				}
			}
			if (leapCooldown)
			{
				if (isGrounded || isHolding)
				{
					leapCooldownTime += Time.deltaTime;
				}
				if (leapCooldownTime >= leapCooldownDur)
				{
					leapCooldown = false;
					leapCooldownTime = 0f;
				}
			}
			if (Input.GetKeyDown((KeyCode)103) && (isGrounded || isHolding) && !leapCooldown && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["Leaping"]).Value && (isGrounded || isHolding))
			{
				bool flag = true;
				Hand[] hands2 = __instance.hands;
				foreach (Hand val2 in hands2)
				{
					if (val2.gripStrength < minStamina)
					{
						flag = false;
					}
				}
				if (flag)
				{
					chargeStartTime = Time.time;
					isCharging = true;
				}
			}
			currentCharge = 0f;
			if (isCharging && Input.GetKey((KeyCode)103) && (isGrounded || isHolding) && !leapCooldown)
			{
				currentCharge = Mathf.Min(Time.time - chargeStartTime, maxChargeTime);
				if (Plugin.EnableParkourShake.Value)
				{
					CL_CameraControl.Shake(currentCharge * Time.deltaTime * 0.025f);
					Hand[] hands3 = __instance.hands;
					foreach (Hand val3 in hands3)
					{
						val3.ShakeHand(currentCharge * Time.deltaTime * 0.025f);
					}
				}
				if (Plugin.EnableParkourFOV.Value)
				{
					__instance.FOVShock(currentCharge * 0.1f, false);
				}
			}
			if (Input.GetKeyUp((KeyCode)103) && isCharging && (isGrounded || isHolding) && !leapCooldown && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["Leaping"]).Value)
			{
				if (!isGrounded && !isHolding)
				{
					isCharging = false;
					return;
				}
				currentCharge = Mathf.Min(Time.time - chargeStartTime, maxChargeTime);
				float num = Mathf.Min(Time.time - chargeStartTime, maxChargeTime);
				float num2 = num * (leapForceMultiplier * (float)(roidedCount / 2 + 1));
				float num3 = Mathf.CeilToInt(Mathf.Lerp(minStamina, maxStamina, num / maxChargeTime));
				Vector3 val4 = ((Component)__instance.cam).transform.forward + Vector3.up * upwardArcForce;
				Vector3 directionalForce = ((Vector3)(ref val4)).normalized * num2;
				((GameEntity)__instance).SetDirectionalForce(directionalForce);
				Hand[] hands4 = __instance.hands;
				foreach (Hand val5 in hands4)
				{
					if (!isConsumableUltimate)
					{
						val5.gripStrength -= num3;
						if (val5.gripStrength < 0f)
						{
							val5.gripStrength = 0f;
						}
					}
					if (val5.IsHolding())
					{
						val5.DropHand(true);
					}
				}
				leapCooldown = true;
				isCharging = false;
			}
			if (!isGrounded)
			{
				currentCharge = 0f;
				isHolding = false;
				isCharging = false;
			}
			if (Input.GetKeyDown((KeyCode)32) && Input.GetKey((KeyCode)115) && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["WallKicking"]).Value)
			{
				bool flag2 = true;
				Hand[] hands5 = __instance.hands;
				foreach (Hand val6 in hands5)
				{
					if (val6.gripStrength < 1f)
					{
						flag2 = false;
					}
				}
				if (!isHolding && flag2)
				{
					Vector3 val7 = -((Component)__instance).transform.forward;
					RaycastHit val8 = default(RaycastHit);
					if (Physics.Raycast(((Component)__instance).transform.position, val7, ref val8, 1.2f))
					{
						Vector3 val9 = ((RaycastHit)(ref val8)).normal + Vector3.up * 1.2f;
						float num4 = 1.5f * (float)(roidedCount / 2 + 1);
						((GameEntity)__instance).SetDirectionalForce(((Vector3)(ref val9)).normalized * num4);
						if (Plugin.EnableParkourFOV.Value)
						{
							__instance.FOVShock(num4, false);
						}
						if (Plugin.EnableParkourShake.Value)
						{
							CL_CameraControl.Shake(Time.deltaTime * 0.15f);
						}
						Hand[] hands6 = __instance.hands;
						foreach (Hand val10 in hands6)
						{
							if (!isConsumableUltimate)
							{
								val10.gripStrength -= 1f;
								if (val10.gripStrength < 0f)
								{
									val10.gripStrength = 0f;
								}
							}
						}
					}
				}
			}
			if (isGrounded && !isVerticalRun && !isHolding)
			{
				isHorizRun = false;
				isVerticalRun = false;
				hasWallRunInAir = false;
				hasWallRunVertical = false;
				((Collider)component).enabled = true;
				((Component)__instance).transform.rotation = Quaternion.Euler(0f, ((Component)__instance).transform.eulerAngles.y, 0f);
			}
			if (!isGrounded && isHolding)
			{
				isHorizRun = false;
				isVerticalRun = false;
				hasWallRunInAir = true;
				hasWallRunVertical = true;
				((Collider)component).enabled = true;
			}
			canRun = true;
			bool flag3 = true;
			Hand[] hands7 = __instance.hands;
			foreach (Hand val11 in hands7)
			{
				gripValue = val11.gripStrength;
				if (val11.gripStrength <= 0f)
				{
					canRun = false;
				}
			}
			if (!canRun)
			{
				flag3 = false;
			}
			if (Input.GetKeyDown((KeyCode)32))
			{
				spaceTapCount++;
				if (spaceTapCount == 1)
				{
					spaceTapTimer = 0.3f;
				}
			}
			if (spaceTapTimer > 0f && (!isVerticalRun || !isHorizRun))
			{
				spaceTapTimer -= Time.deltaTime;
			}
			else
			{
				spaceTapCount = 0;
			}
			RaycastHit val12 = default(RaycastHit);
			wallLeft = Physics.Raycast(((Component)__instance).transform.position, -((Component)__instance).transform.right, ref val12, 1.2f);
			RaycastHit val13 = default(RaycastHit);
			wallRight = Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.right, ref val13, 1.2f);
			bool flag4 = spaceTapCount >= 2;
			bool flag5 = Input.GetKey((KeyCode)32) && (Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)100));
			if (!hasWallRunInAir && flag5 && (wallLeft || wallRight) && (isHorizRun || flag4))
			{
				if (((ConfigEntry<bool>)(object)Plugin.SkillConfigs["WallRunning"]).Value)
				{
					if (flag3)
					{
						isHorizRun = true;
						spaceTapCount = 2;
						((Collider)component).enabled = false;
						Vector3 val14 = (wallLeft ? ((RaycastHit)(ref val12)).normal : ((RaycastHit)(ref val13)).normal);
						Vector3 val15 = Vector3.Cross(val14, Vector3.up);
						Vector3 val16 = ((Vector3)(ref val15)).normalized;
						RaycastHit val17 = default(RaycastHit);
						if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val17, 1.2f))
						{
							isHorizRun = false;
							hasWallRunInAir = true;
							((Collider)component).enabled = true;
							return;
						}
						if (Vector3.Dot(val16, ((Component)__instance).transform.forward) < 0f)
						{
							val16 = -val16;
						}
						float num6 = ((!Plugin.EnableParkourRotation.Value) ? 0f : (wallLeft ? (-15f) : 15f));
						Quaternion val18 = Quaternion.LookRotation(val16) * Quaternion.Euler(0f, 0f, num6);
						((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, val18, Time.deltaTime * tiltLerpSpeed);
						((GameEntity)__instance).SetDirectionalForce(val16 * 0.8f * (gripValue * 0.1f * ((float)roidedCount / 3.5f + 1f)) + Vector3.up * 0.1f);
						if (Plugin.EnableParkourFOV.Value)
						{
							__instance.FOVShock(Mathf.Lerp(1f, 0f, gripValue / 10f), false);
						}
						if (Plugin.EnableParkourShake.Value)
						{
							CL_CameraControl.Shake(Time.deltaTime * 0.25f);
						}
						Hand[] hands8 = __instance.hands;
						foreach (Hand val19 in hands8)
						{
							val19.gripStrength -= Time.deltaTime * (2.5f / (float)(roidedCount / 8 + 1));
							if (val19.gripStrength < 0f)
							{
								val19.gripStrength = 0f;
							}
						}
					}
					else
					{
						isHorizRun = false;
						hasWallRunInAir = true;
						((Collider)component).enabled = true;
					}
				}
			}
			else
			{
				Quaternion val20 = Quaternion.Euler(0f, ((Component)__instance).transform.eulerAngles.y, 0f);
				((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, val20, Time.deltaTime * tiltLerpSpeed);
				if (!isGrounded && ((Collider)component).enabled && spaceTapTimer <= 0f)
				{
					hasWallRunInAir = true;
				}
				((Collider)component).enabled = true;
				isHorizRun = false;
			}
			RaycastHit val21 = default(RaycastHit);
			wallFront = Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.forward, ref val21, 1.2f);
			bool flag6 = Input.GetKey((KeyCode)32) && Input.GetKey((KeyCode)119);
			bool flag7 = spaceTapCount >= 2;
			if (isVerticalRun)
			{
				if (flag6)
				{
					verticalGraceTimer = 0f;
				}
				else
				{
					verticalGraceTimer += Time.deltaTime;
				}
			}
			canVert = true;
			bool flag8 = true;
			Hand[] hands9 = __instance.hands;
			foreach (Hand val22 in hands9)
			{
				if (val22.gripStrength <= 0f)
				{
					canVert = false;
				}
			}
			if (!canVert)
			{
				flag8 = false;
			}
			if (isVerticalRun && !flag8)
			{
				isVerticalRun = false;
				hasWallRunVertical = true;
				return;
			}
			if (isVerticalRun && Input.GetKeyDown((KeyCode)32) && verticalGraceTimer > 0f && verticalGraceTimer < maxGraceTime && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["WallRunBoost"]).Value)
			{
				float num9 = 1.5f * (float)(roidedCount / 2 + 1);
				float num10 = 1.5f * (float)(roidedCount / 2 + 1);
				Vector3 directionalForce2 = ((RaycastHit)(ref val21)).normal * num9 * (gripValue * 0.1f) + Vector3.up * num10 * (gripValue * 0.1f);
				((GameEntity)__instance).SetDirectionalForce(directionalForce2);
				if (Plugin.EnableParkourFOV.Value)
				{
					__instance.FOVShock(2f, false);
				}
				isVerticalRun = false;
				verticalGraceTimer = 0f;
				hasWallRunVertical = true;
				((Collider)component).enabled = true;
				return;
			}
			if (isVerticalRun && verticalGraceTimer >= maxGraceTime)
			{
				isVerticalRun = false;
				hasWallRunVertical = true;
				((Collider)component).enabled = true;
				verticalGraceTimer = 0f;
			}
			if (isVaulting)
			{
				vaultTimer += Time.deltaTime;
				((Component)__instance).transform.position = Vector3.Lerp(((Component)__instance).transform.position, vaultTargetPos, vaultDuration);
				if (Vector3.Distance(((Component)__instance).transform.position, vaultTargetPos) < 0.1f)
				{
					isVaulting = false;
					((Collider)component).enabled = true;
				}
				return;
			}
			if (flag6 && !hasWallRunVertical && wallFront && (!hasWallRunVertical || isVerticalRun) && verticalGraceTimer == 0f && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["VerticalWallRunning"]).Value && (isVerticalRun || flag7))
			{
				float num11 = Vector3.Angle(((RaycastHit)(ref val21)).normal, Vector3.up);
				if (flag3 && num11 > 80f && num11 < 100f)
				{
					isVerticalRun = true;
					spaceTapCount = 2;
					((Collider)component).enabled = false;
					Vector3 val23 = -((RaycastHit)(ref val21)).normal;
					Vector3 val24 = ((Component)__instance).transform.position + Vector3.up * 1.5f;
					bool flag9 = Physics.Raycast(val24, val23, 0.25f);
					Quaternion val25 = Quaternion.LookRotation(Vector3.up, ((RaycastHit)(ref val21)).normal);
					RaycastHit val26 = default(RaycastHit);
					if (flag9 && (!Plugin.EnableParkourRotation.Value || Quaternion.Angle(((Component)__instance).transform.rotation, val25) < 25f) && Physics.SphereCast(((Component)__instance).transform.position + Vector3.up * 1f, 0.3f, Vector3.up, ref val26, 0.7f))
					{
						isVaulting = false;
						hasWallRunVertical = true;
						isVerticalRun = false;
						((Collider)component).enabled = true;
						return;
					}
					if (Physics.Raycast(((Component)__instance).transform.position, ((Component)__instance).transform.up, 3f))
					{
						isVaulting = false;
						hasWallRunVertical = true;
						isVerticalRun = false;
						((Collider)component).enabled = true;
						return;
					}
					if (!flag9 && !Physics.Raycast(val24, val23, 1f))
					{
						Vector3 val27 = val24 + val23 * 1f;
						RaycastHit val28 = default(RaycastHit);
						if (Physics.Raycast(val27, Vector3.down, ref val28, 2f))
						{
							Vector3 val29 = ((RaycastHit)(ref val28)).point + Vector3.up * 0.5f;
							RaycastHit val30 = default(RaycastHit);
							if (Physics.Raycast(val29, -val23, ref val30, 1.5f) && ((RaycastHit)(ref val30)).distance < 0.2f)
							{
								return;
							}
							if (!Physics.SphereCast(((RaycastHit)(ref val28)).point + Vector3.up * 0.1f, 0.3f, Vector3.up, ref val26, 1.8f))
							{
								vaultTargetPos = ((RaycastHit)(ref val28)).point + Vector3.up * 1.1f;
								isVaulting = true;
								vaultTimer = 0f;
								isVerticalRun = false;
								hasWallRunVertical = true;
								((Collider)component).enabled = false;
								return;
							}
						}
					}
					if (Plugin.EnableParkourRotation.Value)
					{
						((Component)__instance).transform.rotation = Quaternion.Slerp(((Component)__instance).transform.rotation, val25, Time.deltaTime * 10f);
					}
					Vector3 directionalForce3 = Vector3.up * 0.4f * (gripValue * (0.15f * (float)(roidedCount / 3 + 1)));
					((GameEntity)__instance).SetDirectionalForce(directionalForce3);
					if (Plugin.EnableParkourFOV.Value)
					{
						__instance.FOVShock(Mathf.Lerp(1f, 0f, gripValue / 10f), false);
					}
					if (Plugin.EnableParkourShake.Value)
					{
						CL_CameraControl.Shake(Time.deltaTime * 0.4f);
					}
					Hand[] hands10 = __instance.hands;
					foreach (Hand val31 in hands10)
					{
						val31.gripStrength -= Time.deltaTime * (4.5f / (float)(roidedCount / 8 + 1));
						if (val31.gripStrength < 0f)
						{
							val31.gripStrength = 0f;
						}
					}
					return;
				}
			}
			if (!isGrounded && !isVerticalRun && !isVaulting && verticalGraceTimer <= 0f && spaceTapTimer <= 0f && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["VerticalWallRunning"]).Value && ((Collider)component).enabled)
			{
				hasWallRunVertical = true;
			}
			Vector3 val32 = default(Vector3);
			((Vector3)(ref val32))..ctor(component.velocity.x, 0f, component.velocity.z);
			Vector3 val33 = ((Component)__instance).transform.InverseTransformDirection(val32);
			bool flag10 = val33.z > 0.1f;
			float magnitude = ((Vector3)(ref val32)).magnitude;
			if (!__instance.IsCrouching() || isGrounded)
			{
				canSlide = true;
			}
			if (isGrounded && __instance.IsCrouching() && !isSliding && canSlide && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["Sliding"]).Value && magnitude >= minSlideSpeed && flag10)
			{
				isSliding = true;
				canSlide = false;
				slideDir = ((Vector3)(ref val32)).normalized;
				slideTime = 0f;
				slideStartPos = ((Component)__instance).transform.position;
				slideTargetPos = slideStartPos + slideDir * (10f * (float)(roidedCount / 2 + 1));
				((Collider)component).enabled = false;
				if (Plugin.EnableParkourShake.Value)
				{
					CL_CameraControl.Shake(Time.deltaTime * 0.1f);
				}
			}
			if (isSliding)
			{
				if (Input.GetKeyDown((KeyCode)32) && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["SlideJumping"]).Value)
				{
					float num13 = 1f - slideTime / slideDuration;
					float num14 = 1f * num13 * (float)(roidedCount / 2 + 1);
					float num15 = 1.5f * num13 * (float)(roidedCount / 2 + 1);
					Vector3 directionalForce4 = slideDir * num14 + Vector3.up * num15;
					float num16 = ((Vector3)(ref directionalForce4)).magnitude * 1f;
					bool flag11 = true;
					bool flag12 = true;
					Hand[] hands11 = __instance.hands;
					foreach (Hand val34 in hands11)
					{
						if (val34.gripStrength < num16)
						{
							flag11 = false;
							break;
						}
					}
					if (!flag11)
					{
						flag12 = false;
					}
					if (flag12)
					{
						((GameEntity)__instance).SetDirectionalForce(directionalForce4);
						if (Plugin.EnableParkourShake.Value)
						{
							CL_CameraControl.Shake(((Vector3)(ref directionalForce4)).magnitude * Time.deltaTime * 0.1f);
						}
						if (Plugin.EnableParkourFOV.Value)
						{
							__instance.FOVShock(2f, false);
						}
						Hand[] hands12 = __instance.hands;
						foreach (Hand val35 in hands12)
						{
							if (!isConsumableUltimate)
							{
								val35.gripStrength -= num16;
								if (val35.gripStrength < 0f)
								{
									val35.gripStrength = 0f;
								}
							}
						}
						isSliding = false;
						((Collider)component).enabled = true;
						return;
					}
				}
				slideTime += Time.deltaTime;
				float num19 = slideTime / slideDuration;
				float num20 = 1f - (1f - num19) * (1f - num19);
				Vector3 position = Vector3.Lerp(slideStartPos, slideTargetPos, num20 * (float)(roidedCount / 10 + 1));
				if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 0.05f + slideDir * 0.3f, slideDir, 0.8f))
				{
					slideTargetPos = ((Component)__instance).transform.position;
					slideTime = slideDuration;
					if (Plugin.EnableParkourShake.Value)
					{
						CL_CameraControl.Shake(Time.deltaTime * 0.1f);
					}
					isSliding = false;
					((Collider)component).enabled = true;
					return;
				}
				if (num19 >= 1f || !__instance.IsCrouching() || !isGrounded)
				{
					isSliding = false;
					((Collider)component).enabled = true;
				}
				else
				{
					((Component)__instance).transform.position = position;
					if (Plugin.EnableParkourFOV.Value)
					{
						__instance.FOVShock(Mathf.Lerp(1.5f, 0f, num20), false);
					}
					if (Plugin.EnableParkourRotation.Value)
					{
						Transform transform = ((Component)__instance).transform;
						transform.rotation *= Quaternion.Euler(5f * Time.deltaTime, 0f, 0f);
					}
				}
			}
			if (wasGrounded && !isGrounded)
			{
				startY = ((Component)__instance).transform.position.y;
			}
			if (!wasGrounded && isGrounded && ((ConfigEntry<bool>)(object)Plugin.SkillConfigs["Rolling"]).Value)
			{
				float num21 = startY - ((Component)__instance).transform.position.y;
				if (num21 >= 15f && __instance.IsCrouching() && !isRotatingRoll)
				{
					isRotatingRoll = true;
					rollTimer = 0f;
					startRotationRoll = ((Component)__instance).transform.rotation;
					((Collider)component).enabled = false;
					ArmRollingFallDamageCancel();
					rollDir = ((Component)__instance).transform.forward;
					rollDir.y = 0f;
					((Vector3)(ref rollDir)).Normalize();
					rollStartPos = ((Component)__instance).transform.position;
					rollTargetPos = rollStartPos + rollDir * 5f;
				}
			}
			if (isRotatingRoll)
			{
				rollTimer += Time.deltaTime;
				float num22 = rollTimer / rollDur;
				float num23 = Mathf.Lerp(0f, 360f, num22);
				if (Plugin.EnableParkourRotation.Value)
				{
					((Component)__instance).transform.rotation = startRotationRoll * Quaternion.Euler(num23, 0f, 0f);
				}
				if (num22 >= 1f)
				{
					((Component)__instance).transform.rotation = startRotationRoll;
					__instance.UnLock();
					isRotatingRoll = false;
				}
				float num24 = rollTimer / rollDur;
				float num25 = 1f - (1f - num24) * (1f - num24);
				Vector3 position2 = Vector3.Lerp(rollStartPos, rollTargetPos, num25);
				if (Physics.Raycast(((Component)__instance).transform.position + Vector3.up * 0.05f + rollDir * 0.3f, rollDir, 0.8f))
				{
					rollTargetPos = ((Component)__instance).transform.position;
					rollTimer = rollDur;
					((Collider)component).enabled = true;
					return;
				}
				if (num24 >= 1f)
				{
					((Collider)component).enabled = true;
				}
				else
				{
					((Component)__instance).transform.position = position2;
				}
			}
			wasGrounded = isGrounded;
			float value = ((ConfigEntry<float>)(object)Plugin.SkillConfigs["MaxHeight"]).Value;
			float value2 = ((ConfigEntry<float>)(object)Plugin.SkillConfigs["HeightCurrency"]).Value;
			int num26 = (int)(levelHighestHeight / 100f);
			levelHighestHeight = ((Component)__instance).transform.position.y;
			if (((GameEntity)__instance).health <= 0f)
			{
				if (levelHighestHeight > value)
				{
					((ConfigEntry<float>)(object)Plugin.SkillConfigs["MaxHeight"]).Value = levelHighestHeight;
				}
				liveRunHeight = 0f;
				highestMilestone = 0;
				return;
			}
			if (liveRunHeight < value)
			{
				liveRunHeight = value;
			}
			int num27 = 0;
			if (num26 <= highestMilestone)
			{
				return;
			}
			int num28 = num26 - highestMilestone;
			previousCurrency = value2;
			ConfigEntry<float> obj = (ConfigEntry<float>)(object)Plugin.SkillConfigs["HeightCurrency"];
			obj.Value += (float)num28 * 10f;
			if (levelHighestHeight > liveRunHeight && value >= 100f)
			{
				int num29 = (int)(levelHighestHeight / 100f);
				num27 += num29;
				if (num27 > 10)
				{
					num27 = 10;
				}
				ConfigEntry<float> obj2 = (ConfigEntry<float>)(object)Plugin.SkillConfigs["HeightCurrency"];
				obj2.Value += (float)num27;
				liveRunHeight = levelHighestHeight;
			}
			((MonoBehaviour)ParkourUI.Instance).StartCoroutine(ParkourUI.Instance.AnimateCurrencyGain((int)previousCurrency, num28 * 10 + num27));
			highestMilestone = num26;
		}
	}
	[HarmonyPatch(typeof(ENT_Player), "Damage")]
	public class RollingFallDamagePatch
	{
		[HarmonyPrefix]
		public static bool Prefix(DamageInfo info, ref bool __result)
		{
			if (!PlayerModifierPatch.TryCancelRollingFallDamage(info))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(EventSystem), "Update")]
	public class WorldUpdate
	{
		private static bool playerExisted;

		[HarmonyPrefix]
		public static void Postfix()
		{
			float levelHighestHeight = PlayerModifierPatch.levelHighestHeight;
			ENT_Player playerObject = ENT_Player.playerObject;
			float value = ((ConfigEntry<float>)(object)Plugin.SkillConfigs["MaxHeight"]).Value;
			if ((Object)(object)playerObject != (Object)null)
			{
				if (!playerExisted)
				{
					playerExisted = true;
				}
				if (((GameEntity)(playerObject?)).curBuffs != null)
				{
					IEnumerable<string> enumerable = ((((object)((GameEntity)playerObject).curBuffs).GetType().GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((FieldInfo f) => f.FieldType == typeof(List<BuffContainer>))?.GetValue(((GameEntity)playerObject).curBuffs) is List<BuffContainer> source) ? (from b in source.SelectMany((BuffContainer c) => c?.buffs ?? new List<Buff>())
						where b != null && !string.IsNullOrEmpty(b.id)
						select b.id) : null);
					PlayerModifierPatch.isConsumableUltimate = enumerable?.Any((string name) => name == "pilled" || name == "roided") ?? false;
					PlayerModifierPatch.roidedCount = Mathf.Min(enumerable?.Count((string name) => name == "roided") ?? 0, 5);
				}
			}
			if ((Object)(object)playerObject == (Object)null && playerExisted)
			{
				if (levelHighestHeight > value)
				{
					((ConfigEntry<float>)(object)Plugin.SkillConfigs["MaxHeight"]).Value = levelHighestHeight;
				}
				PlayerModifierPatch.liveRunHeight = 0f;
				PlayerModifierPatch.highestMilestone = 0;
				playerExisted = false;
			}
			if (ParkourUI.hasPurchased)
			{
				((ConfigEntry<float>)(object)Plugin.SkillConfigs["HeightCurrency"]).Value = ParkourUI.newCurrencyAmount;
				ParkourUI.hasPurchased = false;
				ParkourUI.UpdateCurrencyDisplay();
			}
		}
	}
}
namespace ParkourKnuckle.UI
{
	public class ParkourUI : MonoBehaviour
	{
		private const float percentLineFillRequiredToUnlock = 0.5f;

		private const float popInDuration = 0.25f;

		private const float popOutDuration = 0.18f;

		private const float nodeAnimateDuration = 0.35f;

		private GameObject uiInstance;

		private GameObject skillTreePanel;

		private GameObject openButtonObj;

		private GameObject closeButtonObj;

		private Transform contentTransform;

		private GameObject clickOutsideBlocker;

		private static TextMeshProUGUI currencyTextComponent;

		private static TextMeshProUGUI heightTextComponent;

		private GameObject currencyIconObj;

		private GameObject currencyAddObj;

		private TextMeshProUGUI mainText;

		private TextMeshProUGUI infoText;

		private CanvasGroup currencyAddCanvasGroup;

		private GameObject resetConfirmBox;

		private Button confirmButton;

		private Button denyButton;

		private GameObject abilityTimesContainer;

		private GameObject leapAbilityBox;

		private GameObject qtAbilityBox;

		private Image leapAbilityTimer;

		private Image leapForceGlow;

		private Image qtAbilityTimer;

		private GameObject loadingScreen;

		private GameObject loadingImages;

		private TextMeshProUGUI mapLoadingText;

		private TextMeshProUGUI seedLoadingText;

		private TextMeshProUGUI idLoadingText;

		private GameObject wallRunFadeHelper;

		private GameObject wallRunLeft;

		private GameObject wallRunRight;

		private GameObject wallRunUp;

		private CanvasGroup wallRunLeftGroup = null;

		private CanvasGroup wallRunRightGroup = null;

		private CanvasGroup wallRunUpGroup = null;

		private GameObject optionsContentObj;

		private GameObject forwardButtonObj;

		private GameObject backButtonObj;

		private Transform headerGroup;

		private TextMeshProUGUI textHeaderComponent;

		private Toggle cameraRotationToggle;

		private Toggle cameraFOVToggle;

		private Toggle cameraShakeToggle;

		private Toggle uiGlowToggle;

		private Button resetProgressButton;

		private GameObject descriptionPanelObj;

		private TextMeshProUGUI perkDescriptionText;

		private Button purchaseButton;

		private TextMeshProUGUI purchaseButtonText;

		private TextMeshProUGUI perkCurrencyText;

		private GameObject perkCurrencyIcon;

		private string currentlySelectedSkillKey = string.Empty;

		private bool pendingPurchaseAnimation = false;

		private readonly Dictionary<string, Button> skillButtons = new Dictionary<string, Button>();

		private readonly Dictionary<string, string[]> skillDependencies = new Dictionary<string, string[]>();

		private readonly Dictionary<string, Image> skillLines = new Dictionary<string, Image>();

		private readonly List<Coroutine> activeAnimations = new List<Coroutine>();

		private readonly Dictionary<string, Coroutine> activeButtonCoroutines = new Dictionary<string, Coroutine>();

		private readonly Dictionary<string, GameObject> graffitiScreens = new Dictionary<string, GameObject>();

		public static bool hasPurchased = false;

		public static float newCurrencyAmount = 0f;

		public static bool purchaseTrue = true;

		private readonly Dictionary<string, string> perkDescriptions = new Dictionary<string, string>
		{
			{ "QuickTurning", "You can quick turn 180 degrees at any point with no debuff by tapping X. This may help save time when you need to turn around at fast intervals." },
			{ "Sliding", "While running (or moving at a high velocity), hold down the crouch key to slide." },
			{ "SlideJumping", "During a slide, you can jump to gain a boost. This boost does consume hand stamina. As the duration of your slide grows, less power will be put into the boost, however, less stamina will be taken." },
			{ "Leaping", "Holding G will cause you to charge up a leap. The longer you charge your leap, the further your leap will go, but your stamina will be consumed the more you charge your leap." },
			{ "Rolling", "While you are falling from great height, hold down your crouch button to initiate a roll when you land. This takes no stamina and prevents fall damage from the landing impact." },
			{ "WallKicking", "While your back is turned away from a wall, hold S and press the spacebar to kick off of that wall. holding down S after the kick will allow you to control your distance while in the air." },
			{ "WallRunning", "You can run on the side of walls by standing close to a wall and double tapping and holding the spacebar and holding A or D depending on which side of the wall you are standing near. This consumes very little hand stamina." },
			{ "VerticalWallRunning", "You have the ability to run up to walls and climb them without needing any tools whatsoever. Double tap and hold spacebar and hold W at the same time while facing a wall to begin a vertical wall run. This consumes a moderate amount of hand stamina.\r\n\r\n" },
			{ "WallRunBoost", "While vertically wall running, you can release W and quickly tap spacebar to kick off of the wall and give yourself a backwards boost. This does not use up your stamina, however, the power of the boost is determined by your hand stamina." }
		};

		private readonly Dictionary<string, string> configToIconMap = new Dictionary<string, string>
		{
			{ "QuickTurning", "QuickTurnIcon" },
			{ "Sliding", "SlideIcon" },
			{ "SlideJumping", "SlideJumpIcon" },
			{ "Leaping", "LeapIcon" },
			{ "Rolling", "RollIcon" },
			{ "WallKicking", "WallKickIcon" },
			{ "WallRunning", "WRHIcon" },
			{ "VerticalWallRunning", "WRVIcon" },
			{ "WallRunBoost", "WRBIcon" }
		};

		private readonly Dictionary<string, float> skillPrices = new Dictionary<string, float>
		{
			{ "QuickTurning", 0f },
			{ "Sliding", 15f },
			{ "SlideJumping", 30f },
			{ "Leaping", 100f },
			{ "Rolling", 75f },
			{ "WallKicking", 30f },
			{ "WallRunning", 50f },
			{ "VerticalWallRunning", 60f },
			{ "WallRunBoost", 75f }
		};

		private Coroutine activePanelPopCoroutine;

		private Coroutine activeButtonPopCoroutine;

		private bool isAnimatingBranch = false;

		private bool wasPlayerObjectPresent = false;

		private const float wobbleSpeed = 2.5f;

		private const float wobbleMagnitude = 4f;

		private const float noiseSpacing = 100f;

		private const float FADE_SPEED = 5f;

		private readonly Dictionary<string, Vector2> nodeOriginPositions = new Dictionary<string, Vector2>();

		private RectTransform quickTurnRect;

		private readonly Dictionary<string, Vector2> lineOriginPositions = new Dictionary<string, Vector2>();

		private RectTransform lineToSlideRect;

		private GameObject perkIconHolderObj;

		private readonly Dictionary<string, GameObject> perkIcons = new Dictionary<string, GameObject>();

		private bool hadLoading = false;

		private string activeGraffitiName = null;

		private float playerCheckTimer = 0f;

		private const float PLAYER_CHECK_INTERVAL = 0.2f;

		private bool cachedIsPlayerPresent = false;

		private CL_GameManager cachedGameManager = null;

		private RectTransform cachedPerkIconRect = null;

		public static ParkourUI Instance { get; private set; }

		public static void Initialize()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			if (!((Object)(object)Instance != (Object)null))
			{
				GameObject val = new GameObject("ParkourKnuckle_UIHost");
				Object.DontDestroyOnLoad((Object)(object)val);
				Instance = val.AddComponent<ParkourUI>();
				Instance.LoadAndBuildUI();
			}
		}

		private void Update()
		{
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_099e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: 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_03df: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			playerCheckTimer += Time.deltaTime;
			if (playerCheckTimer >= 0.2f)
			{
				playerCheckTimer = 0f;
				cachedIsPlayerPresent = (Object)(object)GameObject.Find("CL_Player") != (Object)null;
			}
			bool flag = cachedIsPlayerPresent;
			if (flag && !wasPlayerObjectPresent)
			{
				wasPlayerObjectPresent = true;
				if (Plugin.isUIVisible)
				{
					ToggleUIPanel(showMainPanel: false);
				}
				if ((Object)(object)openButtonObj != (Object)null)
				{
					openButtonObj.SetActive(false);
				}
				if ((Object)(object)currencyIconObj != (Object)null)
				{
					currencyIconObj.SetActive(false);
				}
				if ((Object)(object)abilityTimesContainer != (Object)null)
				{
					abilityTimesContainer.SetActive(true);
				}
				if ((Object)(object)wallRunFadeHelper != (Object)null)
				{
					wallRunFadeHelper.SetActive(true);
				}
			}
			else if (!flag && wasPlayerObjectPresent)
			{
				wasPlayerObjectPresent = false;
				if ((Object)(object)openButtonObj != (Object)null && !Plugin.isUIVisible)
				{
					openButtonObj.SetActive(true);
					openButtonObj.transform.localScale = Vector3.one;
				}
				if ((Object)(object)currencyIconObj != (Object)null)
				{
					currencyIconObj.SetActive(true);
					UpdateCurrencyDisplay();
				}
				if ((Object)(object)abilityTimesContainer != (Object)null)
				{
					abilityTimesContainer.SetActive(false);
				}
				if ((Object)(object)wallRunFadeHelper != (Object)null)
				{
					wallRunFadeHelper.SetActive(false);
				}
			}
			if (flag)
			{
				if ((Object)(object)qtAbilityBox != (Object)null)
				{
					if (((ConfigEntry<bool>)(object)Plugin.SkillConfigs["QuickTurning"]).Value && ((GameEntity)ENT_Player.playerObject).health > 0f && !cachedGameManager.isPaused)
					{
						qtAbilityBox.SetActive(true);
					}
					else
					{
						qtAbilityBox.SetActive(false);
					}
					if ((Object)(object)qtAbilityTimer != (Object)null && PlayerModifierPatch.onCooldown)
					{
						qtAbilityTimer.fillAmount = PlayerModifierPatch.CooldownTime / PlayerModifierPatch.CooldownDur;
					}
					else if ((Object)(object)qtAbilityTimer != (Object)null)
					{
						qtAbilityTimer.fillAmount = 1f;
					}
				}
				if ((Object)(object)leapAbilityBox != (Object)null)
				{
					if (((ConfigEntry<bool>)(object)Plugin.SkillConfigs["Leaping"]).Value && ((GameEntity)ENT_Player.playerObject).health > 0f && !cachedGameManager.isPaused)
					{
						leapAbilityBox.SetActive(true);
					}
					else
					{
						leapAbilityBox.SetActive(false);
					}
					if ((Object)(object)leapAbilityTimer != (Object)null && PlayerModifierPatch.leapCooldown)
					{
						leapAbilityTimer.fillAmount = PlayerModifierPatch.leapCooldownTime / PlayerModifierPatch.leapCooldownDur;
					}
					else if ((Object)(object)leapAbilityTimer != (Object)null)
					{
						leapAbilityTimer.fillAmount = 1f;
					}
					if ((Object)(object)leapForceGlow != (Object)null && PlayerModifierPatch.isCharging)
					{
						leapForceGlow.fillAmount = PlayerModifierPatch.currentCharge / PlayerModifierPatch.maxChargeTime;
						((Graphic)leapForceGlow).color = new Color(((Graphic)leapForceGlow).color.r, ((Graphic)leapForceGlow).color.g, ((Graphic)leapForceGlow).color.b, Mathf.Max(0.1f, leapForceGlow.fillAmount / 2f));
					}
					else if ((Object)(object)leapForceGlow != (Object)null)
					{
						leapForceGlow.fillAmount = 0f;
					}
				}
				if ((Object)(object)currencyIconObj != (Object)null && (((GameEntity)ENT_Player.playerObject).health <= 0f || cachedGameManager.isPaused))
				{
					currencyIconObj.SetActive(true);
				}
				else if ((Object)(object)currencyIconObj != (Object)null && ((GameEntity)ENT_Player.playerObject).health > 0f && !cachedGameManager.isPaused)
				{
					currencyIconObj.SetActive(false);
				}
				if ((Object)(object)wallRunFadeHelper != (Object)null && Plugin.EnableWallRunHelper.Value)
				{
					if ((Object)(object)wallRunLeftGroup != (Object)null)
					{
						float num = ((PlayerModifierPatch.canRun && PlayerModifierPatch.wallLeft && !PlayerModifierPatch.hasWallRunInAir && !PlayerModifierPatch.isHorizRun) ? 1f : 0f);
						wallRunLeftGroup.alpha = Mathf.MoveTowards(wallRunLeftGroup.alpha, num, 5f * Time.deltaTime);
					}
					if ((Object)(object)wallRunRightGroup != (Object)null)
					{
						float num2 = ((PlayerModifierPatch.canRun && PlayerModifierPatch.wallRight && !PlayerModifierPatch.hasWallRunInAir && !PlayerModifierPatch.isHorizRun) ? 1f : 0f);
						wallRunRightGroup.alpha = Mathf.MoveTowards(wallRunRightGroup.alpha, num2, 5f * Time.deltaTime);
					}
					if ((Object)(object)wallRunUpGroup != (Object)null)
					{
						float num3 = ((PlayerModifierPatch.canVert && PlayerModifierPatch.wallFront && !PlayerModifierPatch.hasWallRunVertical && !PlayerModifierPatch.isVerticalRun) ? 1f : 0f);
						wallRunUpGroup.alpha = Mathf.MoveTowards(wallRunUpGroup.alpha, num3, 5f * Time.deltaTime);
					}
					if ((Object)(object)cachedGameManager != (Object)null)
					{
						if (cachedGameManager.isPaused)
						{
							wallRunFadeHelper.SetActive(false);
						}
						else if (((GameEntity)ENT_Player.playerObject).health <= 0f)
						{
							wallRunFadeHelper.SetActive(false);
						}
						else
						{
							wallRunFadeHelper.SetActive(true);
						}
					}
				}
				else if ((Object)(object)wallRunFadeHelper != (Object)null && !Plugin.EnableWallRunHelper.Value)
				{
					wallRunFadeHelper.SetActive(false);
				}
				if (openButtonObj.activeSelf)
				{
					openButtonObj.SetActive(false);
				}
			}
			if ((Object)(object)cachedGameManager == (Object)null)
			{
				cachedGameManager = Object.FindObjectOfType<CL_GameManager>();
			}
			if ((Object)(object)cachedGameManager != (Object)null)
			{
				if (CL_GameManager.IsLoading() && !hadLoading)
				{
					hadLoading = true;
					loadingScreen.SetActive(true);
					string key = "Graffiti" + Random.Range(1, 10);
					if (graffitiScreens.TryGetValue(key, out var value))
					{
						value.SetActive(true);
						activeGraffitiName = key;
					}
				}
				else if (!CL_GameManager.IsLoading() && hadLoading)
				{
					hadLoading = false;
					((TMP_Text)mapLoadingText).text = "";
					((TMP_Text)seedLoadingText).text = "";
					((TMP_Text)idLoadingText).text = "";
					loadingScreen.SetActive(false);
					if (!string.IsNullOrEmpty(activeGraffitiName))
					{
						if (graffitiScreens.TryGetValue(activeGraffitiName, out var value2))
						{
							value2.SetActive(false);
						}
						activeGraffitiName = null;
					}
				}
			}
			if ((Object)(object)cachedGameManager != (Object)null && CL_GameManager.IsLoading())
			{
				M_Level val = Object.FindAnyObjectByType<M_Level>();
				if ((Object)(object)val != (Object)null)
				{
					string levelName = val.levelName;
					int levelSeed = val.GetLevelSeed();
					int instanceID = ((Object)val).GetInstanceID();
					((TMP_Text)mapLoadingText).text = levelName;
					((TMP_Text)seedLoadingText).text = levelSeed.ToString();
					((TMP_Text)idLoadingText).text = instanceID.ToString();
				}
			}
			if (Plugin.isUIVisible && !isAnimatingBranch)
			{
				ApplyProceduralWobble();
			}
			if (Plugin.isUIVisible && (Object)(object)perkIconHolderObj != (Object)null && perkIconHolderObj.activeSelf)
			{
				float num4 = Time.time * 2.5f;
				if ((Object)(object)cachedPerkIconRect == (Object)null)
				{
					cachedPerkIconRect = perkIconHolderObj.GetComponent<RectTransform>();
				}
				float num5 = Mathf.Sin(num4) * 4f;
				float num6 = Mathf.Cos(num4 * 0.8f) * 4f;
				if ((Object)(object)cachedPerkIconRect != (Object)null)
				{
					cachedPerkIconRect.anchoredPosition = new Vector2(num5, num6);
				}
			}
		}

		private void ApplyProceduralWobble()
		{
			//IL_00ae: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: 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_01f3: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: 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_0107: 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_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: 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)
			float num = Time.time * 2.5f;
			foreach (KeyValuePair<string, Button> skillButton in skillButtons)
			{
				string key = skillButton.Key;
				Button value = skillButton.Value;
				if (!activeButtonCoroutines.TryGetValue(key, out var value2) || value2 == null)
				{
					RectTransform component = ((Component)value).GetComponent<RectTransform>();
					if ((Object)(object)component != (Object)null && nodeOriginPositions.TryGetValue(key, out var value3))
					{
						Vector2 val = ((!IsConnectedToRoot(key) && !AreDependenciesMet(key)) ? (value3 * 0.005f) : Vector2.zero);
						float num2 = Mathf.PerlinNoise(val.x + num, val.y) * 2f - 1f;
						float num3 = Mathf.PerlinNoise(val.x, val.y + num) * 2f - 1f;
						Vector2 val2 = new Vector2(num2, num3) * 4f;
						component.anchoredPosition = value3 + val2;
					}
				}
				if (!skillLines.TryGetValue(key, out var value4))
				{
					continue;
				}
				RectTransform component2 = ((Component)value4).GetComponent<RectTransform>();
				if ((Object)(object)component2 != (Object)null && lineOriginPositions.TryGetValue(key, out var value5))
				{
					if (IsConnectedToRoot(key) || AreDependenciesMet(key))
					{
						Vector2 zero = Vector2.zero;
						float num4 = Mathf.PerlinNoise(zero.x + num, zero.y) * 2f - 1f;
						float num5 = Mathf.PerlinNoise(zero.x, zero.y + num) * 2f - 1f;
						Vector2 val3 = new Vector2(num4, num5) * 4f;
						component2.anchoredPosition = value5 + val3;
					}
					else
					{
						component2.anchoredPosition = value5;
					}
				}
			}
		}

		private bool IsConnectedToRoot(string configKey)
		{
			if (configKey == "QuickTurning")
			{
				if (Plugin.SkillConfigs.TryGetValue("QuickTurning", out var value))
				{
					return ((ConfigEntry<bool>)(object)value).Value;
				}
				return false;
			}
			if (Plugin.SkillConfigs.TryGetValue(configKey, out var value2) && !((ConfigEntry<bool>)(object)value2).Value)
			{
				return false;
			}
			if (skillDependencies.TryGetValue(configKey, out var value3))
			{
				string[] array = value3;
				foreach (string configKey2 in array)
				{
					if (IsConnectedToRoot(configKey2))
					{
						return true;
					}
				}
			}
			return false;
		}

		private void LoadAndBuildUI()
		{
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_06aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_076a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0763: Unknown result type (might be due to invalid IL or missing references)
			//IL_07ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0806: Expected O, but got Unknown
			//IL_0407: Unknown result type (might be due to invalid IL or missing references)
			//IL_0411: Expected O, but got Unknown
			//IL_0af4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afb: Expected O, but got Unknown
			//IL_0449: Unknown result type (might be due to invalid IL or missing references)
			//IL_0453: Expected O, but got Unknown
			string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
			string text = Path.Combine(directoryName, "Assets", "parkourui");
			if (!File.Exists(text))
			{
				CleanUpFailedInit();
				return;
			}
			AssetBundle val = AssetBundle.LoadFromFile(text);
			if ((Object)(object)val == (Object)null)
			{
				CleanUpFailedInit();
				return;
			}
			GameObject val2 = null;
			string[] allAssetNames = val.GetAllAssetNames();
			if (allAssetNames.Length != 0)
			{
				val2 = val.LoadAsset<GameObject>(allAssetNames[0]);
			}
			if ((Object)(object)val2 == (Object)null)
			{
				val.Unload(false);
				CleanUpFailedInit();
				return;
			}
			uiInstance = Object.Instantiate<GameObject>(val2);
			Object.DontDestroyOnLoad((Object)(object)uiInstance);
			val.Unload(false);
			Canvas component = uiInstance.GetComponent<Canvas>();
			if ((Object)(object)component != (Object)null)
			{
				component.renderMode = (RenderMode)0;
				component.worldCamera = null;
				component.sortingOrder = 32767;
			}
			CanvasScaler component2 = uiInstance.GetComponent<CanvasScaler>();
			if ((Object)(object)component2 != (Object)null)
			{
				component2.uiScaleMode = (ScaleMode)1;
				component2.referenceResolution = new Vector2(1920f, 1080f);
				component2.screenMatchMode = (ScreenMatchMode)0;
				component2.matchWidthOrHeight = 0.5f;
			}
			Transform obj = uiInstance.transform.Find("OpenSTButton");
			openButtonObj = ((obj != null) ? ((Component)obj).gameObject : null);
			Transform obj2 = uiInstance.transform.Find("STMainBorder");
			skillTreePanel = ((obj2 != null) ? ((Component)obj2).gameObject : null);
			Transform obj3 = uiInstance.transform.Find("CurrencyIcon");
			currencyIconObj = ((obj3 != null) ? ((Component)obj3).gameObject : null);
			Transform obj4 = uiInstance.transform.Find("CurrencyAdd");
			currencyAddObj = ((obj4 != null) ? ((Component)obj4).gameObject : null);
			Transform obj5 = uiInstance.transform.Find("AbilityTimes");
			abilityTimesContainer = ((obj5 != null) ? ((Component)obj5).gameObject : null);
			Transform obj6 = uiInstance.transform.Find("LoadingScreen");
			loadingScreen = ((obj6 != null) ? ((Component)obj6).gameObject : null);
			Transform obj7 = uiInstance.transform.Find("WallRunHelper");
			wallRunFadeHelper = ((obj7 != null) ? ((Component)obj7).gameObject : null);
			if ((Object)(object)skillTreePanel != (Object)null)
			{
				Transform obj8 = skillTreePanel.transform.Find("CloseSTButton");
				closeButtonObj = ((obj8 != null) ? ((Component)obj8).gameObject : null);
				contentTransform = skillTreePanel.transform.Find("PerkContent");
				if ((Object)(object)contentTransform == (Object)null)
				{
					contentTransform = skillTreePanel.transform.Find("Content");
				}
				Transform obj9 = skillTreePanel.transform.Find("OptionsContent");
				optionsContentObj = ((obj9 != null) ? ((Component)obj9).gameObject : null);
				Transform obj10 = skillTreePanel.transform.Find("PerkDescription");
				descriptionPanelObj = ((obj10 != null) ? ((Component)obj10).gameObject : null);
				Transform obj11 = skillTreePanel.transform.Find("ResetConfirmBox");
				resetConfirmBox = ((obj11 != null) ? ((Component)obj11).gameObject : null);
				if ((Object)(object)resetConfirmBox != (Object)null)
				{
					resetConfirmBox.SetActive(false);
					Transform obj12 = resetConfirmBox.transform.Find("ConfirmButton");
					confirmButton = ((obj12 != null) ? ((Component)obj12).GetComponent<Button>() : null);
					Transform obj13 = resetConfirmBox.transform.Find("DenyButton");
					denyButton = ((obj13 != null) ? ((Component)obj13).GetComponent<Button>() : null);
					if ((Object)(object)confirmButton != (Object)null)
					{
						((UnityEventBase)confirmButton.onClick).RemoveAllListeners();
						((UnityEvent)confirmButton.onClick).AddListener(new UnityAction(HandleResetConfirmed));
					}
					if ((Object)(object)denyButton != (Object)null)
					{
						((UnityEventBase)denyButton.onClick).RemoveAllListeners();
						((UnityEvent)denyButton.onClick).AddListener(new UnityAction(HandleResetDenied));
					}
				}
				headerGroup = skillTreePanel.transform.Find("STMainTextHeader");
				if ((Object)(object)headerGroup != (Object)null)
				{
					Transform obj14 = headerGroup.Find("ForwardButton");
					forwardButtonObj = ((obj14 != null) ? ((Component)obj14).gameObject : null);
					Transform obj15 = headerGroup.Find("BackButton");
					backButtonObj = ((obj15 != null) ? ((Component)obj15).gameObject : null);
					textHeaderComponent = ((Component)headerGroup).GetComponentInChildren<TextMeshProUGUI>(true);
				}
				if ((Object)(object)optionsContentObj != (Object)null)
				{
					Transform obj16 = optionsContentObj.transform.Find("EPRToggle");
					cameraRotationToggle = ((obj16 != null) ? ((Component)obj16).GetComponent<Toggle>() : null);
					Transform obj17 = optionsContentObj.transform.Find("EPFToggle");
					cameraFOVToggle = ((obj17 != null) ? ((Component)obj17).GetComponent<Toggle>() : null);
					Transform obj18 = optionsContentObj.transform.Find("EPSToggle");
					cameraShakeToggle = ((obj18 != null) ? ((Component)obj18).GetComponent<Toggle>() : null);
					Transform obj19 = optionsContentObj.transform.Find("EWRGToggle");
					uiGlowToggle = ((obj19 != null) ? ((Component)obj19).GetComponent<Toggle>() : null);
					Transform obj20 = optionsContentObj.transform.Find("ResetButton");
					resetProgressButton = ((obj20 != null) ? ((Component)obj20).GetComponent<Button>() : null);
				}
				if ((Object)(object)descriptionPanelObj != (Object)null)
				{
					Transform obj21 = descriptionPanelObj.transform.Find("PerkDescText");
					perkDescriptionText = ((obj21 != null) ? ((Component)obj21).GetComponent<TextMeshProUGUI>() : null);
					Transform obj22 = descriptionPanelObj.transform.Find("PurchaseButton");
					purchaseButton = ((obj22 != null) ? ((Component)obj22).GetComponent<Button>() : null);
					if ((Object)(object)purchaseButton != (Object)null)
					{
						Transform obj23 = ((Component)purchaseButton).transform.Find("PurchaseText");
						purchaseButtonText = ((obj23 != null) ? ((Component)obj23).GetComponent<TextMeshProUGUI>() : null);
					}
				}
			}
			CreateClickOutsideBlocker();
			MapInterfaceControls();
			MapProgressionNodes();
			bool flag = (wasPlayerObjectPresent = (Object)(object)GameObject.Find("CL_Player") != (Object)null);
			if ((Object)(object)openButtonObj != (Object)null)
			{
				openButtonObj.transform.localScale = (Plugin.isUIVisible ? Vector3.zero : Vector3.one);
				openButtonObj.SetActive(!Plugin.isUIVisible && !flag);
			}
			if ((Object)(object)currencyIconObj != (Object)null)
			{
				Transform obj24 = currencyIconObj.transform.Find("CurrencyText");
				currencyTextComponent = ((obj24 != null) ? ((Component)obj24).GetComponent<TextMeshProUGUI>() : null);
				Transform obj25 = currencyIconObj.transform.Find("HeightText");
				heightTextComponent = ((obj25 != null) ? ((Component)obj25).GetComponent<TextMeshProUGUI>() : null);
			}
			UpdateCurrencyDisplay();
			if ((Object)(object)skillTreePanel != (Object)null)
			{
				skillTreePanel.transform.localScale = (Plugin.isUIVisible ? Vector3.one : Vector3.zero);
				skillTreePanel.SetActive(Plugin.isUIVisible);
			}
			GameObject obj26 = clickOutsideBlocker;
			if (obj26 != null)
			{
				obj26.SetActive(Plugin.isUIVisible);
			}
			SwitchSubMenuContext(showPerksTree: true);
			Transform obj27 = descriptionPanelObj.transform.Find("PerkIconHolder");
			perkIconHolderObj = ((obj27 != null) ? ((Component)obj27).gameObject : null);
			if ((Object)(object)perkIconHolderObj != (Object)null)
			{
				foreach (Transform item in perkIconHolderObj.transform)
				{
					Transform val3 = item;
					if (!(((Object)val3).name == "PerkCurrencyAmount") && !(((Object)val3).name == "PerkCurrencyIcon"))
					{
						perkIcons[((Object)val3).name] = ((Component)val3).gameObject;
						((Component)val3).gameObject.SetActive(false);
					}
				}
				Transform obj28 = perkIconHolderObj.transform.Find("PerkCurrencyAmount");
				perkCurrencyText = ((obj28 != null) ? ((Component)obj28).GetComponent<TextMeshProUGUI>() : null);
				Transform obj29 = perkIconHolderObj.transform.Find("PerkCurrencyIcon");
				perkCurrencyIcon = ((obj29 != null) ? ((Component)obj29).gameObject : null);
			}
			Transform obj30 = uiInstance.transform.Find("CurrencyAdd");
			currencyAddObj = ((obj30 != null) ? ((Component)obj30).gameObject : null);
			if ((Object)(object)currencyAddObj != (Object)null)
			{
				currencyAddCanvasGroup = currencyAddObj.GetComponent<CanvasGroup>();
				if ((Object)(object)currencyAddCanvasGroup == (Object)null)
				{
					currencyAddCanvasGroup = currencyAddObj.AddComponent<CanvasGroup>();
				}
				Transform obj31 = currencyAddObj.transform.Find("CurrencyAddTextMain");
				mainText = ((obj31 != null) ? ((Component)obj31).GetComponent<TextMeshProUGUI>() : null);
				Transform obj32 = currencyAddObj.transform.Find("CurrencyAddTextInto");
				infoText = ((obj32 != null) ? ((Component)obj32).GetComponent<TextMeshProUGUI>() : null);
				currencyAddObj.SetActive(false);
			}
			if ((Object)(object)abilityTimesContainer != (Object)null)
			{
				leapAbilityBox = ((Component)abilityTimesContainer.transform.Find("LeapAbility")).gameObject;
				qtAbilityBox = ((Component)abilityTimesContainer.transform.Find("QTAbility")).gameObject;
				if ((Object)(object)leapAbilityBox != (Object)null)
				{
					leapAbilityTimer = ((Component)leapAbilityBox.transform.Find("LeapTimer")).GetComponent<Image>();
					leapForceGlow = ((Component)leapAbilityBox.transform.Find("LeapForceGlow")).GetComponent<Image>();
					leapAbilityBox.SetActive(false);
				}
				if ((Object)(object)qtAbilityBox != (Object)null)
				{
					qtAbilityTimer = ((Component)qtAbilityBox.transform.Find("QTTimer")).GetComponent<Image>();
					leapAbilityBox.SetActive(false);
				}
				abilityTimesContainer.SetActive(false);
			}
			if ((Object)(object)loadingScreen != (Object)null)
			{
				loadingImages = ((Component)loadingScreen.transform.Find("LoadingImages")).gameObject;
				foreach (Transform item2 in loadingImages.transform)
				{
					Transform val4 = item2;
					if (((Object)val4).name.StartsWith("Graffiti"))
					{
						graffitiScreens[((Object)val4).name] = ((Component)val4).gameObject;
						((Component)val4).gameObject.SetActive(false);
					}
				}
				mapLoadingText = ((Component)loadingScreen.transform.Find("MapText")).GetComponent<TextMeshProUGUI>();
				((TMP_Text)mapLoadingText).text = "";
				seedLoadingText = ((Component)loadingScreen.transform.Find("SeedText")).GetComponent<TextMeshProUGUI>();
				((TMP_Text)seedLoadingText).text = "";
				idLoadingText = ((Component)loadingScreen.transform.Find("MapIDText")).GetComponent<TextMeshProUGUI>();
				((TMP_Text)idLoadingText).text = "";
				loadingScreen.SetActive(false);
			}
			if ((Object)(object)wallRunFadeHelper != (Object)null)
			{
				wallRunFadeHelper.SetActive(false);
				Transform obj33 = wallRunFadeHelper.transform.Find("WallRunLeft");
				wallRunLeft = ((obj33 != null) ? ((Component)obj33).gameObject : null);
				Transform obj34 = wallRunFadeHelper.transform.Find("WallRunRight");
				wallRunRight = ((obj34 != null) ? ((Component)obj34).gameObject : null);
				Transform obj35 = wallRunFadeHelper.transform.Find("WallRunUp");
				wallRunUp = ((obj35 != null) ? ((Component)obj35).gameObject : null);
				if ((Object)(object)wallRunLeft != (Object)null)
				{
					wallRunLeftGroup = wallRunLeft.GetComponent<CanvasGroup>() ?? wallRunLeft.AddComponent<CanvasGroup>();
				}
				if ((Object)(object)wallRunRight != (Object)null)
				{
					wallRunRightGroup = wallRunRight.GetComponent<CanvasGroup>() ?? wallRunRight.AddComponent<CanvasGroup>();
				}
				if ((Object)(object)wallRunUp != (Object)null)
				{
					wallRunUpGroup = wallRunUp.GetComponent<CanvasGroup>() ?? wallRunUp.AddComponent<CanvasGroup>();
				}
				wallRunLeftGroup.alpha = 0f;
				wallRunRightGroup.alpha = 0f;
				wallRunUpGroup.alpha = 0f;
			}
		}

		public static void UpdateCurrencyDisplay()
		{
			if ((Object)(object)currencyTextComponent != (Object)null && Plugin.SkillConfigs.TryGetValue("HeightCurrency", out var value))
			{
				((TMP_Text)currencyTextComponent).text = ((ConfigEntry<float>)(object)value).Value.ToString();
			}
			if ((Object)(object)heightTextComponent != (Object)null && Plugin.SkillConfigs.TryGetValue("MaxHeight", out var value2))
			{
				int num = (int)((ConfigEntry<float>)(object)value2).Value;
				((TMP_Text)heightTextComponent).text = num + "m";
			}
		}

		public IEnumerator AnimateCurrencyGain(int oldVal, int addedAmount)
		{
			int finalVal = oldVal + addedAmount;
			currencyAddCanvasGroup.alpha = 0f;
			currencyAddObj.SetActive(true);
			((TMP_Text)mainText).text = oldVal.ToString();
			((TMP_Text)infoText).text = $"+{addedAmount}";
			float elapsed = 0f;
			float fadeDuration = 0.3f;
			while (elapsed < fadeDuration)
			{
				elapsed += Time.deltaTime;
				currencyAddCanvasGroup.alpha = Mathf.Clamp01(elapsed / fadeDuration);
				yield return null;
			}
			yield return (object)new WaitForSeconds(0.5f);
			RectTransform infoRect = ((Component)infoText).GetComponent<RectTransform>();
			Vector2 startPos = infoRect.anchoredPosition;
			Vector2 targetPos = ((Component)mainText).GetComponent<RectTransform>().anchoredPosition;
			elapsed = 0f;
			float moveDuration = 0.4f;
			while (elapsed < moveDuration)
			{
				elapsed += Time.deltaTime;
				float t = Mathf.SmoothStep(0f, 1f, elapsed / moveDuration);
				infoRect.anchoredPosition = Vector2.Lerp(startPos, targetPos, t);
				((TMP_Text)infoText).alpha = 1f - t;
				yield return null;
			}
			elapsed = 0f;
			float tickerDuration = 0.6f;
			while (elapsed < tickerDuration)
			{
				elapsed += Time.deltaTime;
				int current = (int)Mathf.Lerp((float)oldVal, (float)finalVal, elapsed / tickerDuration);
				((TMP_Text)mainText).text = current.ToString();
				yield return null;
			}
			((TMP_Text)mainText).text = finalVal.ToString();
			elapsed = 0f;
			while (elapsed < fadeDuration)
			{
				elapsed += Time.deltaTime;
				currencyAddCanvasGroup.alpha = 1f - Mathf.Clamp01(elapsed / fadeDuration);
				yield return null;
			}
			currencyAddObj.SetActive(false);
		}

		private void CreateClickOutsideBlocker()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: Expected O, but got Unknown
			//IL_0073: 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_008b: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			if (!((Object)(object)uiInstance == (Object)null))
			{
				GameObject val = new GameObject("STOutsideClickBlocker");
				val.transform.SetParent(uiInstance.transform, false);
				if ((Object)(object)skillTreePanel != (Object)null)
				{
					val.transform.SetSiblingIndex(skillTreePanel.transform.GetSiblingIndex());
				}
				RectTransform val2 = val.AddComponent<RectTransform>();
				val2.anchorMin = Vector2.zero;
				val2.anchorMax = Vector2.one;
				val2.sizeDelta = Vector2.zero;
				Image val3 = val.AddComponent<Image>();
				((Graphic)val3).color = new Color(0f, 0f, 0f, 0f);
				Button val4 = val.AddComponent<Button>();
				((UnityEvent)val4.onClick).AddListener((UnityAction)delegate
				{
					ToggleUIPanel(showMainPanel: false);
				});
				clickOutsideBlocker = val;
			}
		}

		private void CleanUpFailedInit()
		{
			Instance = null;
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		private void MapInterfaceControls()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			//IL_0231: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Expected O, but got Unknown
			//IL_0254: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Expected O, but got Unknown
			GameObject obj = openButtonObj;
			if (obj != null)
			{
				Button component = obj.GetComponent<Button>();
				if (component != null)
				{
					((UnityEvent)component.onClick).AddListener((UnityAction)delegate
					{
						ToggleUIPanel(showMainPanel: true);
					});
				}
			}
			GameObject obj2 = closeButtonObj;
			if (obj2 != null)
			{
				Button component2 = obj2.GetComponent<Button>();
				if (component2 != null)
				{
					((UnityEvent)component2.onClick).AddListener((UnityAction)delegate
					{
						ToggleUIPanel(showMainPanel: false);
					});
				}
			}
			GameObject obj3 = forwardButtonObj;
			if (obj3 != null)
			{
				Button component3 = obj3.GetComponent<Button>();
				if (component3 != null)
				{
					((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
					{
						if (!((Object)(object)descriptionPanelObj != (Object)null) || !descriptionPanelObj.activeSelf)
						{
							SwitchSubMenuContext(showPerksTree: false);
						}
					});
				}
			}
			GameObject obj4 = backButtonObj;
			if (obj4 != null)
			{
				Button component4 = obj4.GetComponent<Button>();
				if (component4 != null)
				{
					((UnityEvent)component4.onClick).AddListener((UnityAction)delegate
					{
						if ((Object)(object)descriptionPanelObj != (Object)null && descriptionPanelObj.activeSelf)
						{
							ReturnFromDescriptionPage();
						}
						else
						{
							SwitchSubMenuContext(showPerksTree: true);
						}
					});
				}
			}
			if ((Object)(object)cameraRotationToggle != (Object)null)
			{
				cameraRotationToggle.isOn = Plugin.EnableParkourRotation.Value;
				((UnityEvent<bool>)(object)cameraRotationToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isChecked)
				{
					Plugin.EnableParkourRotation.Value = isChecked;
				});
			}
			if ((Object)(object)cameraFOVToggle != (Object)null)
			{
				cameraFOVToggle.isOn = Plugin.EnableParkourFOV.Value;
				((UnityEvent<bool>)(object)cameraFOVToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isChecked)
				{
					Plugin.EnableParkourFOV.Value = isChecked;
				});
			}
			if ((Object)(object)cameraShakeToggle != (Object)null)
			{
				cameraShakeToggle.isOn = Plugin.EnableParkourShake.Value;
				((UnityEvent<bool>)(object)cameraShakeToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isChecked)
				{
					Plugin.EnableParkourShake.Value = isChecked;
				});
			}
			if ((Object)(object)uiGlowToggle != (Object)null)
			{
				uiGlowToggle.isOn = Plugin.EnableWallRunHelper.Value;
				((UnityEvent<bool>)(object)uiGlowToggle.onValueChanged).AddListener((UnityAction<bool>)delegate(bool isChecked)
				{
					Plugin.EnableWallRunHelper.Value = isChecked;
				});
			}
			Button obj5 = resetProgressButton;
			if (obj5 != null)
			{
				((UnityEvent)obj5.onClick).AddListener(new UnityAction(ShowResetConfirmPopup));
			}
			Button obj6 = purchaseButton;
			if (obj6 != null)
			{
				((UnityEvent)obj6.onClick).AddListener(new UnityAction(OnPurchasePressed));
			}
		}

		private void SwitchSubMenuContext(bool showPerksTree)
		{
			if ((Object)(object)contentTransform != (Object)null)
			{
				((Component)contentTransform).gameObject.SetActive(showPerksTree);
			}
			if ((Object)(object)optionsContentObj != (Object)null)
			{
				optionsContentObj.SetActive(!showPerksTree);
			}
			if ((Object)(object)descriptionPanelObj != (Object)null)
			{
				descriptionPanelObj.SetActive(false);
			}
			if ((Object)(object)headerGroup != (Object)null)
			{
				((Component)headerGroup).gameObject.SetActive(true);
			}
			if ((Object)(object)forwardButtonObj != (Object)null)
			{
				forwardButtonObj.SetActive(showPerksTree);
			}
			if ((Object)(object)backButtonObj != (Object)null)
			{
				backButtonObj.SetActive(!showPerksTree);
			}
			if ((Object)(object)textHeaderComponent != (Object)null)
			{
				((Component)textHeaderComponent).gameObject.SetActive(true);
				((TMP_Text)textHeaderComponent).text = (showPerksTree ? "SKILL TREE" : "OPTIONS");
			}
			if (!showPerksTree && (Object)(object)cameraRotationToggle != (Object)null)
			{
				cameraRotationToggle.isOn = Plugin.EnableParkourRotation.Value;
			}
			if (!showPerksTree && (Object)(object)cameraFOVToggle != (Object)null)
			{
				cameraFOVToggle.isOn = Plugin.EnableParkourFOV.Value;
			}
			if (!showPerksTree && (Object)(object)cameraShakeToggle != (Object)null)
			{
				cameraShakeToggle.isOn = Plugin.EnableParkourShake.Value;
			}
			if (!showPerksTree && (Object)(object)uiGlowToggle != (Object)null)
			{
				uiGlowToggle.isOn = Plugin.EnableWallRunHelper.Value;
			}
			if ((Object)(object)contentTransform != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(FadePanel(((Component)contentTransform).gameObject, showPerksTree, 0.3f));
			}
			if ((Object)(object)optionsContentObj != (Object)null)
			{
				((MonoBehaviour)this).StartCoroutine(FadePanel(optionsContentObj.gameObject, !showPerksTree, 0.3f));
			}
		}

		private IEnumerator FadePanel(GameObject obj, bool fadeIn, float duration)
		{
			CanvasGroup cg = obj.GetComponent<CanvasGroup>();
			if ((Object)(object)cg == (Object)null)
			{
				cg = obj.AddComponent<CanvasGroup>();
			}
			float startAlpha = cg.alpha;
			float endAlpha = (fadeIn ? 1f : 0f);
			float elapsed = 0f;
			while (elapsed < duration)
			{
				elapsed += Time.deltaTime;
				cg.alpha = Mathf.Lerp(startAlpha, endAlpha, elapsed / duration);
				yield return null;
			}
			cg.alpha = endAlpha;
		}

		private void OnResetRequested()
		{
			foreach (string key in skillButtons.Keys)
			{
				if (Plugin.SkillConfigs.TryGetValue(key, out var value))
				{
					((ConfigEntry<bool>)(object)value).Value = false;
				}
			}
			newCurrencyAmount = 0f;
			((ConfigEntry<float>)(object)Plugin.SkillConfigs["HeightCurrency"]).Value = 0f;
			((ConfigEntry<float>)(object)Plugin.SkillConfigs["MaxHeight"]).Value = 0f;
			UpdateCurrencyDisplay();
			foreach (Coroutine activeAnimation in activeAnimations)
			{
				if (activeAnimation != null)
				{
					((MonoBehaviour)this).StopCoroutine(activeAnimation);
				}
			}
			activeAnimations.Clear();
			isAnimatingBranch = false;
			RefreshAllNodeVisuals();
		}

		private void ShowResetConfirmPopup()
		{
			if ((Object)(object)optionsContentObj != (Object)null)
			{
				optionsContentObj.SetActive(false);
			}
			if ((Object)(object)headerGroup != (Object)null)
			{
				((Component)headerGroup).gameObject.SetActive(false);
			}
			if ((Object)(object)resetConfirmBox != (Object)null)
			{
				resetConfirmBox.SetActive(true);
			}
		}

		private void HandleResetConfirmed()
		{
			OnResetRequested();
			if ((Object)(object)resetConfirmBox != (Object)null)
			{
				resetConfirmBox.SetActive(false);
			}
			if ((Object)(object)optionsContentObj != (Object)null)
			{
				optionsContentObj.SetActive(true);
			}
			if ((Object)(object)headerGroup != (Object)null)
			{
				((Component)headerGroup).gameObject.SetActive(true);
			}
		}

		private void HandleResetDenied()
		{
			if ((Object)(object)resetConfirmBox != (Object)null)
			{
				resetConfirmBox.SetActive(false);
			}
			if ((Object)(object)optionsContentObj != (Object)null)
			{
				optionsContentObj.SetActive(true);
			}
			if ((Object)(object)headerGroup != (Object)null)
			{
				((Component)headerGroup).gameObject.SetActive(true);
			}
		}

		private void MapProgressionNodes()
		{
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_021f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)contentTransform == (Object)null)
			{
				return;
			}
			skillButtons.Clear();
			skillDependencies.Clear();
			skillLines.Clear();
			nodeOriginPositions.Clear();
			RegisterNode("QTButton", "QuickTurning", null, "LineToSlide");
			RegisterNode("SlideButton", "Sliding", new string[1] { "QuickTurning" }, null);
			RegisterNode("SlideJButton", "SlideJumping", new string[1] { "Sliding" }, "LineToSJ");
			RegisterNode("LeapButton", "Leaping", new string[1] { "SlideJumping" }, "LineToLeaping");
			RegisterNode("RollButton", "Rolling", new string[1] { "Sliding" }, "LineToRoll");
			RegisterNode("WKButton", "WallKicking", new string[1] { "Sliding" }, "LineToWK");
			RegisterNode("WRButton", "WallRunning", new string[1] { "WallKicking" }, "LineToWR");
			RegisterNode("VWRButton", "VerticalWallRunning", new string[1] { "WallRunning" }, "LineToVWR");
			RegisterNode("WRBButton", "WallRunBoost", new string[1] { "VerticalWallRunning" }, "LineToWRB");
			foreach (KeyValuePair<string, Button> skillButton in skillButtons)
			{
				string key = skillButton.Key;
				RectTransform component = ((Component)skillButton.Value).GetComponent<RectTransform>();
				if ((Object)(object)component != (Object)null)
				{
					nodeOriginPositions[key] = component.anchoredPosition;
					if (key == "QuickTurning")
					{
						quickTurnRect = component;
					}
				}
				if (!skillLines.TryGetValue(key, out var value))
				{
					continue;
				}
				RectTransform component2 = ((Component)value).GetComponent<RectTransform>();
				if ((Object)(object)component2 != (Object)null)
				{
					lineOriginPositions[key] = component2.anchoredPosition;
					if (((Object)((Component)value).gameObject).name == "LineToSlide")
					{
						lineToSlideRect = component2;
					}
				}
			}
		}

		private void RegisterNode(string buttonObjectName, string configKey, string[] prerequisites, string lineObjectName)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			Transform val = contentTransform.Find(buttonObjectName);
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			Button component = ((Component)val).GetComponent<Button>();
			if ((Object)(object)component == (Object)null)
			{
				return;
			}
			skillButtons[configKey] = component;
			if (prerequisites != null)
			{
				skillDependencies[configKey] = prerequisites;
			}
			if (!string.IsNullOrEmpty(lineObjectName))
			{
				Transform val2 = contentTransform.Find(lineObjectName);
				if ((Object)(object)val2 != (Object)null)
				{
					Image component2 = ((Component)val2).GetComponent<Image>();
					if ((Object)(object)component2 != (Object)null)
					{
						skillLines[configKey] = component2;
					}
				}
			}
			((UnityEvent)component.onClick).AddListener((UnityAction)delegate
			{
				OnNodeInteracted(configKey);
			});
		}

		private bool AreDependenciesMet(string configKey)
		{
			if (!skillDependencies.TryGetValue(configKey, out var value))
			{
				return true;
			}
			string[] array = value;
			foreach (string key in array)
			{
				if (Plugin.SkillConfigs.TryGetValue(key, out var value2))
				{
					if (!((ConfigEntry<bool>)(object)value2).Value)
					{
						return false;
					}
					continue;
				}
				return false;
			}
			return true;
		}

		private void OnNodeInteracted(string configKey)
		{
			//IL_0174: 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_019b: Unknown result type (might be due to invalid IL or missing references)
			if (isAnimatingBranch || !AreDependenciesMet(configKey))
			{
				return;
			}
			if (Plugin.SkillConfigs.TryGetValue(configKey, out var value))
			{
				currentlySelectedSkillKey = configKey;
				pendingPurchaseAnimation = false;
				if ((Object)(object)contentTransform != (Object)null)
				{
					CanvasGroup val = ((Component)contentTransform).GetComponent<CanvasGroup>();
					if ((Object)(object)val == (Object)null)
					{
						val = ((Component)contentTransform).gameObject.AddComponent<CanvasGroup>();
					}
					((MonoBehaviour)this).StartCoroutine(FadeCanvasGroup(val, 1f, 0f, 0.2f));
					((MonoBehaviour)this).StartCoroutine(DeactivateAfterDelay(((Component)contentTransform).gameObject, 0.2f));
				}
				if ((Object)(object)textHeaderComponent != (Object)null)
				{
					((Component)textHeaderComponent).gameObject.SetActive(false);
				}
				if ((Object)(object)headerGroup != (Object)null)
				{
					((Component)headerGroup).gameObject.SetActive(true);
				}
				if ((Object)(object)forwardButtonObj != (Object)null)
				{
					forwardButtonObj.SetActive(false);
				}
				if ((Object)(object)backButtonObj != (Object)null)
				{
					backButtonObj.SetActive(true);
				}
				if ((Object)(object)descriptionPanelObj != (Object)null)
				{
					RectTransform component = descriptionPanelObj.GetComponent<RectTransform>();
					component.anchoredPosition = new Vector2(1000f, 0f);
					descriptionPanelObj.SetActive(true);
					((MonoBehaviour)this).StartCoroutine(AnimateSlide(descriptionPanelObj, component.anchoredPosition, Vector2.zero, 0.3f));
				}
				if ((Object)(object)perkDescriptionText != (Object)null && perkDescriptions.TryGetValue(configKey