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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;
[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.3.0")]
public sealed class MovementPlugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <CoBrakeHorizontal>d__150 : 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__150(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.velocity;
<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.velocity;
<cur>5__8.x = <newHoriz>5__7.x;
<cur>5__8.z = <newHoriz>5__7.z;
<rb>5__1.velocity = <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 <CoGroundBurst>d__146 : 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__146(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__178 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public MovementPlugin <>4__this;
private string <pluginsDir>5__1;
private string <relFolder>5__2;
private string <folder1>5__3;
private string <folder2>5__4;
private string <asmFolder>5__5;
private string <resolved>5__6;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAudioClipsCoroutine>d__178(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<pluginsDir>5__1 = null;
<relFolder>5__2 = null;
<folder1>5__3 = null;
<folder2>5__4 = null;
<asmFolder>5__5 = null;
<resolved>5__6 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (!CfgAudioEnabled.Value)
{
return false;
}
<pluginsDir>5__1 = Paths.PluginPath;
<relFolder>5__2 = CfgAudioFolder.Value ?? Path.Combine("Movement", "SFX");
<folder1>5__3 = Path.Combine(<pluginsDir>5__1, <relFolder>5__2);
<folder2>5__4 = Path.Combine(<pluginsDir>5__1, "Movement");
<asmFolder>5__5 = "";
try
{
<asmFolder>5__5 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? "";
}
catch
{
}
<resolved>5__6 = null;
if (Directory.Exists(<folder1>5__3))
{
<resolved>5__6 = <folder1>5__3;
}
else if (Directory.Exists(<folder2>5__4))
{
<resolved>5__6 = <folder2>5__4;
}
else if (!string.IsNullOrEmpty(<asmFolder>5__5) && Directory.Exists(<asmFolder>5__5))
{
<resolved>5__6 = <asmFolder>5__5;
}
if (<resolved>5__6 == null)
{
return false;
}
<>2__current = <>4__this.LoadOneClip(Path.Combine(<resolved>5__6, CfgSfxDashFile.Value), delegate(AudioClip c)
{
_clipDash = c;
});
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = <>4__this.LoadOneClip(Path.Combine(<resolved>5__6, CfgSfxRollFile.Value), delegate(AudioClip c)
{
_clipRoll = c;
});
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = <>4__this.LoadOneClip(Path.Combine(<resolved>5__6, CfgSfxOverdriveFile.Value), delegate(AudioClip c)
{
_clipOverdrive = c;
});
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>2__current = <>4__this.LoadOneClip(Path.Combine(<resolved>5__6, CfgSfxBlinkFile.Value), delegate(AudioClip c)
{
_clipBlink = c;
});
<>1__state = 4;
return true;
case 4:
<>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 <LoadOneClip>d__179 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public string fullPath;
public Action<AudioClip> assign;
public MovementPlugin <>4__this;
private string <url>5__1;
private UnityWebRequest <www>5__2;
private AudioClip <clip>5__3;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadOneClip>d__179(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
int num = <>1__state;
if (num == -3 || num == 1)
{
try
{
}
finally
{
<>m__Finally1();
}
}
<url>5__1 = null;
<www>5__2 = null;
<clip>5__3 = null;
<>1__state = -2;
}
private bool MoveNext()
{
try
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (string.IsNullOrWhiteSpace(fullPath) || !File.Exists(fullPath))
{
return false;
}
<url>5__1 = "file:///" + fullPath.Replace("\\", "/");
<www>5__2 = UnityWebRequestMultimedia.GetAudioClip(<url>5__1, (AudioType)14);
<>1__state = -3;
<>2__current = <www>5__2.SendWebRequest();
<>1__state = 1;
return true;
case 1:
<>1__state = -3;
<clip>5__3 = DownloadHandlerAudioClip.GetContent(<www>5__2);
if ((Object)(object)<clip>5__3 != (Object)null)
{
assign(<clip>5__3);
}
<clip>5__3 = null;
<>m__Finally1();
<www>5__2 = null;
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;
if (<www>5__2 != null)
{
((IDisposable)<www>5__2).Dispose();
}
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public const string PluginGuid = "Pix.Movement";
public const string PluginName = "Movement";
public const string PluginVersion = "0.3.0";
internal static ManualLogSource Log;
internal static MovementPlugin Instance;
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 SfxRoll = 4;
private const int SfxOverdrive = 5;
private const int SfxBlink = 6;
private static readonly int ZdoDashEndMs = "MV_CD_DashEndMs".GetStableHashCode();
private static readonly int ZdoOverdriveEndMs = "MV_CD_OverdriveEndMs".GetStableHashCode();
private static readonly int ZdoRollIntentEndMs = "MV_RollIntentEndMs".GetStableHashCode();
private static readonly int ZdoBlinkEndMs = "MV_CD_BlinkEndMs".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> 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<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> 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<bool> CfgDebugPopups;
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;
internal const string OverdriveSeName = "mv_overdrive";
internal static readonly int OverdriveSeHash = "mv_overdrive".GetStableHashCode();
internal static SE_Stats OverdriveSe;
private static AudioClip _clipDash;
private static AudioClip _clipRoll;
private static AudioClip _clipOverdrive;
private static AudioClip _clipBlink;
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 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 void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
BindConfig();
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));
if (!_audioLoadStarted)
{
_audioLoadStarted = true;
((MonoBehaviour)this).StartCoroutine(LoadAudioClipsCoroutine());
}
}
private void Update()
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: 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)
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;
_wallKickCooldownEnd = 0f;
}
_prevGrounded = flag;
if (CfgBlinkEnabled.Value && Input.GetKeyDown(CfgBlinkKey.Value) && Input.GetKey(CfgModKey.Value))
{
Host_TryBlink(localPlayer);
return;
}
if (!flag && Input.GetKeyDown((KeyCode)32))
{
if (TryDoWallKick(localPlayer))
{
return;
}
TryArmLandingRoll(localPlayer);
}
if (Input.GetKeyDown(CfgDashKey.Value) && Input.GetKey(CfgModKey.Value))
{
Host_TryDash(localPlayer);
}
else if (Input.GetKeyDown(CfgOverdriveKey.Value) && Input.GetKey(CfgModKey.Value))
{
Host_TryOverdrive(localPlayer);
}
}
private void OnGUI()
{
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Expected O, but got Unknown
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Expected O, but got Unknown
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Invalid comparison between Unknown and I4
//IL_016b: 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_0186: Expected O, but got Unknown
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Expected O, but got Unknown
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
if (CfgUiEnabled == null || !CfgUiEnabled.Value)
{
return;
}
Player p = Player.m_localPlayer;
if ((Object)(object)p == (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;
GUIStyle label = new GUIStyle(GUI.skin.label);
label.alignment = (TextAnchor)4;
label.fontSize = Mathf.Clamp(CfgUiFontSize.Value, 10, 36);
label.normal.textColor = Color.white;
GUIStyle title = new GUIStyle(label);
title.fontStyle = (FontStyle)1;
try
{
if (CfgUiShowDash.Value)
{
_uiDashRect = GUI.Window(12001, _uiDashRect, (WindowFunction)delegate(int id)
{
Ui_DrawCdWindow(id, "Dash", p, ZdoDashEndMs, label, title);
}, GUIContent.none);
}
if (CfgUiShowOverdrive.Value)
{
_uiOverdriveRect = GUI.Window(12002, _uiOverdriveRect, (WindowFunction)delegate(int id)
{
Ui_DrawOverdriveCdWindow(id, p, label, title);
}, GUIContent.none);
}
if (CfgUiShowBlink.Value)
{
_uiBlinkRect = GUI.Window(12003, _uiBlinkRect, (WindowFunction)delegate(int id)
{
Ui_DrawCdWindow(id, "Blink", p, ZdoBlinkEndMs, label, title);
}, 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();
}
}
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;
}
private 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;
}
}
private 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: 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_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0200: Unknown result type (might be due to invalid IL or missing references)
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)
{
return;
}
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);
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 seconds = Mathf.Clamp(CfgDashGroundBurstSeconds.Value, 0.02f, 1f);
if ((Object)(object)Instance != (Object)null)
{
((MonoBehaviour)Instance).StartCoroutine(CoGroundBurst(p, moveDirFromInput, num3, seconds));
}
else
{
ApplyBurstForce(p, moveDirFromInput, num3);
}
}
if (num2 > 0f)
{
((Character)p).UseStamina(num2);
}
long num4 = (long)(Mathf.Max(0f, CfgDashCooldownSeconds.Value) * 1000f);
playerZdo.Set(ZdoDashEndMs, num + num4);
PlayLocalSfx(1, ((Component)p).transform.position);
SpawnAbilityVfx(CfgDashVfxPrefab.Value, p);
}
}
[IteratorStateMachine(typeof(<CoGroundBurst>d__146))]
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__146(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);
}
}
private static void Host_TryOverdrive(Player p)
{
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
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_0125: 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_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: 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_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0228: Unknown result type (might be due to invalid IL or missing references)
//IL_022d: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: 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_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_0382: Unknown result type (might be due to invalid IL or missing references)
//IL_02df: Unknown result type (might be due to invalid IL or missing references)
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);
if (num2 > 0f && p.GetStamina() < num2)
{
return;
}
Vector3 val = GetMoveDirFromInput(p);
if (((Vector3)(ref val)).sqrMagnitude < 0.0001f)
{
val = ((Component)p).transform.forward;
val.y = 0f;
if (((Vector3)(ref val)).sqrMagnitude > 0.0001f)
{
((Vector3)(ref val)).Normalize();
}
}
float num3 = Mathf.Max(0f, CfgBlinkRange.Value);
if (!flag)
{
num3 *= Mathf.Clamp(CfgBlinkAirMultiplier.Value, 0f, 2f);
}
float num4 = Mathf.Max(0f, CfgBlinkBackoff.Value);
Vector3 val2 = ((Component)p).transform.position + Vector3.up * 1f;
Vector3 position = ((Component)p).transform.position;
Vector3 pos = position + val * num3;
int num5 = -5;
RaycastHit val3 = default(RaycastHit);
if (Physics.Raycast(val2, val, ref val3, num3, num5, (QueryTriggerInteraction)1))
{
pos = ((RaycastHit)(ref val3)).point - val * num4;
}
if (!IsDestinationClear(pos))
{
SpawnAbilityVfx(CfgBlinkVfxFizzlePrefab.Value, p);
return;
}
if (num2 > 0f)
{
((Character)p).UseStamina(num2);
}
SpawnVfxAt(CfgBlinkVfxStartPrefab.Value, position);
if (!TrySilentTeleport(p, pos))
{
float num6 = Mathf.Max(0f, CfgBlinkFallbackBurstPowerAir.Value);
if (flag)
{
num6 *= Mathf.Max(0f, CfgBlinkFallbackGroundMultiplier.Value);
}
ApplyBurstForce(p, val, num6);
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, pos);
long num7 = (long)(Mathf.Max(0f, CfgBlinkCooldownSeconds.Value) * 1000f);
playerZdo.Set(ZdoBlinkEndMs, num + num7);
PlayLocalSfx(6, ((Component)p).transform.position);
}
}
[IteratorStateMachine(typeof(<CoBrakeHorizontal>d__150))]
private static IEnumerator CoBrakeHorizontal(Player p, float seconds, float toPct)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <CoBrakeHorizontal>d__150(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 velocity = rigidbody.velocity;
if (velocity.y < 0f)
{
velocity.y = 0f;
}
rigidbody.velocity = velocity;
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 velocity = rigidbody.velocity;
if (velocity.y < 0f)
{
velocity.y = 0f;
}
rigidbody.velocity = velocity;
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;
}
float absFallSpeed = GetAbsFallSpeed(p);
if (!(absFallSpeed < CfgRollMinFallSpeedAbs.Value))
{
ZDO playerZdo = GetPlayerZdo(p);
if (playerZdo != null)
{
long num = NowMs();
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_0015: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)p == (Object)null))
{
PlayLocalSfx(4, ((Component)p).transform.position);
SpawnAbilityVfx(CfgRollVfxPrefab.Value, p);
if (CfgRollTriggerDodgeAnim.Value)
{
TryPlayDodge(p);
}
}
}
private 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
{
}
}
private 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)
{
try
{
if ((Object)(object)ZNetScene.instance != (Object)null)
{
val = ZNetScene.instance.GetPrefab(name.GetStableHashCode());
}
}
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 Vector3 GetMoveDirFromInput(Player p)
{
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: 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_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: 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)
float num = 0f;
float num2 = 0f;
if (Input.GetKey((KeyCode)119))
{
num += 1f;
}
if (Input.GetKey((KeyCode)115))
{
num -= 1f;
}
if (Input.GetKey((KeyCode)100))
{
num2 += 1f;
}
if (Input.GetKey((KeyCode)97))
{
num2 -= 1f;
}
Transform val = null;
try
{
if ((Object)(object)GameCamera.instance != (Object)null)
{
val = ((Component)GameCamera.instance).transform;
}
}
catch
{
}
if ((Object)(object)val == (Object)null)
{
val = ((Component)p).transform;
}
Vector3 forward = val.forward;
forward.y = 0f;
Vector3 right = val.right;
right.y = 0f;
if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f)
{
((Vector3)(ref forward)).Normalize();
}
if (((Vector3)(ref right)).sqrMagnitude > 0.0001f)
{
((Vector3)(ref right)).Normalize();
}
Vector3 val2 = forward * num + right * num2;
val2.y = 0f;
if (((Vector3)(ref val2)).sqrMagnitude > 0.01f)
{
return ((Vector3)(ref val2)).normalized;
}
Vector3 forward2 = ((Component)p).transform.forward;
forward2.y = 0f;
if (((Vector3)(ref forward2)).sqrMagnitude > 0.0001f)
{
((Vector3)(ref forward2)).Normalize();
}
return forward2;
}
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.velocity.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", "");
CfgDashCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "CooldownSeconds", 3f, "");
CfgDashStaminaCost = ((BaseUnityPlugin)this).Config.Bind<float>("Dash", "StaminaCost", 20f, "");
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, "");
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, "");
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", 36f, "");
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", "");
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", "");
CfgDebugPopups = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Popups", false, "");
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 = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "BlinkY", 220f, "Blink box Y position.");
_uiRectsInitialized = false;
}
private static void ShowMsg(string text)
{
if ((Object)(object)MessageHud.instance != (Object)null)
{
MessageHud.instance.ShowMessage((MessageType)1, text, 0, (Sprite)null, false);
}
}
private static void PlayLocalSfx(int sfxId, Vector3 pos)
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (CfgAudioEnabled.Value)
{
AudioClip val = null;
switch (sfxId)
{
case 1:
val = _clipDash;
break;
case 4:
val = _clipRoll;
break;
case 5:
val = _clipOverdrive;
break;
case 6:
val = _clipBlink;
break;
}
if (!((Object)(object)val == (Object)null))
{
float num = Mathf.Clamp(CfgAudioVolume.Value, 0f, 1f);
AudioSource.PlayClipAtPoint(val, pos, num);
}
}
}
[IteratorStateMachine(typeof(<LoadAudioClipsCoroutine>d__178))]
private IEnumerator LoadAudioClipsCoroutine()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAudioClipsCoroutine>d__178(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<LoadOneClip>d__179))]
private IEnumerator LoadOneClip(string fullPath, Action<AudioClip> assign)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadOneClip>d__179(0)
{
<>4__this = this,
fullPath = fullPath,
assign = assign
};
}
}
[HarmonyPatch(typeof(Character), "Jump")]
internal static class CharacterJumpPatch
{
[HarmonyPrefix]
private static bool Prefix(Character __instance, bool force)
{
try
{
Player localPlayer = Player.m_localPlayer;
if ((Object)(object)__instance == (Object)null || (Object)(object)localPlayer == (Object)null)
{
return true;
}
Player val = (Player)(object)((__instance is Player) ? __instance : null);
if ((Object)(object)val == (Object)null)
{
return true;
}
if ((Object)(object)val != (Object)(object)localPlayer)
{
return true;
}
if (((Character)val).IsOnGround())
{
return true;
}
MovementPlugin instance = MovementPlugin.Instance;
if ((Object)(object)instance == (Object)null)
{
return true;
}
if (instance.TryDoDoubleJumpFromJump(val))
{
return false;
}
return true;
}
catch
{
return true;
}
}
}
[HarmonyPatch]
internal static class ObjectDbPatches
{
[HarmonyPatch(typeof(ObjectDB), "Awake")]
[HarmonyPostfix]
private static void ObjectDB_Awake_Postfix(ObjectDB __instance)
{
TryRegisterOverdrive(__instance);
}
[HarmonyPatch(typeof(ObjectDB), "CopyOtherDB")]
[HarmonyPostfix]
private static void ObjectDB_CopyOtherDB_Postfix(ObjectDB __instance)
{
TryRegisterOverdrive(__instance);
}
private static void TryRegisterOverdrive(ObjectDB db)
{
if ((Object)(object)db == (Object)null)
{
return;
}
StatusEffect statusEffect = db.GetStatusEffect(MovementPlugin.OverdriveSeHash);
SE_Stats val = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null);
if ((Object)(object)val != (Object)null)
{
MovementPlugin.OverdriveSe = val;
return;
}
SE_Stats val2 = ScriptableObject.CreateInstance<SE_Stats>();
((Object)val2).name = "mv_overdrive";
((StatusEffect)val2).m_name = "Overdrive";
((StatusEffect)val2).m_tooltip = "Speed surges for a short time.";
Sprite icon = null;
try
{
StatusEffect statusEffect2 = db.GetStatusEffect("Rested".GetStableHashCode());
if ((Object)(object)statusEffect2 != (Object)null)
{
icon = statusEffect2.m_icon;
}
}
catch
{
}
((StatusEffect)val2).m_icon = icon;
val2.m_speedModifier = 1.2f;
db.m_StatusEffects.Add((StatusEffect)(object)val2);
MovementPlugin.OverdriveSe = val2;
}
}
[HarmonyPatch]
internal static class TerminalPatches
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static ConsoleEvent <>9__1_0;
public static ConsoleEvent <>9__1_1;
public static ConsoleEvent <>9__1_2;
public static ConsoleEvent <>9__1_3;
public static ConsoleEvent <>9__1_4;
public static ConsoleEvent <>9__1_5;
internal void <Terminal_InitTerminal_Postfix>b__1_0(ConsoleEventArgs args)
{
if (args.Length < 2)
{
MovementPlugin.Cmd_Bypass(on: true);
return;
}
string text = args[1].ToLowerInvariant();
MovementPlugin.Cmd_Bypass(text == "on" || text == "true" || text == "1");
}
internal void <Terminal_InitTerminal_Postfix>b__1_1(ConsoleEventArgs args)
{
if (args.Length < 2)
{
MovementPlugin.Cmd_Unlock("all");
}
else
{
MovementPlugin.Cmd_Unlock(args[1]);
}
}
internal void <Terminal_InitTerminal_Postfix>b__1_2(ConsoleEventArgs args)
{
MovementPlugin.Cmd_Status();
}
internal void <Terminal_InitTerminal_Postfix>b__1_3(ConsoleEventArgs args)
{
if (args.Length < 2)
{
MessageHud instance = MessageHud.instance;
if (instance != null)
{
instance.ShowMessage((MessageType)1, "[MV] Usage: mv_vfx <prefabName>", 0, (Sprite)null, false);
}
}
else
{
MovementPlugin.Cmd_VfxTest(args[1]);
}
}
internal void <Terminal_InitTerminal_Postfix>b__1_4(ConsoleEventArgs args)
{
string term = ((args.Length >= 2) ? args[1] : "vfx");
int result = 60;
if (args.Length >= 3)
{
int.TryParse(args[2], out result);
}
MovementPlugin.Cmd_VfxFind(term, Mathf.Clamp(result, 5, 300));
}
internal void <Terminal_InitTerminal_Postfix>b__1_5(ConsoleEventArgs args)
{
MovementPlugin.Cmd_VfxList();
}
}
private static bool _registered;
[HarmonyPatch(typeof(Terminal), "InitTerminal")]
[HarmonyPostfix]
private static void Terminal_InitTerminal_Postfix()
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Expected O, but got Unknown
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Expected O, but got Unknown
//IL_0128: 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_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Expected O, but got Unknown
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Expected O, but got Unknown
if (_registered)
{
return;
}
_registered = true;
try
{
object obj = <>c.<>9__1_0;
if (obj == null)
{
ConsoleEvent val = delegate(ConsoleEventArgs args)
{
if (args.Length < 2)
{
MovementPlugin.Cmd_Bypass(on: true);
}
else
{
string text = args[1].ToLowerInvariant();
MovementPlugin.Cmd_Bypass(text == "on" || text == "true" || text == "1");
}
};
<>c.<>9__1_0 = val;
obj = (object)val;
}
new ConsoleCommand("mv_bypass", "mv_bypass on|off", (ConsoleEvent)obj, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
object obj2 = <>c.<>9__1_1;
if (obj2 == null)
{
ConsoleEvent val2 = delegate(ConsoleEventArgs args)
{
if (args.Length < 2)
{
MovementPlugin.Cmd_Unlock("all");
}
else
{
MovementPlugin.Cmd_Unlock(args[1]);
}
};
<>c.<>9__1_1 = val2;
obj2 = (object)val2;
}
new ConsoleCommand("mv_unlock", "mv_unlock dash|overdrive|doublejump|roll|wallkick|blink|all|none", (ConsoleEvent)obj2, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
object obj3 = <>c.<>9__1_2;
if (obj3 == null)
{
ConsoleEvent val3 = delegate
{
MovementPlugin.Cmd_Status();
};
<>c.<>9__1_2 = val3;
obj3 = (object)val3;
}
new ConsoleCommand("mv_status", "mv_status", (ConsoleEvent)obj3, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
object obj4 = <>c.<>9__1_3;
if (obj4 == null)
{
ConsoleEvent val4 = delegate(ConsoleEventArgs args)
{
if (args.Length < 2)
{
MessageHud instance = MessageHud.instance;
if (instance != null)
{
instance.ShowMessage((MessageType)1, "[MV] Usage: mv_vfx <prefabName>", 0, (Sprite)null, false);
}
}
else
{
MovementPlugin.Cmd_VfxTest(args[1]);
}
};
<>c.<>9__1_3 = val4;
obj4 = (object)val4;
}
new ConsoleCommand("mv_vfx", "mv_vfx <prefabName>", (ConsoleEvent)obj4, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
object obj5 = <>c.<>9__1_4;
if (obj5 == null)
{
ConsoleEvent val5 = delegate(ConsoleEventArgs args)
{
string term = ((args.Length >= 2) ? args[1] : "vfx");
int result = 60;
if (args.Length >= 3)
{
int.TryParse(args[2], out result);
}
MovementPlugin.Cmd_VfxFind(term, Mathf.Clamp(result, 5, 300));
};
<>c.<>9__1_4 = val5;
obj5 = (object)val5;
}
new ConsoleCommand("mv_vfx_find", "mv_vfx_find <term> [limit]", (ConsoleEvent)obj5, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
object obj6 = <>c.<>9__1_5;
if (obj6 == null)
{
ConsoleEvent val6 = delegate
{
MovementPlugin.Cmd_VfxList();
};
<>c.<>9__1_5 = val6;
obj6 = (object)val6;
}
new ConsoleCommand("mv_vfx_list", "mv_vfx_list", (ConsoleEvent)obj6, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false);
MovementPlugin.Log.LogInfo((object)"[MV] Console commands registered");
}
catch (Exception ex)
{
MovementPlugin.Log.LogWarning((object)("[MV] Failed to register console commands: " + ex));
}
}
}
[HarmonyPatch]
internal static class CharacterDamagePatch
{
private struct RollHealState
{
public bool DidRoll;
public float Prevented;
}
[HarmonyPatch(typeof(Character), "Damage")]
[HarmonyPrefix]
private static void DamagePrefix(Character __instance, ref HitData hit, ref RollHealState __state)
{
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Invalid comparison between Unknown and I4
//IL_01ad: 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_00c1: 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)
try
{
__state = default(RollHealState);
Player val = (Player)(object)((__instance is Player) ? __instance : null);
if ((Object)(object)val == (Object)null)
{
return;
}
ZNetView component = ((Component)val).GetComponent<ZNetView>();
if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner() || hit == null || (int)hit.m_hitType != 3 || !MovementPlugin.TryConsumeRollIntent(val, out var reducePct, out var forwardBoost, out var staminaCost) || (staminaCost > 0f && val.GetStamina() < staminaCost))
{
return;
}
float prevented = 0f;
try
{
_ = hit.m_damage;
float totalDamage = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage();
((DamageTypes)(ref hit.m_damage)).Modify(1f - reducePct);
_ = hit.m_damage;
float totalDamage2 = ((DamageTypes)(ref hit.m_damage)).GetTotalDamage();
prevented = Mathf.Max(0f, totalDamage - totalDamage2);
}
catch
{
((DamageTypes)(ref hit.m_damage)).Modify(1f - reducePct);
}
if (staminaCost > 0f)
{
((Character)val).UseStamina(staminaCost);
}
Rigidbody val2 = ((Component)val).GetComponent<Rigidbody>() ?? ((Component)val).GetComponentInChildren<Rigidbody>();
if ((Object)(object)val2 != (Object)null && forwardBoost > 0f)
{
Vector3 forward = ((Component)val).transform.forward;
forward.y = 0f;
if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f)
{
((Vector3)(ref forward)).Normalize();
}
val2.AddForce(forward * forwardBoost, (ForceMode)2);
}
MovementPlugin.OnRollSuccess(val);
__state = new RollHealState
{
DidRoll = true,
Prevented = prevented
};
}
catch
{
}
}
[HarmonyPatch(typeof(Character), "Damage")]
[HarmonyPostfix]
private static void DamagePostfix(Character __instance, HitData hit, RollHealState __state)
{
try
{
if (!__state.DidRoll)
{
return;
}
Player val = (Player)(object)((__instance is Player) ? __instance : null);
if (!((Object)(object)val == (Object)null))
{
ZNetView component = ((Component)val).GetComponent<ZNetView>();
if (!((Object)(object)component == (Object)null) && component.IsValid() && component.IsOwner())
{
MovementPlugin.TryApplyRollHeal(val, __state.Prevented);
}
}
}
catch
{
}
}
}
internal static class StableHashExtensions
{
public static int GetStableHashCode(this string str)
{
if (str == null)
{
return 0;
}
int num = 5381;
int num2 = num;
for (int i = 0; i < str.Length && str[i] != 0; i += 2)
{
num = ((num << 5) + num) ^ str[i];
if (i == str.Length - 1 || str[i + 1] == '\0')
{
break;
}
num2 = ((num2 << 5) + num2) ^ str[i + 1];
}
return num + num2 * 1566083941;
}
}