Decompiled source of Movement v0.7.3

Movement.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Rendering;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace Pix.Movement;

[BepInPlugin("Pix.Movement", "Movement", "0.7.3")]
public sealed class MovementPlugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(Humanoid), "StartAttack")]
	private static class KnifeAnimLoggingPatch
	{
		private static void Prefix(Humanoid __instance, bool secondaryAttack)
		{
			Player player = (Player)(object)((__instance is Player) ? __instance : null);
			if (!ShouldLogKnifeAnim(player))
			{
				return;
			}
			ItemData val = null;
			try
			{
				val = __instance.GetCurrentWeapon();
			}
			catch
			{
			}
			if (val == null)
			{
				return;
			}
			string text = DescribeWeaponForLog(val);
			if (!WeaponMatchesKnifeSkoll(val))
			{
				return;
			}
			Attack val2 = (secondaryAttack ? val.m_shared.m_secondaryAttack : val.m_shared.m_attack);
			if (val2 == null)
			{
				ManualLogSource log = Log;
				if (log != null)
				{
					log.LogInfo((object)$"[MV] KnifeSkoll weapon={text}, secondary={secondaryAttack}, but attack is NULL");
				}
				return;
			}
			string text2 = val2.m_attackAnimation ?? "<null>";
			int attackChainLevels = val2.m_attackChainLevels;
			int attackRandomAnimations = val2.m_attackRandomAnimations;
			string text3 = $"[MV] KnifeSkoll attack -> weapon={text}, secondary={secondaryAttack}, animation=\"{text2}\", chainLevels={attackChainLevels}, randomAnims={attackRandomAnimations}";
			ManualLogSource log2 = Log;
			if (log2 != null)
			{
				log2.LogInfo((object)text3);
			}
			lock (_knifeAnimLogQueue)
			{
				_knifeAnimLogQueue.Enqueue("Knife Attack: " + text2);
				_knifeAnimLogQueue.Enqueue($"Secondary: {secondaryAttack}, Chain: {attackChainLevels}, Random: {attackRandomAnimations}");
				if (_knifeAnimLogQueue.Count > 10)
				{
					_knifeAnimLogQueue.Dequeue();
					_knifeAnimLogQueue.Dequeue();
				}
				_knifeAnimLogExpiry = Time.time + 8f;
			}
		}
	}

	[CompilerGenerated]
	private sealed class <CoBrakeHorizontal>d__212 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Player p;

		public float seconds;

		public float toPct;

		private Rigidbody <rb>5__1;

		private Vector3 <start>5__2;

		private Vector3 <startHoriz>5__3;

		private float <t>5__4;

		private float <a>5__5;

		private Vector3 <targetHoriz>5__6;

		private Vector3 <newHoriz>5__7;

		private Vector3 <cur>5__8;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CoBrakeHorizontal>d__212(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<rb>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: 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_011b: 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)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<rb>5__1 = GetRigidbody(p);
				if ((Object)(object)<rb>5__1 == (Object)null)
				{
					return false;
				}
				<start>5__2 = <rb>5__1.linearVelocity;
				<startHoriz>5__3 = new Vector3(<start>5__2.x, 0f, <start>5__2.z);
				<t>5__4 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__4 < seconds)
			{
				if ((Object)(object)p == (Object)null || (Object)(object)<rb>5__1 == (Object)null)
				{
					return false;
				}
				<t>5__4 += Time.deltaTime;
				<a>5__5 = Mathf.Clamp01(<t>5__4 / seconds);
				<targetHoriz>5__6 = <startHoriz>5__3 * toPct;
				<newHoriz>5__7 = Vector3.Lerp(<startHoriz>5__3, <targetHoriz>5__6, <a>5__5);
				<cur>5__8 = <rb>5__1.linearVelocity;
				<cur>5__8.x = <newHoriz>5__7.x;
				<cur>5__8.z = <newHoriz>5__7.z;
				<rb>5__1.linearVelocity = <cur>5__8;
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <CoDashImpactAfter>d__207 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Player p;

		public float delaySeconds;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CoDashImpactAfter>d__207(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Expected O, but got Unknown
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (delaySeconds > 0f)
				{
					<>2__current = (object)new WaitForSeconds(delaySeconds);
					<>1__state = 1;
					return true;
				}
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if ((Object)(object)p == (Object)null)
			{
				return false;
			}
			TryDashImpactNow(p);
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <CoGroundBurst>d__205 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public Player p;

		public Vector3 dir;

		public float totalImpulse;

		public float seconds;

		private Rigidbody <rb>5__1;

		private float <t>5__2;

		private float <dt>5__3;

		private float <step>5__4;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <CoGroundBurst>d__205(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<rb>5__1 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				<rb>5__1 = GetRigidbody(p);
				if ((Object)(object)<rb>5__1 == (Object)null)
				{
					return false;
				}
				dir.y = 0f;
				if (((Vector3)(ref dir)).sqrMagnitude < 0.0001f)
				{
					return false;
				}
				((Vector3)(ref dir)).Normalize();
				<t>5__2 = 0f;
				break;
			case 1:
				<>1__state = -1;
				break;
			}
			if (<t>5__2 < seconds)
			{
				if ((Object)(object)p == (Object)null || (Object)(object)<rb>5__1 == (Object)null)
				{
					return false;
				}
				<dt>5__3 = Time.deltaTime;
				<t>5__2 += <dt>5__3;
				<step>5__4 = totalImpulse / seconds * <dt>5__3;
				<rb>5__1.AddForce(dir * <step>5__4, (ForceMode)2);
				<>2__current = null;
				<>1__state = 1;
				return true;
			}
			return false;
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <LoadAudioClipsCoroutine>d__252 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public MovementPlugin <>4__this;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <LoadAudioClipsCoroutine>d__252(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			switch (<>1__state)
			{
			default:
				return false;
			case 0:
				<>1__state = -1;
				if (!CfgAudioEnabled.Value)
				{
					return false;
				}
				<>2__current = <>4__this.LoadEmbeddedClip("Resources.SFX.dash.ogg", delegate(AudioClip c)
				{
					_clipDash = c;
				});
				<>1__state = 1;
				return true;
			case 1:
				<>1__state = -1;
				<>2__current = <>4__this.LoadEmbeddedClip("Resources.SFX.slide.ogg", delegate(AudioClip c)
				{
					ClipSlide = c;
				});
				<>1__state = 2;
				return true;
			case 2:
				<>1__state = -1;
				<>2__current = <>4__this.LoadEmbeddedClip("Resources.SFX.roll.ogg", delegate(AudioClip c)
				{
					_clipRoll = c;
				});
				<>1__state = 3;
				return true;
			case 3:
				<>1__state = -1;
				<>2__current = <>4__this.LoadEmbeddedClip("Resources.SFX.overdrive.ogg", delegate(AudioClip c)
				{
					_clipOverdrive = c;
				});
				<>1__state = 4;
				return true;
			case 4:
				<>1__state = -1;
				<>2__current = <>4__this.LoadEmbeddedClip("Resources.SFX.blink.ogg", delegate(AudioClip c)
				{
					_clipBlink = c;
				});
				<>1__state = 5;
				return true;
			case 5:
				<>1__state = -1;
				<>2__current = <>4__this.LoadEmbeddedClip("Resources.SFX.blink_fizzle.ogg", delegate(AudioClip c)
				{
					_clipBlock = c;
				});
				<>1__state = 6;
				return true;
			case 6:
				<>1__state = -1;
				return false;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	[CompilerGenerated]
	private sealed class <LoadEmbeddedClip>d__253 : IEnumerator<object>, IDisposable, IEnumerator
	{
		private int <>1__state;

		private object <>2__current;

		public string resourceName;

		public Action<AudioClip> assign;

		public MovementPlugin <>4__this;

		private byte[] <oggData>5__1;

		private string <tempPath>5__2;

		private Assembly <asm>5__3;

		private string[] <names>5__4;

		private string <fullName>5__5;

		private int <i>5__6;

		private Stream <s>5__7;

		private MemoryStream <ms>5__8;

		private string <url>5__9;

		private UnityWebRequest <www>5__10;

		private AudioClip <clip>5__11;

		object IEnumerator<object>.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		object IEnumerator.Current
		{
			[DebuggerHidden]
			get
			{
				return <>2__current;
			}
		}

		[DebuggerHidden]
		public <LoadEmbeddedClip>d__253(int <>1__state)
		{
			this.<>1__state = <>1__state;
		}

		[DebuggerHidden]
		void IDisposable.Dispose()
		{
			int num = <>1__state;
			if ((uint)(num - -4) <= 1u || num == 1)
			{
				try
				{
					if (num == -4 || num == 1)
					{
						try
						{
						}
						finally
						{
							<>m__Finally2();
						}
					}
				}
				finally
				{
					<>m__Finally1();
				}
			}
			<oggData>5__1 = null;
			<tempPath>5__2 = null;
			<asm>5__3 = null;
			<names>5__4 = null;
			<fullName>5__5 = null;
			<s>5__7 = null;
			<ms>5__8 = null;
			<url>5__9 = null;
			<www>5__10 = null;
			<clip>5__11 = null;
			<>1__state = -2;
		}

		private bool MoveNext()
		{
			try
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<oggData>5__1 = null;
					try
					{
						<asm>5__3 = Assembly.GetExecutingAssembly();
						<names>5__4 = <asm>5__3.GetManifestResourceNames();
						<fullName>5__5 = null;
						<i>5__6 = 0;
						while (<i>5__6 < <names>5__4.Length)
						{
							if (<names>5__4[<i>5__6].EndsWith(resourceName, StringComparison.OrdinalIgnoreCase) || <names>5__4[<i>5__6] == resourceName)
							{
								<fullName>5__5 = <names>5__4[<i>5__6];
								break;
							}
							<i>5__6++;
						}
						if (<fullName>5__5 != null)
						{
							<s>5__7 = <asm>5__3.GetManifestResourceStream(<fullName>5__5);
							try
							{
								if (<s>5__7 != null)
								{
									<ms>5__8 = new MemoryStream();
									try
									{
										<s>5__7.CopyTo(<ms>5__8);
										<oggData>5__1 = <ms>5__8.ToArray();
									}
									finally
									{
										if (<ms>5__8 != null)
										{
											((IDisposable)<ms>5__8).Dispose();
										}
									}
									<ms>5__8 = null;
								}
							}
							finally
							{
								if (<s>5__7 != null)
								{
									((IDisposable)<s>5__7).Dispose();
								}
							}
							<s>5__7 = null;
						}
						<asm>5__3 = null;
						<names>5__4 = null;
						<fullName>5__5 = null;
					}
					catch
					{
						<oggData>5__1 = null;
					}
					if (<oggData>5__1 == null || <oggData>5__1.Length == 0)
					{
						return false;
					}
					<tempPath>5__2 = Path.Combine(Path.GetTempPath(), "mv_" + Guid.NewGuid().ToString() + ".ogg");
					<>1__state = -3;
					File.WriteAllBytes(<tempPath>5__2, <oggData>5__1);
					<url>5__9 = "file:///" + <tempPath>5__2.Replace("\\", "/");
					<www>5__10 = UnityWebRequestMultimedia.GetAudioClip(<url>5__9, (AudioType)14);
					<>1__state = -4;
					<>2__current = <www>5__10.SendWebRequest();
					<>1__state = 1;
					return true;
				case 1:
					<>1__state = -4;
					<clip>5__11 = DownloadHandlerAudioClip.GetContent(<www>5__10);
					if ((Object)(object)<clip>5__11 != (Object)null)
					{
						assign(<clip>5__11);
					}
					<clip>5__11 = null;
					<>m__Finally2();
					<www>5__10 = null;
					<url>5__9 = null;
					<>m__Finally1();
					return false;
				}
			}
			catch
			{
				//try-fault
				((IDisposable)this).Dispose();
				throw;
			}
		}

		bool IEnumerator.MoveNext()
		{
			//ILSpy generated this explicit interface implementation from .override directive in MoveNext
			return this.MoveNext();
		}

		private void <>m__Finally1()
		{
			<>1__state = -1;
			try
			{
				if (File.Exists(<tempPath>5__2))
				{
					File.Delete(<tempPath>5__2);
				}
			}
			catch
			{
			}
		}

		private void <>m__Finally2()
		{
			<>1__state = -3;
			if (<www>5__10 != null)
			{
				((IDisposable)<www>5__10).Dispose();
			}
		}

		[DebuggerHidden]
		void IEnumerator.Reset()
		{
			throw new NotSupportedException();
		}
	}

	public const string PluginGuid = "Pix.Movement";

	public const string PluginName = "Movement";

	public const string PluginVersion = "0.7.3";

	internal static ManualLogSource Log;

	internal static MovementPlugin Instance;

	private static bool _loggedDashImpactException;

	private static bool _eitrApiResolved;

	private static MethodInfo _miPlayerGetEitr;

	private static MethodInfo _miPlayerUseEitr;

	private static bool _loggedEitrApiMissing;

	private const string NameDash = "Dash";

	private const string NameOverdrive = "Overdrive";

	private const string NameDoubleJump = "Double Jump";

	private const string NameRoll = "Landing Roll";

	private const string NameWallKick = "Wall Kick";

	private const string NameBlink = "Blink";

	private const int SfxDash = 1;

	private const int SfxSlide = 2;

	private const int SfxRoll = 4;

	private const int SfxOverdrive = 5;

	private const int SfxBlink = 6;

	private const int SfxBlock = 7;

	private static readonly int ZdoDashEndMs = "MV_CD_DashEndMs".GetStableHashCode();

	private static readonly int ZdoDashImpactEndMs = "MV_CD_DashImpactEndMs".GetStableHashCode();

	private static readonly int ZdoOverdriveEndMs = "MV_CD_OverdriveEndMs".GetStableHashCode();

	private static readonly int ZdoRollIntentEndMs = "MV_RollIntentEndMs".GetStableHashCode();

	private static readonly int ZdoRollArmedInAir = "MV_RollArmedInAir".GetStableHashCode();

	private static readonly int ZdoRollCooldownEndMs = "MV_CD_RollEndMs".GetStableHashCode();

	private static readonly int ZdoBlinkEndMs = "MV_CD_BlinkEndMs".GetStableHashCode();

	private static readonly int ZdoSlamNoFallUntilMs = "MV_SlamNoFallUntilMs".GetStableHashCode();

	private static ConfigEntry<KeyCode> CfgModKey;

	private static ConfigEntry<KeyCode> CfgDashKey;

	private static ConfigEntry<KeyCode> CfgOverdriveKey;

	private static ConfigEntry<KeyCode> CfgBlinkKey;

	private static ConfigEntry<bool> CfgDashEnabled;

	private static ConfigEntry<bool> CfgOverdriveEnabled;

	private static ConfigEntry<bool> CfgDashImpactEnabled;

	private static ConfigEntry<float> CfgDashImpactRange;

	private static ConfigEntry<float> CfgDashImpactConeDeg;

	private static ConfigEntry<float> CfgDashImpactBluntDamage;

	private static ConfigEntry<float> CfgDashImpactPushForce;

	private static ConfigEntry<float> CfgDashImpactCooldownSeconds;

	private static ConfigEntry<bool> CfgDashImpactHitPlayers;

	private static ConfigEntry<bool> CfgDashImpactBlockVfxEnabled;

	private static ConfigEntry<string> CfgDashImpactBlockVfxPrefab;

	private static ConfigEntry<bool> CfgDashImpactBlockSfxEnabled;

	private static ConfigEntry<string> CfgDashImpactBlockSfxPrefab;

	private static ConfigEntry<bool> CfgRequireProgression;

	private static ConfigEntry<bool> CfgShowLockedMessages;

	private static ConfigEntry<string> CfgDashKeyRequired;

	private static ConfigEntry<string> CfgOverdriveKeyRequired;

	private static ConfigEntry<string> CfgDoubleJumpKeyRequired;

	private static ConfigEntry<string> CfgRollKeyRequired;

	private static ConfigEntry<string> CfgWallKickKeyRequired;

	private static ConfigEntry<string> CfgBlinkKeyRequired;

	private static ConfigEntry<float> CfgDashCooldownSeconds;

	private static ConfigEntry<float> CfgDashStaminaCost;

	private static ConfigEntry<float> CfgDashPowerAir;

	private static ConfigEntry<bool> CfgDashAllowInAir;

	private static ConfigEntry<float> CfgDashGroundTotalMultiplier;

	private static ConfigEntry<float> CfgDashGroundBurstSeconds;

	private static ConfigEntry<bool> CfgDashDisallowEncumbered;

	private static ConfigEntry<float> CfgOverdriveDurationSeconds;

	private static ConfigEntry<float> CfgOverdriveCooldownMinutes;

	private static ConfigEntry<float> CfgOverdriveSpeedMultiplier;

	private static ConfigEntry<bool> CfgOverdriveAllowSwimming;

	private static ConfigEntry<bool> CfgDoubleJumpEnabled;

	private static ConfigEntry<float> CfgDoubleJumpStaminaCost;

	private static ConfigEntry<float> CfgDoubleJumpUpwardPower;

	private static ConfigEntry<bool> CfgDoubleJumpAllowWhenEncumbered;

	private static ConfigEntry<bool> CfgRollEnabled;

	private static ConfigEntry<int> CfgRollTimingWindowMs;

	private static ConfigEntry<float> CfgRollMinFallSpeedAbs;

	private static ConfigEntry<float> CfgRollDamageReductionPercent;

	private static ConfigEntry<float> CfgRollForwardBoost;

	private static ConfigEntry<float> CfgRollStaminaCost;

	private static ConfigEntry<float> CfgRollCooldownSeconds;

	private static ConfigEntry<bool> CfgRollTriggerDodgeAnim;

	private static ConfigEntry<float> CfgRollHealFlat;

	private static ConfigEntry<float> CfgRollHealPctMax;

	private static ConfigEntry<float> CfgRollHealFromPreventedDamageMultiplier;

	private static ConfigEntry<bool> CfgWallKickEnabled;

	private static ConfigEntry<float> CfgWallKickRange;

	private static ConfigEntry<float> CfgWallKickMaxNormalY;

	private static ConfigEntry<float> CfgWallKickUpwardPower;

	private static ConfigEntry<float> CfgWallKickOutwardPower;

	private static ConfigEntry<float> CfgWallKickStaminaCost;

	private static ConfigEntry<float> CfgWallKickCooldownSeconds;

	private static ConfigEntry<bool> CfgWallKickAllowWhenEncumbered;

	private static ConfigEntry<bool> CfgBlinkEnabled;

	private static ConfigEntry<float> CfgBlinkCooldownSeconds;

	private static ConfigEntry<float> CfgBlinkStaminaCost;

	private static ConfigEntry<float> CfgBlinkEitrCost;

	private static ConfigEntry<float> CfgBlinkRange;

	private static ConfigEntry<float> CfgBlinkBackoff;

	private static ConfigEntry<bool> CfgBlinkAllowInAir;

	private static ConfigEntry<float> CfgBlinkAirMultiplier;

	private static ConfigEntry<float> CfgBlinkFallbackBurstPowerAir;

	private static ConfigEntry<float> CfgBlinkFallbackGroundMultiplier;

	private static ConfigEntry<float> CfgBlinkFallbackBrakeSeconds;

	private static ConfigEntry<float> CfgBlinkFallbackBrakeToPct;

	private static ConfigEntry<bool> CfgVfxEnabled;

	private static ConfigEntry<string> CfgDashVfxPrefab;

	private static ConfigEntry<string> CfgOverdriveVfxPrefab;

	private static ConfigEntry<string> CfgDoubleJumpVfxPrefab;

	private static ConfigEntry<string> CfgRollVfxPrefab;

	private static ConfigEntry<string> CfgWallKickVfxPrefab;

	private static ConfigEntry<string> CfgBlinkVfxStartPrefab;

	private static ConfigEntry<string> CfgBlinkVfxEndPrefab;

	private static ConfigEntry<string> CfgBlinkVfxFizzlePrefab;

	private static ConfigEntry<bool> CfgVfxDebugLogging;

	private static ConfigEntry<bool> CfgAudioEnabled;

	private static ConfigEntry<float> CfgAudioVolume;

	private static ConfigEntry<string> CfgAudioFolder;

	private static ConfigEntry<string> CfgSfxDashFile;

	private static ConfigEntry<string> CfgSfxRollFile;

	private static ConfigEntry<string> CfgSfxOverdriveFile;

	private static ConfigEntry<string> CfgSfxBlinkFile;

	private static ConfigEntry<string> CfgSfxBlockFile;

	private static ConfigEntry<string> CfgSfxSlideFile;

	private static ConfigEntry<bool> CfgDebugPopups;

	private static ConfigEntry<bool> CfgKnifeAnimLogging;

	private static ConfigEntry<bool> CfgUiEnabled;

	private static ConfigEntry<bool> CfgUiShowDash;

	private static ConfigEntry<bool> CfgUiShowOverdrive;

	private static ConfigEntry<bool> CfgUiShowBlink;

	private static ConfigEntry<int> CfgUiBoxWidth;

	private static ConfigEntry<int> CfgUiBoxHeight;

	private static ConfigEntry<int> CfgUiFontSize;

	private static ConfigEntry<bool> CfgUiDebugLogging;

	private static ConfigEntry<float> CfgUiDashX;

	private static ConfigEntry<float> CfgUiDashY;

	private static ConfigEntry<float> CfgUiOverdriveX;

	private static ConfigEntry<float> CfgUiOverdriveY;

	private static ConfigEntry<float> CfgUiBlinkX;

	private static ConfigEntry<float> CfgUiBlinkY;

	private static Rect _uiDashRect;

	private static Rect _uiOverdriveRect;

	private static Rect _uiBlinkRect;

	private static bool _uiRectsInitialized;

	private static bool _uiDirty;

	private static GUIStyle _uiLabelStyle;

	private static GUIStyle _uiTitleStyle;

	private static int _uiStyleFontSize = -1;

	private static GUISkin _uiStyleSkin;

	private static bool _uiStylesReady;

	private static Player _uiPlayer;

	private static readonly int _uiWindowDashId = 12001;

	private static readonly int _uiWindowOverdriveId = 12002;

	private static readonly int _uiWindowBlinkId = 12003;

	internal const string OverdriveSeName = "mv_overdrive";

	internal static readonly int OverdriveSeHash = "mv_overdrive".GetStableHashCode();

	internal static SE_Stats OverdriveSe;

	private static readonly FieldRef<Humanoid, ItemData> FR_Humanoid_leftItem = AccessTools.FieldRefAccess<Humanoid, ItemData>("m_leftItem");

	private static FieldInfo FI_Shared_perfectBlockEffect;

	private static FieldInfo FI_Shared_parryEffect;

	private static FieldInfo FI_Shared_blockEffect;

	private static AudioClip _clipDash;

	internal static AudioClip ClipSlide;

	private static AudioClip _clipRoll;

	private static AudioClip _clipOverdrive;

	private static AudioClip _clipBlink;

	private static AudioClip _clipBlock;

	private static readonly Queue<string> _knifeAnimLogQueue = new Queue<string>();

	private static float _knifeAnimLogExpiry;

	private const float KnifeAnimLogDisplayDuration = 8f;

	private static GameObject _cachedDashImpactVfx;

	private static GameObject _cachedDashImpactSfx;

	private static bool _audioLoadStarted;

	private static readonly Dictionary<string, GameObject> _vfxCache = new Dictionary<string, GameObject>(StringComparer.OrdinalIgnoreCase);

	private bool _prevGrounded;

	private bool _doubleJumpUsed;

	private bool _wallKickUsed;

	private float _wallKickCooldownEnd;

	private int _rollSpacebarPressCount;

	private static bool _debugBypassAll;

	private static readonly HashSet<string> _debugUnlocks = new HashSet<string>(StringComparer.OrdinalIgnoreCase);

	private static readonly object _dodgeInvokeLock = new object();

	private static bool _dodgeMethodResolved;

	private static MethodInfo _dodgeMethod;

	private static readonly object _blinkInvokeLock = new object();

	private static bool _blinkMethodResolved;

	private static MethodInfo _teleportToMethodBool;

	private static void LogOnce(ref bool flag, string msg, Exception ex = null)
	{
		if (flag)
		{
			return;
		}
		flag = true;
		try
		{
			if (Log != null)
			{
				if (ex != null)
				{
					Log.LogWarning((object)("[MV] " + msg + ": " + ex.GetType().Name + " " + ex.Message));
				}
				else
				{
					Log.LogWarning((object)("[MV] " + msg));
				}
			}
		}
		catch
		{
		}
	}

	private static void ResolveEitrApi()
	{
		if (_eitrApiResolved)
		{
			return;
		}
		_eitrApiResolved = true;
		try
		{
			_miPlayerGetEitr = AccessTools.Method(typeof(Player), "GetEitr", (Type[])null, (Type[])null);
			_miPlayerUseEitr = AccessTools.Method(typeof(Player), "UseEitr", new Type[1] { typeof(float) }, (Type[])null);
			if (_miPlayerGetEitr == null || _miPlayerUseEitr == null)
			{
				LogOnce(ref _loggedEitrApiMissing, "Eitr API not found; Blink EitrCost will be ignored");
			}
		}
		catch (Exception ex)
		{
			LogOnce(ref _loggedEitrApiMissing, "Failed resolving Eitr API; Blink EitrCost will be ignored", ex);
		}
	}

	private static bool PlayerHasEitr(Player p, float cost)
	{
		if ((Object)(object)p == (Object)null)
		{
			return false;
		}
		if (cost <= 0f)
		{
			return true;
		}
		ResolveEitrApi();
		if (_miPlayerGetEitr == null)
		{
			return true;
		}
		try
		{
			float num = (float)_miPlayerGetEitr.Invoke(p, null);
			return num >= cost;
		}
		catch (Exception ex)
		{
			LogOnce(ref _loggedEitrApiMissing, "Failed reading Eitr; Blink EitrCost will be ignored", ex);
			return true;
		}
	}

	private static void PlayerUseEitr(Player p, float cost)
	{
		if ((Object)(object)p == (Object)null || cost <= 0f)
		{
			return;
		}
		ResolveEitrApi();
		if (_miPlayerUseEitr == null)
		{
			return;
		}
		try
		{
			_miPlayerUseEitr.Invoke(p, new object[1] { cost });
		}
		catch (Exception ex)
		{
			LogOnce(ref _loggedEitrApiMissing, "Failed consuming Eitr; Blink EitrCost will be ignored", ex);
		}
	}

	private void Awake()
	{
		//IL_0033: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Expected O, but got Unknown
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		BindConfig();
		Slam.Init(this);
		Slide.Init(this);
		ShieldSurf.Init(this);
		Harmony val = new Harmony("Pix.Movement");
		val.PatchAll(typeof(MovementPlugin));
		val.PatchAll(typeof(ObjectDbPatches));
		val.PatchAll(typeof(CharacterDamagePatch));
		val.PatchAll(typeof(TerminalPatches));
		val.PatchAll(typeof(CharacterJumpPatch));
		val.PatchAll(typeof(Slam));
		val.PatchAll(typeof(Slide));
		val.PatchAll(typeof(ShieldSurf));
		if (!_audioLoadStarted)
		{
			_audioLoadStarted = true;
			((MonoBehaviour)this).StartCoroutine(LoadAudioClipsCoroutine());
		}
	}

	private void Update()
	{
		//IL_00af: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_010d: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_020c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)ZNet.instance == (Object)null)
		{
			return;
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null || IsInputBlocked())
		{
			return;
		}
		bool flag = ((Character)localPlayer).IsOnGround();
		if (flag && !_prevGrounded)
		{
			_doubleJumpUsed = false;
			_wallKickUsed = false;
			_rollSpacebarPressCount = 0;
			ZDO playerZdo = GetPlayerZdo(localPlayer);
			if (playerZdo != null)
			{
				playerZdo.Set(ZdoRollArmedInAir, 0, false);
			}
			_wallKickCooldownEnd = 0f;
		}
		_prevGrounded = flag;
		Slam.Tick(localPlayer);
		Slide.Tick(localPlayer, CfgModKey.Value);
		ShieldSurf.Tick(localPlayer, CfgModKey.Value);
		if (Slide.IsSliding || ShieldSurf.IsSurfing)
		{
			return;
		}
		if (CfgBlinkEnabled.Value && Input.GetKeyDown(CfgBlinkKey.Value) && Input.GetKey(CfgModKey.Value))
		{
			Host_TryBlink(localPlayer);
		}
		else if (!flag && Input.GetKeyDown((KeyCode)32) && Input.GetKey((KeyCode)304))
		{
			_rollSpacebarPressCount++;
			if (_rollSpacebarPressCount <= 2)
			{
				TryArmLandingRoll(localPlayer);
			}
		}
		else
		{
			if (!flag && Input.GetKeyDown((KeyCode)32) && TryDoWallKick(localPlayer))
			{
				return;
			}
			if (Input.GetKeyDown(CfgDashKey.Value) && Input.GetKey(CfgModKey.Value))
			{
				if (CfgDashEnabled == null || CfgDashEnabled.Value)
				{
					Host_TryDash(localPlayer);
				}
			}
			else
			{
				if (!Input.GetKeyDown(CfgOverdriveKey.Value) || !Input.GetKey(CfgModKey.Value))
				{
					return;
				}
				try
				{
					if (CfgOverdriveEnabled != null && !CfgOverdriveEnabled.Value)
					{
						return;
					}
				}
				catch
				{
				}
				Host_TryOverdrive(localPlayer);
			}
		}
	}

	private static void Ui_EnsureStyles()
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b3: Expected O, but got Unknown
		try
		{
			GUISkin skin = GUI.skin;
			int num = Mathf.Clamp(CfgUiFontSize.Value, 10, 36);
			if (!_uiStylesReady || !((Object)(object)_uiStyleSkin == (Object)(object)skin) || _uiStyleFontSize != num || _uiLabelStyle == null || _uiTitleStyle == null)
			{
				_uiStyleSkin = skin;
				_uiStyleFontSize = num;
				_uiLabelStyle = new GUIStyle(GUI.skin.label)
				{
					alignment = (TextAnchor)4,
					fontSize = _uiStyleFontSize
				};
				_uiLabelStyle.normal.textColor = Color.white;
				_uiTitleStyle = new GUIStyle(_uiLabelStyle)
				{
					fontStyle = (FontStyle)1
				};
				_uiStylesReady = true;
			}
		}
		catch
		{
			_uiStylesReady = false;
			_uiLabelStyle = null;
			_uiTitleStyle = null;
			_uiStyleFontSize = -1;
			_uiStyleSkin = null;
		}
	}

	private static void Ui_DrawCdWindowDash(int id)
	{
		Instance?.Ui_DrawCdWindow(id, "Dash", _uiPlayer, ZdoDashEndMs, _uiLabelStyle, _uiTitleStyle);
	}

	private static void Ui_DrawCdWindowBlink(int id)
	{
		Instance?.Ui_DrawCdWindow(id, "Blink", _uiPlayer, ZdoBlinkEndMs, _uiLabelStyle, _uiTitleStyle);
	}

	private static void Ui_DrawCdWindowOverdrive(int id)
	{
		Instance?.Ui_DrawOverdriveCdWindow(id, _uiPlayer, _uiLabelStyle, _uiTitleStyle);
	}

	private void OnGUI()
	{
		//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Invalid comparison between Unknown and I4
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_0114: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Expected O, but got Unknown
		//IL_011e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0123: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0158: Expected O, but got Unknown
		//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_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Expected O, but got Unknown
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		if (CfgUiEnabled == null || !CfgUiEnabled.Value)
		{
			return;
		}
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null)
		{
			return;
		}
		if (!_uiRectsInitialized)
		{
			Ui_InitRects();
		}
		int num = Mathf.Clamp(CfgUiBoxWidth.Value, 80, 600);
		int num2 = Mathf.Clamp(CfgUiBoxHeight.Value, 30, 200);
		((Rect)(ref _uiDashRect)).width = num;
		((Rect)(ref _uiDashRect)).height = num2;
		((Rect)(ref _uiOverdriveRect)).width = num;
		((Rect)(ref _uiOverdriveRect)).height = num2;
		((Rect)(ref _uiBlinkRect)).width = num;
		((Rect)(ref _uiBlinkRect)).height = num2;
		Ui_EnsureStyles();
		if (_uiLabelStyle == null || _uiTitleStyle == null)
		{
			return;
		}
		_uiPlayer = localPlayer;
		try
		{
			if (CfgUiShowDash.Value)
			{
				_uiDashRect = GUI.Window(_uiWindowDashId, _uiDashRect, new WindowFunction(Ui_DrawCdWindowDash), GUIContent.none);
			}
			if (CfgUiShowOverdrive.Value)
			{
				_uiOverdriveRect = GUI.Window(_uiWindowOverdriveId, _uiOverdriveRect, new WindowFunction(Ui_DrawCdWindowOverdrive), GUIContent.none);
			}
			if (CfgUiShowBlink.Value)
			{
				_uiBlinkRect = GUI.Window(_uiWindowBlinkId, _uiBlinkRect, new WindowFunction(Ui_DrawCdWindowBlink), GUIContent.none);
			}
		}
		catch (Exception ex)
		{
			if (CfgUiDebugLogging != null && CfgUiDebugLogging.Value)
			{
				Log.LogWarning((object)("[MV] Cooldown UI draw error: " + ex));
			}
		}
		if (_uiDirty && Event.current != null && (int)Event.current.type == 1)
		{
			_uiDirty = false;
			Ui_SaveRectsToConfig();
		}
		DrawKnifeAnimLog();
	}

	private void DrawKnifeAnimLog()
	{
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0078: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Unknown result type (might be due to invalid IL or missing references)
		//IL_008a: Expected O, but got Unknown
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
		if (CfgKnifeAnimLogging == null || !CfgKnifeAnimLogging.Value || Time.time > _knifeAnimLogExpiry)
		{
			return;
		}
		lock (_knifeAnimLogQueue)
		{
			if (_knifeAnimLogQueue.Count != 0)
			{
				GUIStyle val = new GUIStyle(GUI.skin.box)
				{
					fontSize = 16,
					alignment = (TextAnchor)0,
					wordWrap = false
				};
				val.normal.textColor = Color.yellow;
				float num = 100f;
				float num2 = 22f;
				string[] array = _knifeAnimLogQueue.ToArray();
				Rect val2 = default(Rect);
				for (int i = 0; i < array.Length; i++)
				{
					((Rect)(ref val2))..ctor(20f, num + (float)i * num2, 600f, num2);
					GUI.Box(val2, array[i], val);
				}
			}
		}
	}

	private static void Ui_InitRects()
	{
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_006f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		//IL_0096: Unknown result type (might be due to invalid IL or missing references)
		_uiRectsInitialized = true;
		int num = Mathf.Clamp(CfgUiBoxWidth.Value, 80, 600);
		int num2 = Mathf.Clamp(CfgUiBoxHeight.Value, 30, 200);
		_uiDashRect = new Rect(CfgUiDashX.Value, CfgUiDashY.Value, (float)num, (float)num2);
		_uiOverdriveRect = new Rect(CfgUiOverdriveX.Value, CfgUiOverdriveY.Value, (float)num, (float)num2);
		_uiBlinkRect = new Rect(CfgUiBlinkX.Value, CfgUiBlinkY.Value, (float)num, (float)num2);
	}

	private static void Ui_SaveRectsToConfig()
	{
		try
		{
			if (Mathf.Abs(CfgUiDashX.Value - ((Rect)(ref _uiDashRect)).x) > 0.5f)
			{
				CfgUiDashX.Value = ((Rect)(ref _uiDashRect)).x;
			}
			if (Mathf.Abs(CfgUiDashY.Value - ((Rect)(ref _uiDashRect)).y) > 0.5f)
			{
				CfgUiDashY.Value = ((Rect)(ref _uiDashRect)).y;
			}
			if (Mathf.Abs(CfgUiOverdriveX.Value - ((Rect)(ref _uiOverdriveRect)).x) > 0.5f)
			{
				CfgUiOverdriveX.Value = ((Rect)(ref _uiOverdriveRect)).x;
			}
			if (Mathf.Abs(CfgUiOverdriveY.Value - ((Rect)(ref _uiOverdriveRect)).y) > 0.5f)
			{
				CfgUiOverdriveY.Value = ((Rect)(ref _uiOverdriveRect)).y;
			}
			if (Mathf.Abs(CfgUiBlinkX.Value - ((Rect)(ref _uiBlinkRect)).x) > 0.5f)
			{
				CfgUiBlinkX.Value = ((Rect)(ref _uiBlinkRect)).x;
			}
			if (Mathf.Abs(CfgUiBlinkY.Value - ((Rect)(ref _uiBlinkRect)).y) > 0.5f)
			{
				CfgUiBlinkY.Value = ((Rect)(ref _uiBlinkRect)).y;
			}
			MovementPlugin instance = Instance;
			if (instance != null)
			{
				ConfigFile config = ((BaseUnityPlugin)instance).Config;
				if (config != null)
				{
					config.Save();
				}
			}
		}
		catch
		{
		}
	}

	private void Ui_DrawCdWindow(int id, string titleText, Player p, int zdoKeyEndMsHash, GUIStyle label, GUIStyle title)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		Color backgroundColor = GUI.backgroundColor;
		Color color = GUI.color;
		GUI.backgroundColor = new Color(0f, 0f, 0f, 0.55f);
		GUI.color = new Color(1f, 1f, 1f, 0.9f);
		GUI.Box(new Rect(0f, 0f, (float)Mathf.Clamp(CfgUiBoxWidth.Value, 80, 600), (float)Mathf.Clamp(CfgUiBoxHeight.Value, 30, 200)), GUIContent.none);
		GUI.backgroundColor = backgroundColor;
		GUI.color = color;
		float num = Ui_GetCooldownRemainingSeconds(p, zdoKeyEndMsHash);
		string text = ((num > 0.01f) ? (num.ToString("0.0") + "s") : "READY");
		float num2 = 6f;
		float num3 = Mathf.Clamp(CfgUiBoxWidth.Value, 80, 600);
		float num4 = Mathf.Clamp(CfgUiBoxHeight.Value, 30, 200);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(num2, num2, num3 - num2 * 2f, num4 - num2 * 2f);
		Rect val2 = default(Rect);
		((Rect)(ref val2))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height * 0.5f);
		Rect val3 = default(Rect);
		((Rect)(ref val3))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y + ((Rect)(ref val)).height * 0.5f, ((Rect)(ref val)).width, ((Rect)(ref val)).height * 0.5f);
		GUI.Label(val2, titleText, title);
		GUI.Label(val3, text, label);
		Ui_HandleAltDrag(id);
	}

	private void Ui_DrawOverdriveCdWindow(int id, Player p, GUIStyle label, GUIStyle title)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009a: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
		Color backgroundColor = GUI.backgroundColor;
		Color color = GUI.color;
		GUI.backgroundColor = new Color(0f, 0f, 0f, 0.55f);
		GUI.color = new Color(1f, 1f, 1f, 0.9f);
		GUI.Box(new Rect(0f, 0f, (float)Mathf.Clamp(CfgUiBoxWidth.Value, 80, 600), (float)Mathf.Clamp(CfgUiBoxHeight.Value, 30, 200)), GUIContent.none);
		GUI.backgroundColor = backgroundColor;
		GUI.color = color;
		float num = Ui_GetCooldownRemainingSeconds(p, ZdoOverdriveEndMs);
		bool flag = false;
		try
		{
			SEMan sEMan = ((Character)p).GetSEMan();
			if (sEMan != null)
			{
				flag = sEMan.HaveStatusEffect(OverdriveSeHash);
			}
		}
		catch
		{
		}
		string text = "Overdrive";
		string text2 = ((!flag) ? ((num > 0.01f) ? (num.ToString("0.0") + "s") : "READY") : "ACTIVE");
		float num2 = 6f;
		float num3 = Mathf.Clamp(CfgUiBoxWidth.Value, 80, 600);
		float num4 = Mathf.Clamp(CfgUiBoxHeight.Value, 30, 200);
		Rect val = default(Rect);
		((Rect)(ref val))..ctor(num2, num2, num3 - num2 * 2f, num4 - num2 * 2f);
		Rect val2 = default(Rect);
		((Rect)(ref val2))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width, ((Rect)(ref val)).height * 0.5f);
		Rect val3 = default(Rect);
		((Rect)(ref val3))..ctor(((Rect)(ref val)).x, ((Rect)(ref val)).y + ((Rect)(ref val)).height * 0.5f, ((Rect)(ref val)).width, ((Rect)(ref val)).height * 0.5f);
		GUI.Label(val2, text, title);
		GUI.Label(val3, text2, label);
		Ui_HandleAltDrag(id);
	}

	private void Ui_HandleAltDrag(int windowId)
	{
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		if (Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307))
		{
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f));
			_uiDirty = true;
		}
	}

	private static float Ui_GetCooldownRemainingSeconds(Player p, int zdoKey)
	{
		try
		{
			ZDO playerZdo = GetPlayerZdo(p);
			if (playerZdo == null)
			{
				return 0f;
			}
			long num = NowMs();
			long @long = playerZdo.GetLong(zdoKey, 0L);
			if (@long <= num)
			{
				return 0f;
			}
			return Mathf.Max(0f, (float)(@long - num) / 1000f);
		}
		catch
		{
			return 0f;
		}
	}

	private static bool IsInputBlocked()
	{
		if (Console.IsVisible())
		{
			return true;
		}
		if ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus())
		{
			return true;
		}
		if (TextInput.IsVisible())
		{
			return true;
		}
		return false;
	}

	internal static bool HasUnlock(string abilityId, string requiredKey)
	{
		if (_debugBypassAll)
		{
			return true;
		}
		if (_debugUnlocks.Contains("all"))
		{
			return true;
		}
		if (_debugUnlocks.Contains(abilityId))
		{
			return true;
		}
		if (!CfgRequireProgression.Value)
		{
			return true;
		}
		if (string.IsNullOrWhiteSpace(requiredKey))
		{
			return true;
		}
		if ((Object)(object)ZoneSystem.instance == (Object)null)
		{
			return false;
		}
		try
		{
			return ZoneSystem.instance.GetGlobalKey(requiredKey);
		}
		catch
		{
			return false;
		}
	}

	internal static void DenyRequires(string abilityName, string requiredKey)
	{
		if (CfgShowLockedMessages.Value && !string.IsNullOrWhiteSpace(requiredKey))
		{
			ShowMsg(abilityName + " requires: " + requiredKey);
		}
	}

	private static void Host_TryDash(Player p)
	{
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0150: Unknown result type (might be due to invalid IL or missing references)
		//IL_017b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0207: 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_025e: Unknown result type (might be due to invalid IL or missing references)
		if (CfgDashEnabled != null && !CfgDashEnabled.Value)
		{
			return;
		}
		if (!HasUnlock("dash", CfgDashKeyRequired.Value))
		{
			DenyRequires("Dash", CfgDashKeyRequired.Value);
		}
		else
		{
			if ((Object)(object)p == (Object)null || (CfgDashDisallowEncumbered.Value && ((Character)p).IsEncumbered()))
			{
				return;
			}
			bool flag = ((Character)p).IsOnGround();
			if (!flag && !CfgDashAllowInAir.Value)
			{
				return;
			}
			ZDO playerZdo = GetPlayerZdo(p);
			if (playerZdo == null || playerZdo.GetInt(ZdoRollArmedInAir, 0) != 0)
			{
				return;
			}
			playerZdo.Set(ZdoRollArmedInAir, 1, false);
			long num = NowMs();
			long @long = playerZdo.GetLong(ZdoDashEndMs, 0L);
			if (@long > num)
			{
				return;
			}
			float num2 = Mathf.Max(0f, CfgDashStaminaCost.Value);
			if (num2 > 0f && p.GetStamina() < num2)
			{
				return;
			}
			Vector3 moveDirFromInput = GetMoveDirFromInput(p);
			float delaySeconds = 0.02f;
			if (!flag)
			{
				float power = Mathf.Max(0f, CfgDashPowerAir.Value);
				ApplyBurstForce(p, moveDirFromInput, power);
			}
			else
			{
				float num3 = Mathf.Max(0f, CfgDashPowerAir.Value) * Mathf.Max(0f, CfgDashGroundTotalMultiplier.Value);
				float num4 = Mathf.Clamp(CfgDashGroundBurstSeconds.Value, 0.02f, 1f);
				delaySeconds = num4 + 0.02f;
				if ((Object)(object)Instance != (Object)null)
				{
					((MonoBehaviour)Instance).StartCoroutine(CoGroundBurst(p, moveDirFromInput, num3, num4));
				}
				else
				{
					ApplyBurstForce(p, moveDirFromInput, num3);
				}
			}
			if (num2 > 0f)
			{
				((Character)p).UseStamina(num2);
			}
			long num5 = (long)(Mathf.Max(0f, CfgDashCooldownSeconds.Value) * 1000f);
			playerZdo.Set(ZdoDashEndMs, num + num5);
			PlayLocalSfx(1, ((Component)p).transform.position);
			SpawnAbilityVfx(CfgDashVfxPrefab.Value, p);
			try
			{
				if (CfgDashImpactEnabled != null && CfgDashImpactEnabled.Value && (Object)(object)Instance != (Object)null)
				{
					((MonoBehaviour)Instance).StartCoroutine(CoDashImpactAfter(p, delaySeconds));
				}
			}
			catch (Exception ex)
			{
				LogOnce(ref _loggedDashImpactException, "Dash impact coroutine start failed", ex);
			}
		}
	}

	[IteratorStateMachine(typeof(<CoGroundBurst>d__205))]
	private static IEnumerator CoGroundBurst(Player p, Vector3 dir, float totalImpulse, float seconds)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CoGroundBurst>d__205(0)
		{
			p = p,
			dir = dir,
			totalImpulse = totalImpulse,
			seconds = seconds
		};
	}

	private static void ApplyBurstForce(Player p, Vector3 dir, float power)
	{
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		Rigidbody rigidbody = GetRigidbody(p);
		if (!((Object)(object)rigidbody == (Object)null))
		{
			dir.y = 0f;
			if (((Vector3)(ref dir)).sqrMagnitude < 0.0001f)
			{
				dir = ((Component)p).transform.forward;
				dir.y = 0f;
			}
			if (((Vector3)(ref dir)).sqrMagnitude > 0.0001f)
			{
				((Vector3)(ref dir)).Normalize();
			}
			rigidbody.AddForce(dir * power, (ForceMode)2);
		}
	}

	[IteratorStateMachine(typeof(<CoDashImpactAfter>d__207))]
	private static IEnumerator CoDashImpactAfter(Player p, float delaySeconds)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CoDashImpactAfter>d__207(0)
		{
			p = p,
			delaySeconds = delaySeconds
		};
	}

	internal static void TriggerDashImpact(Player p)
	{
		TryDashImpactNow(p);
	}

	private static void TryDashImpactNow(Player p)
	{
		//IL_015d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0162: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0171: Unknown result type (might be due to invalid IL or missing references)
		//IL_0176: Unknown result type (might be due to invalid IL or missing references)
		//IL_017e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0349: Unknown result type (might be due to invalid IL or missing references)
		//IL_0350: Expected O, but got Unknown
		//IL_0370: Unknown result type (might be due to invalid IL or missing references)
		//IL_0375: Unknown result type (might be due to invalid IL or missing references)
		//IL_0383: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0393: Unknown result type (might be due to invalid IL or missing references)
		//IL_0398: Unknown result type (might be due to invalid IL or missing references)
		//IL_039c: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a1: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_040e: Unknown result type (might be due to invalid IL or missing references)
		//IL_044d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_028e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (CfgDashImpactEnabled != null && !CfgDashImpactEnabled.Value)
			{
				return;
			}
		}
		catch
		{
			return;
		}
		if ((Object)(object)p == (Object)null)
		{
			return;
		}
		ZDO playerZdo = GetPlayerZdo(p);
		if (playerZdo == null)
		{
			return;
		}
		long num = NowMs();
		long num2 = 0L;
		try
		{
			num2 = playerZdo.GetLong(ZdoDashImpactEndMs, 0L);
		}
		catch
		{
			num2 = 0L;
		}
		if (num2 > num)
		{
			return;
		}
		float num3 = 2.8f;
		float num4 = 70f;
		float blunt = 8f;
		float pushForce = 35f;
		float num5 = 1f;
		try
		{
			num3 = Mathf.Clamp(CfgDashImpactRange.Value, 0.5f, 10f);
		}
		catch
		{
		}
		try
		{
			num4 = Mathf.Clamp(CfgDashImpactConeDeg.Value, 5f, 180f);
		}
		catch
		{
		}
		try
		{
			blunt = Mathf.Max(0f, CfgDashImpactBluntDamage.Value);
		}
		catch
		{
		}
		try
		{
			pushForce = Mathf.Max(0f, CfgDashImpactPushForce.Value);
		}
		catch
		{
		}
		try
		{
			num5 = Mathf.Clamp(CfgDashImpactCooldownSeconds.Value, 0f, 10f);
		}
		catch
		{
		}
		Vector3 val = ((Component)p).transform.position + Vector3.up * 0.9f;
		Vector3 forward = ((Component)p).transform.forward;
		forward.y = 0f;
		if (((Vector3)(ref forward)).sqrMagnitude < 0.001f)
		{
			forward = ((Component)p).transform.forward;
		}
		if (((Vector3)(ref forward)).sqrMagnitude > 0.001f)
		{
			((Vector3)(ref forward)).Normalize();
		}
		bool flag = false;
		try
		{
			flag = CfgDashImpactHitPlayers != null && CfgDashImpactHitPlayers.Value;
		}
		catch
		{
			flag = false;
		}
		Character val2 = null;
		float num6 = 99999f;
		try
		{
			List<Character> allCharacters = Character.GetAllCharacters();
			for (int i = 0; i < allCharacters.Count; i++)
			{
				Character val3 = allCharacters[i];
				if ((Object)(object)val3 == (Object)null || (Object)(object)val3 == (Object)(object)p || val3.IsDead() || (val3 is Player && (!flag || !((Character)p).IsPVPEnabled())))
				{
					continue;
				}
				Vector3 val4 = ((Component)val3).transform.position - val;
				float magnitude = ((Vector3)(ref val4)).magnitude;
				if (magnitude > num3)
				{
					continue;
				}
				val4.y = 0f;
				if (!(((Vector3)(ref val4)).sqrMagnitude < 0.0001f))
				{
					float num7 = Vector3.Angle(forward, ((Vector3)(ref val4)).normalized);
					if (!(num7 > num4 * 0.5f) && magnitude < num6)
					{
						num6 = magnitude;
						val2 = val3;
					}
				}
			}
		}
		catch
		{
			val2 = null;
		}
		if ((Object)(object)val2 == (Object)null)
		{
			return;
		}
		try
		{
			HitData val5 = new HitData();
			val5.m_damage.m_blunt = blunt;
			val5.m_pushForce = pushForce;
			val5.m_point = ((Component)val2).transform.position;
			Vector3 val6 = ((Component)val2).transform.position - ((Component)p).transform.position;
			val5.m_dir = ((Vector3)(ref val6)).normalized;
			val5.m_attacker = ((Character)p).GetZDOID();
			val5.m_skill = (SkillType)11;
			val5.m_backstabBonus = 1f;
			val5.m_staggerMultiplier = 2f;
			val2.Damage(val5);
			bool flag2 = false;
			try
			{
				flag2 = TryPlayShieldParryFx(p, val5.m_point);
			}
			catch
			{
				flag2 = false;
			}
			if (!flag2)
			{
				bool flag3 = false;
				try
				{
					flag3 = SpawnDashImpactSfxPrefab(val5.m_point);
				}
				catch
				{
					flag3 = false;
				}
				if (!flag3)
				{
					try
					{
						PlayLocalSfx(7, val5.m_point);
					}
					catch
					{
					}
				}
				try
				{
					SpawnDashImpactVfx(val5.m_point);
				}
				catch
				{
				}
			}
		}
		catch
		{
		}
		if (!(num5 > 0f))
		{
			return;
		}
		long num8 = (long)(num5 * 1000f);
		try
		{
			playerZdo.Set(ZdoDashImpactEndMs, num + num8);
		}
		catch
		{
		}
	}

	private static void Host_TryOverdrive(Player p)
	{
		//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (CfgOverdriveEnabled != null && !CfgOverdriveEnabled.Value)
			{
				return;
			}
		}
		catch
		{
		}
		if (!HasUnlock("overdrive", CfgOverdriveKeyRequired.Value))
		{
			DenyRequires("Overdrive", CfgOverdriveKeyRequired.Value);
		}
		else
		{
			if ((Object)(object)p == (Object)null || (!CfgOverdriveAllowSwimming.Value && ((Character)p).IsSwimming()))
			{
				return;
			}
			ZDO playerZdo = GetPlayerZdo(p);
			if (playerZdo == null)
			{
				return;
			}
			long num = NowMs();
			long @long = playerZdo.GetLong(ZdoOverdriveEndMs, 0L);
			if (@long <= num)
			{
				if ((Object)(object)OverdriveSe == (Object)null && (Object)(object)ObjectDB.instance != (Object)null)
				{
					StatusEffect statusEffect = ObjectDB.instance.GetStatusEffect(OverdriveSeHash);
					OverdriveSe = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null);
				}
				if (!((Object)(object)OverdriveSe == (Object)null))
				{
					((StatusEffect)OverdriveSe).m_ttl = Mathf.Max(0.1f, CfgOverdriveDurationSeconds.Value);
					float num2 = Mathf.Max(1f, CfgOverdriveSpeedMultiplier.Value);
					OverdriveSe.m_speedModifier = num2 - 1f;
					((Character)p).GetSEMan().AddStatusEffect((StatusEffect)(object)OverdriveSe, false, 0, 0f);
					long num3 = (long)(Mathf.Max(0f, CfgOverdriveCooldownMinutes.Value) * 60f * 1000f);
					playerZdo.Set(ZdoOverdriveEndMs, num + num3);
					PlayLocalSfx(5, ((Component)p).transform.position);
					SpawnAbilityVfx(CfgOverdriveVfxPrefab.Value, p);
				}
			}
		}
	}

	private void Host_TryBlink(Player p)
	{
		//IL_0200: Unknown result type (might be due to invalid IL or missing references)
		//IL_0205: Unknown result type (might be due to invalid IL or missing references)
		//IL_020e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0213: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0217: Unknown result type (might be due to invalid IL or missing references)
		//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
		//IL_0246: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0252: Unknown result type (might be due to invalid IL or missing references)
		//IL_037e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0380: Unknown result type (might be due to invalid IL or missing references)
		//IL_0384: Unknown result type (might be due to invalid IL or missing references)
		//IL_0389: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0390: Unknown result type (might be due to invalid IL or missing references)
		//IL_0392: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0293: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_0276: Unknown result type (might be due to invalid IL or missing references)
		//IL_027b: 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_03a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
		//IL_03b7: Unknown result type (might be due to invalid IL or missing references)
		//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
		//IL_03d4: 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_03d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0435: Unknown result type (might be due to invalid IL or missing references)
		//IL_043e: Unknown result type (might be due to invalid IL or missing references)
		//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
		//IL_0530: Unknown result type (might be due to invalid IL or missing references)
		//IL_048d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0170: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0179: Unknown result type (might be due to invalid IL or missing references)
		//IL_0183: Unknown result type (might be due to invalid IL or missing references)
		//IL_0188: Unknown result type (might be due to invalid IL or missing references)
		//IL_018d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0193: Unknown result type (might be due to invalid IL or missing references)
		//IL_0198: Unknown result type (might be due to invalid IL or missing references)
		//IL_019a: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		if (!HasUnlock("blink", CfgBlinkKeyRequired.Value))
		{
			DenyRequires("Blink", CfgBlinkKeyRequired.Value);
		}
		else
		{
			if ((Object)(object)p == (Object)null || ((Character)p).IsDead() || ((Character)p).IsTeleporting() || ((Character)p).InCutscene() || ((Character)p).IsSwimming())
			{
				return;
			}
			bool flag = ((Character)p).IsOnGround();
			if (!flag && !CfgBlinkAllowInAir.Value)
			{
				return;
			}
			ZDO playerZdo = GetPlayerZdo(p);
			if (playerZdo == null)
			{
				return;
			}
			long num = NowMs();
			long @long = playerZdo.GetLong(ZdoBlinkEndMs, 0L);
			if (@long > num)
			{
				return;
			}
			float num2 = Mathf.Max(0f, CfgBlinkStaminaCost.Value);
			float num3 = ((CfgBlinkEitrCost != null) ? Mathf.Max(0f, CfgBlinkEitrCost.Value) : 0f);
			if ((num2 > 0f && p.GetStamina() < num2) || (num3 > 0f && !PlayerHasEitr(p, num3)))
			{
				return;
			}
			Vector3 position = ((Component)p).transform.position;
			Vector3 val = position + Vector3.up * 1f;
			int num4 = -5;
			Vector3 val2 = Vector3.zero;
			Vector3 val3 = position;
			Camera val4 = null;
			try
			{
				if ((Object)(object)GameCamera.instance != (Object)null)
				{
					val4 = ((Component)GameCamera.instance).GetComponent<Camera>();
				}
			}
			catch
			{
			}
			if ((Object)(object)val4 == (Object)null)
			{
				try
				{
					val4 = Camera.main;
				}
				catch
				{
				}
			}
			if ((Object)(object)val4 != (Object)null)
			{
				Vector3 position2 = ((Component)val4).transform.position;
				Vector3 forward = ((Component)val4).transform.forward;
				RaycastHit val5 = default(RaycastHit);
				if (Physics.Raycast(position2, forward, ref val5, Mathf.Max(0f, CfgBlinkRange.Value) * 1.05f, num4, (QueryTriggerInteraction)1))
				{
					Vector3 val6 = ((RaycastHit)(ref val5)).point - val;
					val6.y = 0f;
					if (((Vector3)(ref val6)).sqrMagnitude > 0.0001f)
					{
						val2 = ((Vector3)(ref val6)).normalized;
					}
				}
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = forward;
					val2.y = 0f;
					if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f)
					{
						((Vector3)(ref val2)).Normalize();
					}
				}
			}
			if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
			{
				val2 = GetMoveDirFromInput(p);
				if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f)
				{
					val2 = ((Component)p).transform.forward;
					val2.y = 0f;
					if (((Vector3)(ref val2)).sqrMagnitude > 0.0001f)
					{
						((Vector3)(ref val2)).Normalize();
					}
				}
			}
			float num5 = Mathf.Max(0f, CfgBlinkRange.Value);
			if (!flag)
			{
				num5 *= Mathf.Clamp(CfgBlinkAirMultiplier.Value, 0f, 2f);
			}
			float num6 = Mathf.Max(0f, CfgBlinkBackoff.Value);
			val3 = position + val2 * num5;
			RaycastHit val7 = default(RaycastHit);
			if (Physics.Raycast(val, val2, ref val7, num5, num4, (QueryTriggerInteraction)1))
			{
				val3 = ((RaycastHit)(ref val7)).point - val2 * num6;
			}
			if (TryClampBlinkDestinationToGround(val3, out var clamped))
			{
				val3 = clamped;
			}
			if (!IsDestinationClear(val3))
			{
				SpawnAbilityVfx(CfgBlinkVfxFizzlePrefab.Value, p);
				return;
			}
			if (num2 > 0f)
			{
				((Character)p).UseStamina(num2);
			}
			if (num3 > 0f)
			{
				PlayerUseEitr(p, num3);
			}
			SpawnVfxAt(CfgBlinkVfxStartPrefab.Value, position);
			if (!TrySilentTeleport(p, val3))
			{
				float num7 = Mathf.Max(0f, CfgBlinkFallbackBurstPowerAir.Value);
				if (flag)
				{
					num7 *= Mathf.Max(0f, CfgBlinkFallbackGroundMultiplier.Value);
				}
				ApplyBurstForce(p, val2, num7);
				float seconds = Mathf.Clamp(CfgBlinkFallbackBrakeSeconds.Value, 0.01f, 1f);
				float toPct = Mathf.Clamp01(CfgBlinkFallbackBrakeToPct.Value);
				if ((Object)(object)Instance != (Object)null)
				{
					((MonoBehaviour)Instance).StartCoroutine(CoBrakeHorizontal(p, seconds, toPct));
				}
			}
			SpawnVfxAt(CfgBlinkVfxEndPrefab.Value, val3);
			long num8 = (long)(Mathf.Max(0f, CfgBlinkCooldownSeconds.Value) * 1000f);
			playerZdo.Set(ZdoBlinkEndMs, num + num8);
			PlayLocalSfx(6, ((Component)p).transform.position);
		}
	}

	[IteratorStateMachine(typeof(<CoBrakeHorizontal>d__212))]
	private static IEnumerator CoBrakeHorizontal(Player p, float seconds, float toPct)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <CoBrakeHorizontal>d__212(0)
		{
			p = p,
			seconds = seconds,
			toPct = toPct
		};
	}

	private static bool TrySilentTeleport(Player p, Vector3 pos)
	{
		//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_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)
		try
		{
			if (!_blinkMethodResolved)
			{
				lock (_blinkInvokeLock)
				{
					if (!_blinkMethodResolved)
					{
						_blinkMethodResolved = true;
						_teleportToMethodBool = AccessTools.DeclaredMethod(typeof(Player), "TeleportTo", new Type[3]
						{
							typeof(Vector3),
							typeof(Quaternion),
							typeof(bool)
						}, (Type[])null);
					}
				}
			}
			if (_teleportToMethodBool == null)
			{
				return false;
			}
			Quaternion rotation = ((Component)p).transform.rotation;
			_teleportToMethodBool.Invoke(p, new object[3] { pos, rotation, false });
			return true;
		}
		catch
		{
			return false;
		}
	}

	internal bool TryDoDoubleJumpFromJump(Player p)
	{
		return TryDoDoubleJump(p);
	}

	private bool TryDoDoubleJump(Player p)
	{
		//IL_010b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0111: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: 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_0154: Unknown result type (might be due to invalid IL or missing references)
		if (!CfgDoubleJumpEnabled.Value)
		{
			return false;
		}
		if ((Object)(object)p == (Object)null)
		{
			return false;
		}
		if (((Character)p).IsOnGround())
		{
			return false;
		}
		if (!HasUnlock("doublejump", CfgDoubleJumpKeyRequired.Value))
		{
			DenyRequires("Double Jump", CfgDoubleJumpKeyRequired.Value);
			return false;
		}
		if (_doubleJumpUsed)
		{
			return false;
		}
		if (!CfgDoubleJumpAllowWhenEncumbered.Value && ((Character)p).IsEncumbered())
		{
			return false;
		}
		float num = Mathf.Max(0f, CfgDoubleJumpStaminaCost.Value);
		if (num > 0f && p.GetStamina() < num)
		{
			return false;
		}
		Rigidbody rigidbody = GetRigidbody(p);
		if ((Object)(object)rigidbody == (Object)null)
		{
			return false;
		}
		Vector3 linearVelocity = rigidbody.linearVelocity;
		if (linearVelocity.y < 0f)
		{
			linearVelocity.y = 0f;
		}
		rigidbody.linearVelocity = linearVelocity;
		float num2 = Mathf.Max(0f, CfgDoubleJumpUpwardPower.Value);
		rigidbody.AddForce(Vector3.up * num2, (ForceMode)2);
		if (num > 0f)
		{
			((Character)p).UseStamina(num);
		}
		_doubleJumpUsed = true;
		SpawnAbilityVfx(CfgDoubleJumpVfxPrefab.Value, p);
		return true;
	}

	private bool TryDoWallKick(Player p)
	{
		//IL_010a: Unknown result type (might be due to invalid IL or missing references)
		//IL_010f: Unknown result type (might be due to invalid IL or missing references)
		//IL_012a: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_015e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		//IL_016d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0172: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0196: Unknown result type (might be due to invalid IL or missing references)
		//IL_0197: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_021e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0223: Unknown result type (might be due to invalid IL or missing references)
		//IL_0225: Unknown result type (might be due to invalid IL or missing references)
		//IL_0247: Unknown result type (might be due to invalid IL or missing references)
		//IL_027d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0289: Unknown result type (might be due to invalid IL or missing references)
		//IL_0290: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_029a: Unknown result type (might be due to invalid IL or missing references)
		//IL_029e: Unknown result type (might be due to invalid IL or missing references)
		if (!CfgWallKickEnabled.Value)
		{
			return false;
		}
		if ((Object)(object)p == (Object)null)
		{
			return false;
		}
		if (((Character)p).IsOnGround())
		{
			return false;
		}
		if (!HasUnlock("wallkick", CfgWallKickKeyRequired.Value))
		{
			DenyRequires("Wall Kick", CfgWallKickKeyRequired.Value);
			return false;
		}
		if (_wallKickUsed)
		{
			return false;
		}
		if (Time.time < _wallKickCooldownEnd)
		{
			return false;
		}
		if (!CfgWallKickAllowWhenEncumbered.Value && ((Character)p).IsEncumbered())
		{
			return false;
		}
		float num = Mathf.Max(0f, CfgWallKickStaminaCost.Value);
		if (num > 0f && p.GetStamina() < num)
		{
			return false;
		}
		Vector3 val = GetMoveDirFromInput(p);
		if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
		{
			val = ((Component)p).transform.forward;
		}
		val.y = 0f;
		if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
		{
			((Vector3)(ref val)).Normalize();
		}
		Vector3 val2 = ((Component)p).transform.position + Vector3.up * 1f;
		float num2 = Mathf.Clamp(CfgWallKickRange.Value, 0.2f, 2f);
		int num3 = -5;
		RaycastHit val3 = default(RaycastHit);
		if (!Physics.Raycast(val2, val, ref val3, num2, num3, (QueryTriggerInteraction)1))
		{
			return false;
		}
		if ((Object)(object)((RaycastHit)(ref val3)).collider == (Object)null)
		{
			return false;
		}
		float num4 = Mathf.Clamp01(CfgWallKickMaxNormalY.Value);
		if (((RaycastHit)(ref val3)).normal.y > num4)
		{
			return false;
		}
		Rigidbody rigidbody = GetRigidbody(p);
		if ((Object)(object)rigidbody == (Object)null)
		{
			return false;
		}
		Vector3 linearVelocity = rigidbody.linearVelocity;
		if (linearVelocity.y < 0f)
		{
			linearVelocity.y = 0f;
		}
		rigidbody.linearVelocity = linearVelocity;
		float num5 = Mathf.Max(0f, CfgWallKickUpwardPower.Value);
		float num6 = Mathf.Max(0f, CfgWallKickOutwardPower.Value);
		Vector3 val4 = ((RaycastHit)(ref val3)).normal * num6 + Vector3.up * num5;
		rigidbody.AddForce(val4, (ForceMode)2);
		if (num > 0f)
		{
			((Character)p).UseStamina(num);
		}
		_wallKickUsed = true;
		_wallKickCooldownEnd = Time.time + Mathf.Max(0f, CfgWallKickCooldownSeconds.Value);
		SpawnAbilityVfx(CfgWallKickVfxPrefab.Value, p);
		return true;
	}

	private void TryArmLandingRoll(Player p)
	{
		if (!CfgRollEnabled.Value || (Object)(object)p == (Object)null)
		{
			return;
		}
		if (!HasUnlock("roll", CfgRollKeyRequired.Value))
		{
			DenyRequires("Landing Roll", CfgRollKeyRequired.Value);
			return;
		}
		ZDO playerZdo = GetPlayerZdo(p);
		if (playerZdo == null)
		{
			return;
		}
		long num = NowMs();
		long @long = playerZdo.GetLong(ZdoRollCooldownEndMs, 0L);
		if (@long <= num)
		{
			float absFallSpeed = GetAbsFallSpeed(p);
			if (!(absFallSpeed < CfgRollMinFallSpeedAbs.Value))
			{
				long num2 = num + Mathf.Max(1, CfgRollTimingWindowMs.Value);
				playerZdo.Set(ZdoRollIntentEndMs, num2);
			}
		}
	}

	internal static bool TryConsumeRollIntent(Player p, out float reducePct, out float forwardBoost, out float staminaCost)
	{
		reducePct = 0f;
		forwardBoost = 0f;
		staminaCost = 0f;
		if (!CfgRollEnabled.Value)
		{
			return false;
		}
		if ((Object)(object)p == (Object)null)
		{
			return false;
		}
		if (!HasUnlock("roll", CfgRollKeyRequired.Value))
		{
			return false;
		}
		ZDO playerZdo = GetPlayerZdo(p);
		if (playerZdo == null)
		{
			return false;
		}
		long num = NowMs();
		long @long = playerZdo.GetLong(ZdoRollIntentEndMs, 0L);
		if (@long <= num)
		{
			return false;
		}
		playerZdo.Set(ZdoRollIntentEndMs, 0L);
		reducePct = Mathf.Clamp01(CfgRollDamageReductionPercent.Value);
		forwardBoost = Mathf.Max(0f, CfgRollForwardBoost.Value);
		staminaCost = Mathf.Max(0f, CfgRollStaminaCost.Value);
		return true;
	}

	internal static void OnRollSuccess(Player p)
	{
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		if (!((Object)(object)p == (Object)null))
		{
			ZDO playerZdo = GetPlayerZdo(p);
			if (playerZdo != null)
			{
				long num = NowMs();
				float num2 = Mathf.Max(0f, CfgRollCooldownSeconds.Value);
				long num3 = (long)(num2 * 1000f);
				playerZdo.Set(ZdoRollCooldownEndMs, num + num3);
			}
			PlayLocalSfx(4, ((Component)p).transform.position);
			SpawnAbilityVfx(CfgRollVfxPrefab.Value, p);
			if (CfgRollTriggerDodgeAnim.Value)
			{
				TryPlayDodge(p);
			}
		}
	}

	internal static void TryPlayDodge(Player p)
	{
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		//IL_013d: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!_dodgeMethodResolved)
			{
				lock (_dodgeInvokeLock)
				{
					if (!_dodgeMethodResolved)
					{
						_dodgeMethodResolved = true;
						_dodgeMethod = AccessTools.DeclaredMethod(typeof(Player), "Dodge", new Type[1] { typeof(Vector3) }, (Type[])null) ?? AccessTools.DeclaredMethod(typeof(Player), "Dodge", new Type[2]
						{
							typeof(Vector3),
							typeof(bool)
						}, (Type[])null) ?? AccessTools.DeclaredMethod(typeof(Player), "StartDodge", new Type[1] { typeof(Vector3) }, (Type[])null) ?? AccessTools.DeclaredMethod(typeof(Player), "StartDodge", new Type[2]
						{
							typeof(Vector3),
							typeof(bool)
						}, (Type[])null);
					}
				}
			}
			if (!(_dodgeMethod == null))
			{
				Vector3 forward = ((Component)p).transform.forward;
				forward.y = 0f;
				if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f)
				{
					((Vector3)(ref forward)).Normalize();
				}
				ParameterInfo[] parameters = _dodgeMethod.GetParameters();
				if (parameters.Length == 1)
				{
					_dodgeMethod.Invoke(p, new object[1] { forward });
				}
				else if (parameters.Length == 2 && parameters[1].ParameterType == typeof(bool))
				{
					_dodgeMethod.Invoke(p, new object[2] { forward, true });
				}
			}
		}
		catch
		{
		}
	}

	internal static void SpawnAbilityVfx(string prefabName, Player p)
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		if (!CfgVfxEnabled.Value || (Object)(object)p == (Object)null || string.IsNullOrWhiteSpace(prefabName))
		{
			return;
		}
		GameObject val = FindVfxPrefab(prefabName);
		if ((Object)(object)val == (Object)null)
		{
			if (CfgVfxDebugLogging.Value)
			{
				Log.LogInfo((object)("[MV] VFX prefab NOT FOUND: '" + prefabName + "'"));
			}
			return;
		}
		try
		{
			Object.Instantiate<GameObject>(val, ((Component)p).transform.position, Quaternion.identity);
		}
		catch (Exception ex)
		{
			if (CfgVfxDebugLogging.Value)
			{
				Log.LogWarning((object)("[MV] VFX spawn FAILED '" + prefabName + "': " + ex.Message));
			}
		}
	}

	private static void SpawnVfxAt(string prefabName, Vector3 pos)
	{
		//IL_0069: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Unknown result type (might be due to invalid IL or missing references)
		if (!CfgVfxEnabled.Value || string.IsNullOrWhiteSpace(prefabName))
		{
			return;
		}
		GameObject val = FindVfxPrefab(prefabName);
		if ((Object)(object)val == (Object)null)
		{
			if (CfgVfxDebugLogging.Value)
			{
				Log.LogInfo((object)("[MV] VFX prefab NOT FOUND: '" + prefabName + "'"));
			}
			return;
		}
		try
		{
			Object.Instantiate<GameObject>(val, pos, Quaternion.identity);
		}
		catch (Exception ex)
		{
			if (CfgVfxDebugLogging.Value)
			{
				Log.LogWarning((object)("[MV] VFX spawn FAILED '" + prefabName + "': " + ex.Message));
			}
		}
	}

	private static GameObject FindVfxPrefab(string name)
	{
		if (string.IsNullOrWhiteSpace(name))
		{
			return null;
		}
		if (_vfxCache.TryGetValue(name, out var value))
		{
			return value;
		}
		GameObject val = null;
		try
		{
			if ((Object)(object)ObjectDB.instance != (Object)null)
			{
				val = ObjectDB.instance.GetItemPrefab(name);
			}
		}
		catch
		{
		}
		if ((Object)(object)val == (Object)null)
		{
			try
			{
				if ((Object)(object)ZNetScene.instance != (Object)null)
				{
					val = ZNetScene.instance.GetPrefab(name);
				}
			}
			catch
			{
			}
		}
		if ((Object)(object)val != (Object)null)
		{
			_vfxCache[name] = val;
		}
		return val;
	}

	internal static void TryApplyRollHeal(Player p, float preventedFallDamage)
	{
		try
		{
			if (!CfgRollEnabled.Value || (Object)(object)p == (Object)null)
			{
				return;
			}
			float num = 0f;
			if (CfgRollHealFlat != null)
			{
				num += Mathf.Max(0f, CfgRollHealFlat.Value);
			}
			if (CfgRollHealPctMax != null)
			{
				float num2 = Mathf.Max(0f, CfgRollHealPctMax.Value);
				if (num2 > 0f)
				{
					num += Mathf.Max(0f, ((Character)p).GetMaxHealth() * num2);
				}
			}
			if (CfgRollHealFromPreventedDamageMultiplier != null)
			{
				float num3 = Mathf.Max(0f, CfgRollHealFromPreventedDamageMultiplier.Value);
				if (num3 > 0f && preventedFallDamage > 0.01f)
				{
					num += preventedFallDamage * num3;
				}
			}
			if (!(num <= 0.01f) && !(((Character)p).GetHealth() >= ((Character)p).GetMaxHealth() - 0.01f))
			{
				((Character)p).Heal(num, true);
			}
		}
		catch (Exception ex)
		{
			if (CfgDebugPopups != null && CfgDebugPopups.Value)
			{
				Log.LogWarning((object)("[MV] Roll heal failed: " + ex.Message));
			}
		}
	}

	internal static void Cmd_Bypass(bool on)
	{
		_debugBypassAll = on;
		ShowMsg(on ? "[MV] Progression bypass ON" : "[MV] Progression bypass OFF");
	}

	internal static void Cmd_Unlock(string what)
	{
		if (string.IsNullOrWhiteSpace(what))
		{
			return;
		}
		what = what.Trim().ToLowerInvariant();
		if (what == "none")
		{
			_debugUnlocks.Clear();
			ShowMsg("[MV] Debug unlocks cleared");
			return;
		}
		if (what == "all")
		{
			_debugUnlocks.Clear();
			_debugUnlocks.Add("all");
			ShowMsg("[MV] Debug unlock: ALL abilities");
			return;
		}
		_debugUnlocks.Remove("all");
		switch (what)
		{
		default:
			if (!(what == "blink"))
			{
				ShowMsg("[MV] mv_unlock expects: dash|overdrive|doublejump|roll|wallkick|blink|all|none");
				break;
			}
			goto case "dash";
		case "dash":
		case "overdrive":
		case "doublejump":
		case "roll":
		case "wallkick":
			_debugUnlocks.Add(what);
			ShowMsg("[MV] Debug unlock: " + what);
			break;
		}
	}

	internal static void Cmd_Status()
	{
		bool flag = HasUnlock("dash", CfgDashKeyRequired.Value);
		bool flag2 = HasUnlock("overdrive", CfgOverdriveKeyRequired.Value);
		bool flag3 = HasUnlock("doublejump", CfgDoubleJumpKeyRequired.Value);
		bool flag4 = HasUnlock("roll", CfgRollKeyRequired.Value);
		bool flag5 = HasUnlock("wallkick", CfgWallKickKeyRequired.Value);
		bool flag6 = HasUnlock("blink", CfgBlinkKeyRequired.Value);
		string text = (_debugBypassAll ? "bypass=ON" : "bypass=OFF");
		string text2 = ((_debugUnlocks.Count == 0) ? "unlocks=none" : ("unlocks=" + string.Join(",", _debugUnlocks)));
		ShowMsg("[MV] " + text + " " + text2);
		ShowMsg("[MV] Dash(" + CfgDashKeyRequired.Value + ")=" + flag + " Overdrive(" + CfgOverdriveKeyRequired.Value + ")=" + flag2 + " DoubleJump(" + CfgDoubleJumpKeyRequired.Value + ")=" + flag3 + " Roll(" + CfgRollKeyRequired.Value + ")=" + flag4 + " WallKick(" + CfgWallKickKeyRequired.Value + ")=" + flag5 + " Blink(" + CfgBlinkKeyRequired.Value + ")=" + flag6);
	}

	internal static void Cmd_VfxTest(string prefabName)
	{
		//IL_006c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0071: Unknown result type (might be due to invalid IL or missing references)
		Player localPlayer = Player.m_localPlayer;
		if ((Object)(object)localPlayer == (Object)null)
		{
			ShowMsg("[MV] No local player");
			return;
		}
		if (string.IsNullOrWhiteSpace(prefabName))
		{
			ShowMsg("[MV] Usage: mv_vfx <prefabName>");
			return;
		}
		GameObject val = FindVfxPrefab(prefabName);
		if ((Object)(object)val == (Object)null)
		{
			ShowMsg("[MV] VFX NOT FOUND: " + prefabName);
			return;
		}
		try
		{
			Object.Instantiate<GameObject>(val, ((Component)localPlayer).transform.position, Quaternion.identity);
			ShowMsg("[MV] VFX spawned: " + prefabName);
		}
		catch (Exception ex)
		{
			ShowMsg("[MV] VFX spawn failed: " + ex.Message);
		}
	}

	internal static void Cmd_VfxFind(string term, int limit)
	{
		term = (term ?? "").Trim().ToLowerInvariant();
		if (term.Length == 0)
		{
			term = "vfx";
		}
		int shown = 0;
		try
		{
			if ((Object)(object)ZNetScene.instance != (Object)null && AccessTools.Field(typeof(ZNetScene), "m_namedPrefabs")?.GetValue(ZNetScene.instance) is IDictionary dictionary)
			{
				foreach (DictionaryEntry item in dictionary)
				{
					object? value = item.Value;
					GameObject val = (GameObject)((value is GameObject) ? value : null);
					if ((Object)(object)val == (Object)null)
					{
						continue;
					}
					string name = ((Object)val).name;
					if (!string.IsNullOrEmpty(name) && name.ToLowerInvariant().Contains(term))
					{
						Print("ZNetScene: " + name);
						if (shown >= limit)
						{
							break;
						}
					}
				}
			}
		}
		catch (Exception ex)
		{
			Log.LogWarning((object)("[MV] mv_vfx_find ZNetScene scan failed: " + ex.Message));
		}
		try
		{
			if (shown < limit && (Object)(object)ObjectDB.instance != (Object)null && ObjectDB.instance.m_items != null)
			{
				foreach (GameObject item2 in ObjectDB.instance.m_items)
				{
					if ((Object)(object)item2 == (Object)null)
					{
						continue;
					}
					string name2 = ((Object)item2).name;
					if (!string.IsNullOrEmpty(name2) && name2.ToLowerInvariant().Contains(term))
					{
						Print("ObjectDB: " + name2);
						if (shown >= limit)
						{
							break;
						}
					}
				}
			}
		}
		catch (Exception ex2)
		{
			Log.LogWarning((object)("[MV] mv_vfx_find ObjectDB scan failed: " + ex2.Message));
		}
		if (shown == 0)
		{
			Log.LogInfo((object)("[MV] mv_vfx_find: no matches for '" + term + "'"));
		}
		else
		{
			Log.LogInfo((object)("[MV] mv_vfx_find: showed " + shown + " result(s)."));
		}
		void Print(string s)
		{
			if (shown < limit)
			{
				Log.LogInfo((object)("[MV] " + s));
				shown++;
			}
		}
	}

	internal static void Cmd_VfxList()
	{
		ShowMsg("[MV] DashVFX=" + CfgDashVfxPrefab.Value);
		ShowMsg("[MV] OverdriveVFX=" + CfgOverdriveVfxPrefab.Value);
		ShowMsg("[MV] DoubleJumpVFX=" + CfgDoubleJumpVfxPrefab.Value);
		ShowMsg("[MV] RollVFX=" + CfgRollVfxPrefab.Value);
		ShowMsg("[MV] WallKickVFX=" + CfgWallKickVfxPrefab.Value);
		ShowMsg("[MV] BlinkStartVFX=" + CfgBlinkVfxStartPrefab.Value);
		ShowMsg("[MV] BlinkEndVFX=" + CfgBlinkVfxEndPrefab.Value);
		ShowMsg("[MV] BlinkFizzleVFX=" + CfgBlinkVfxFizzlePrefab.Value);
	}

	private static Rigidbody GetRigidbody(Player p)
	{
		if ((Object)(object)p == (Object)null)
		{
			return null;
		}
		Rigidbody component = ((Component)p).GetComponent<Rigidbody>();
		if ((Object)(object)component != (Object)null)
		{
			return component;
		}
		return ((Component)p).GetComponentInChildren<Rigidbody>();
	}

	private static ZDO GetPlayerZdo(Player p)
	{
		ZNetView component = ((Component)p).GetComponent<ZNetView>();
		if ((Object)(object)component == (Object)null || !component.IsValid())
		{
			return null;
		}
		return component.GetZDO();
	}

	private static float GetAbsFallSpeed(Player p)
	{
		//IL_001c: Unknown result type (might be due to invalid IL or missing references)
		Rigidbody rigidbody = GetRigidbody(p);
		if ((Object)(object)rigidbody == (Object)null)
		{
			return 0f;
		}
		float y = rigidbody.linearVelocity.y;
		return (y < 0f) ? (0f - y) : 0f;
	}

	private static long NowMs()
	{
		if ((Object)(object)ZNet.instance != (Object)null)
		{
			return (long)(ZNet.instance.GetTimeSeconds() * 1000.0);
		}
		return (long)(Time.realtimeSinceStartup * 1000f);
	}

	private static bool IsDestinationClear(Vector3 pos)
	{
		//IL_0001: Unknown result type (might be due to invalid IL or missing references)
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0017: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_0022: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		Vector3 val = pos + Vector3.up * 0.2f;
		Vector3 val2 = pos + Vector3.up * 1.6f;
		float num = 0.4f;
		int num2 = -5;
		Collider[] array = Physics.OverlapCapsule(val, val2, num, num2, (QueryTriggerInteraction)1);
		return array == null || array.Length == 0;
	}

	private void BindConfig()
	{
		CfgModKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "ModifierKey", (KeyCode)304, "");
		CfgDashKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "DashKey", (KeyCode)101, "");
		CfgOverdriveKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "OverdriveKey", (KeyCode)114, "");
		CfgBlinkKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Input", "BlinkKey", (KeyCode)113, "");
		CfgRequireProgression = ((BaseUnityPlugin)this).Config.Bind<bool>("Progression", "RequireBossKeys", true, "");
		CfgShowLockedMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Progression", "ShowLockedMessages", false, "");
		CfgDashKeyRequired = ((BaseUnityPlugin)this).Config.Bind<string>("Progression", "DashRequiresKey", "defeated_eikthyr", "");
		CfgOverdriveKeyRequired = ((BaseUnityPlugin)this).Config.Bind<string>("Progression", "OverdriveRequiresKey", "defeated_gdking", "");
		CfgDoubleJumpKeyRequired = ((BaseUnityPlugin)this).Config.Bind<string>("Progression", "DoubleJumpRequiresKey", "defeated_bonemass", "");
		CfgRollKeyRequired = ((BaseUnityPlugin)this).Config.Bind<string>("Progression", "RollRequiresKey", "defeated_dragon", "");
		CfgWallKickKeyRequired = ((BaseUnityPlugin)this).Config.Bind<string>("Progression", "WallKickRequiresKey", "defeated_goblinking", "");
		CfgBlinkKeyRequired = ((BaseUnityPlugin)this).Config.Bind<string>("Progression", "BlinkRequiresKey", "defeated_queen", "");
		CfgDashEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Dash", "Enabled", true, "Enable/disable Dash ability.");
		CfgDashCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "CooldownSeconds", 3f, "");
		CfgDashStaminaCost = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "StaminaCost", 20f, "");
		CfgDashImpactEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DashImpact", "Enabled", true, "If true, applies a shoulder-check impact to the nearest enemy in front when your dash finishes.");
		CfgDashImpactRange = ((BaseUnityPlugin)this).Config.Bind<float>("DashImpact", "Range", 2.8f, "Range (meters) to search for an enemy at dash end.");
		CfgDashImpactConeDeg = ((BaseUnityPlugin)this).Config.Bind<float>("DashImpact", "ConeDeg", 70f, "Forward cone angle for dash impact (degrees).");
		CfgDashImpactBluntDamage = ((BaseUnityPlugin)this).Config.Bind<float>("DashImpact", "BluntDamage", 8f, "Blunt damage dealt by dash impact.");
		CfgDashImpactPushForce = ((BaseUnityPlugin)this).Config.Bind<float>("DashImpact", "PushForce", 35f, "Push force for dash impact.");
		CfgDashImpactCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("DashImpact", "CooldownSeconds", 1f, "Cooldown (seconds) between dash impacts.");
		CfgDashImpactHitPlayers = ((BaseUnityPlugin)this).Config.Bind<bool>("DashImpact", "HitPlayers", false, "If true, dash impact can hit other players when PvP is enabled.");
		CfgDashImpactBlockVfxEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DashImpactBlockFX", "BlockVfxEnabled", true, "If true, plays a VFX when dash impact is blocked/parried.");
		CfgDashImpactBlockVfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("DashImpactBlockFX", "BlockVfxPrefab", "", "Optional override VFX prefab name for dash-impact block/parry. Leave blank to use vanilla shield/parry VFX.");
		CfgDashImpactBlockSfxEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DashImpactBlockFX", "BlockSfxEnabled", true, "If true, plays a SFX when dash impact is blocked/parried.");
		CfgDashImpactBlockSfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("DashImpactBlockFX", "BlockSfxPrefab", "", "Optional override SFX prefab name for dash-impact block/parry. Leave blank to use vanilla shield/parry sound.");
		CfgDashPowerAir = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "PowerAir", 28f, "");
		CfgDashAllowInAir = ((BaseUnityPlugin)this).Config.Bind<bool>("Dash", "AllowInAir", true, "");
		CfgDashGroundTotalMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "GroundTotalMultiplier", 5f, "");
		CfgDashGroundBurstSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "GroundBurstSeconds", 0.22f, "");
		CfgDashDisallowEncumbered = ((BaseUnityPlugin)this).Config.Bind<bool>("Dash", "DisallowEncumbered", true, "");
		CfgOverdriveEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Overdrive", "Enabled", true, "Enable/disable Overdrive ability.");
		CfgOverdriveDurationSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Overdrive", "DurationSeconds", 25f, "");
		CfgOverdriveCooldownMinutes = ((BaseUnityPlugin)this).Config.Bind<float>("Overdrive", "CooldownMinutes", 2f, "");
		CfgOverdriveSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Overdrive", "SpeedMultiplier", 2.3f, "");
		CfgOverdriveAllowSwimming = ((BaseUnityPlugin)this).Config.Bind<bool>("Overdrive", "AllowWhileSwimming", false, "");
		CfgDoubleJumpEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DoubleJump", "Enabled", true, "");
		CfgDoubleJumpStaminaCost = ((BaseUnityPlugin)this).Config.Bind<float>("DoubleJump", "StaminaCost", 15f, "");
		CfgDoubleJumpUpwardPower = ((BaseUnityPlugin)this).Config.Bind<float>("DoubleJump", "UpwardPower", 7f, "");
		CfgDoubleJumpAllowWhenEncumbered = ((BaseUnityPlugin)this).Config.Bind<bool>("DoubleJump", "AllowWhenEncumbered", false, "");
		CfgRollEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("LandingRoll", "Enabled", true, "");
		CfgRollTimingWindowMs = ((BaseUnityPlugin)this).Config.Bind<int>("LandingRoll", "TimingWindowMs", 220, "");
		CfgRollMinFallSpeedAbs = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "MinFallSpeedAbs", 10f, "");
		CfgRollDamageReductionPercent = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "DamageReductionPercent", 0.85f, "");
		CfgRollForwardBoost = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "ForwardBoost", 6f, "");
		CfgRollStaminaCost = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "StaminaCost", 5f, "");
		CfgRollCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "CooldownSeconds", 3f, "Cooldown between landing rolls in seconds. Prevents spamming.");
		CfgRollTriggerDodgeAnim = ((BaseUnityPlugin)this).Config.Bind<bool>("LandingRoll", "TriggerDodgeAnimation", true, "");
		CfgRollHealFlat = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "HealFlatOnSuccess", 0f, "Heals this many HP when you successfully perform a landing roll (0 = disabled).");
		CfgRollHealPctMax = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "HealPctMaxOnSuccess", 0f, "Heals this percent of your max HP on successful landing roll (0 = disabled). Example: 0.05 = 5%.");
		CfgRollHealFromPreventedDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("LandingRoll", "HealFromPreventedDamageMultiplier", 0.5f, "Extra heal based on how much fall damage the roll prevented. Example: 0.5 = heal 50% of prevented damage (0 = disabled).");
		CfgWallKickEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("WallKick", "Enabled", true, "");
		CfgWallKickRange = ((BaseUnityPlugin)this).Config.Bind<float>("WallKick", "Range", 0.9f, "");
		CfgWallKickMaxNormalY = ((BaseUnityPlugin)this).Config.Bind<float>("WallKick", "MaxNormalY", 0.35f, "");
		CfgWallKickUpwardPower = ((BaseUnityPlugin)this).Config.Bind<float>("WallKick", "UpwardPower", 6f, "");
		CfgWallKickOutwardPower = ((BaseUnityPlugin)this).Config.Bind<float>("WallKick", "OutwardPower", 7.5f, "");
		CfgWallKickStaminaCost = ((BaseUnityPlugin)this).Config.Bind<float>("WallKick", "StaminaCost", 26f, "");
		CfgWallKickCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("WallKick", "CooldownSeconds", 0.15f, "");
		CfgWallKickAllowWhenEncumbered = ((BaseUnityPlugin)this).Config.Bind<bool>("WallKick", "AllowWhenEncumbered", false, "");
		CfgBlinkEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Blink", "Enabled", true, "");
		CfgBlinkCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "CooldownSeconds", 8f, "");
		CfgBlinkStaminaCost = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "StaminaCost", 0f, "");
		CfgBlinkEitrCost = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "EitrCost", 25f, "Eitr cost for Blink. Set to 0 to disable.");
		CfgBlinkRange = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "Range", 28f, "");
		CfgBlinkBackoff = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "Backoff", 0.6f, "");
		CfgBlinkAllowInAir = ((BaseUnityPlugin)this).Config.Bind<bool>("Blink", "AllowInAir", true, "");
		CfgBlinkAirMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "AirMultiplier", 0.7f, "");
		CfgBlinkFallbackBurstPowerAir = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "FallbackBurstPowerAir", 20f, "");
		CfgBlinkFallbackGroundMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "FallbackGroundMultiplier", 1.2f, "");
		CfgBlinkFallbackBrakeSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "FallbackBrakeSeconds", 0.08f, "");
		CfgBlinkFallbackBrakeToPct = ((BaseUnityPlugin)this).Config.Bind<float>("Blink", "FallbackBrakeToPct", 0.15f, "");
		CfgVfxEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("VFX", "Enabled", true, "");
		CfgDashVfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "DashVFX", "fx_Adrenaline1", "");
		CfgOverdriveVfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "OverdriveVFX", "fx_Fader_Roar", "");
		CfgDoubleJumpVfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "DoubleJumpVFX", "fx_BonusYield", "");
		CfgRollVfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "RollVFX", "vfx_bush_leaf_puff", "");
		CfgWallKickVfxPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "WallKickVFX", "fx_BonusYield", "");
		CfgBlinkVfxStartPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "BlinkStartVFX", "fx_Fader_Fissure_Prespawn", "");
		CfgBlinkVfxEndPrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "BlinkEndVFX", "fx_Fader_Roar_Projectile_Hit", "");
		CfgBlinkVfxFizzlePrefab = ((BaseUnityPlugin)this).Config.Bind<string>("VFX", "BlinkFizzleVFX", "vfx_blocked", "");
		CfgVfxDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("VFX", "DebugLogging", false, "");
		CfgAudioEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Audio", "Enabled", true, "");
		CfgAudioVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Audio", "Volume", 0.85f, "");
		CfgAudioFolder = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "Folder", Path.Combine("Movement", "SFX"), "");
		CfgSfxDashFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "DashFile", "dash.ogg", "");
		CfgSfxSlideFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "SlideFile", "slide.ogg", "");
		CfgSfxRollFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "RollFile", "roll.ogg", "");
		CfgSfxOverdriveFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "OverdriveFile", "overdrive.ogg", "");
		CfgSfxBlinkFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "BlinkFile", "blink.ogg", "");
		CfgSfxBlockFile = ((BaseUnityPlugin)this).Config.Bind<string>("Audio", "BlockFile", "block.ogg", "");
		CfgDebugPopups = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Popups", false, "");
		CfgKnifeAnimLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "LogKnifeSkollSpecialAnimations", true, "When true, logs the animation string used by KnifeSkollAndHati attacks to the BepInEx console.");
		if (CfgKnifeAnimLogging != null && !CfgKnifeAnimLogging.Value)
		{
			CfgKnifeAnimLogging.Value = true;
			try
			{
				((BaseUnityPlugin)this).Config.Save();
			}
			catch
			{
			}
		}
		CfgUiEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "Enabled", false, "Show small draggable cooldown boxes for Dash/Overdrive/Blink.");
		CfgUiShowDash = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowDash", true, "Show Dash cooldown box.");
		CfgUiShowOverdrive = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowOverdrive", true, "Show Overdrive cooldown box.");
		CfgUiShowBlink = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowBlink", true, "Show Blink cooldown box.");
		CfgUiBoxWidth = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "BoxWidth", 150, "Cooldown box width in pixels.");
		CfgUiBoxHeight = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "BoxHeight", 44, "Cooldown box height in pixels.");
		CfgUiFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "FontSize", 14, "Font size used inside the cooldown boxes.");
		CfgUiDebugLogging = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "DebugLogging", false, "Log cooldown UI values for troubleshooting.");
		CfgUiDashX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "DashX", 20f, "Dash box X position.");
		CfgUiDashY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "DashY", 120f, "Dash box Y position.");
		CfgUiOverdriveX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "OverdriveX", 20f, "Overdrive box X position.");
		CfgUiOverdriveY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "OverdriveY", 170f, "Overdrive box Y position.");
		CfgUiBlinkX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "BlinkX", 20f, "Blink box X position.");
		CfgUiBlinkY