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 ?? ""; 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 d__212 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player p; public float seconds; public float toPct; private Rigidbody 5__1; private Vector3 5__2; private Vector3 5__3; private float 5__4; private float 5__5; private Vector3 5__6; private Vector3 5__7; private Vector3 5__8; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__212(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 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; 5__1 = GetRigidbody(p); if ((Object)(object)5__1 == (Object)null) { return false; } 5__2 = 5__1.linearVelocity; 5__3 = new Vector3(5__2.x, 0f, 5__2.z); 5__4 = 0f; break; case 1: <>1__state = -1; break; } if (5__4 < seconds) { if ((Object)(object)p == (Object)null || (Object)(object)5__1 == (Object)null) { return false; } 5__4 += Time.deltaTime; 5__5 = Mathf.Clamp01(5__4 / seconds); 5__6 = 5__3 * toPct; 5__7 = Vector3.Lerp(5__3, 5__6, 5__5); 5__8 = 5__1.linearVelocity; 5__8.x = 5__7.x; 5__8.z = 5__7.z; 5__1.linearVelocity = 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 d__207 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player p; public float delaySeconds; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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 d__205 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player p; public Vector3 dir; public float totalImpulse; public float seconds; private Rigidbody 5__1; private float 5__2; private float
5__3; private float 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__205(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 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; 5__1 = GetRigidbody(p); if ((Object)(object)5__1 == (Object)null) { return false; } dir.y = 0f; if (((Vector3)(ref dir)).sqrMagnitude < 0.0001f) { return false; } ((Vector3)(ref dir)).Normalize(); 5__2 = 0f; break; case 1: <>1__state = -1; break; } if (5__2 < seconds) { if ((Object)(object)p == (Object)null || (Object)(object)5__1 == (Object)null) { return false; }
5__3 = Time.deltaTime; 5__2 +=
5__3; 5__4 = totalImpulse / seconds *
5__3; 5__1.AddForce(dir * 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 d__252 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public MovementPlugin <>4__this; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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 d__253 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string resourceName; public Action assign; public MovementPlugin <>4__this; private byte[] 5__1; private string 5__2; private Assembly 5__3; private string[] 5__4; private string 5__5; private int 5__6; private Stream 5__7; private MemoryStream 5__8; private string 5__9; private UnityWebRequest 5__10; private AudioClip 5__11; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public 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(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__7 = null; 5__8 = null; 5__9 = null; 5__10 = null; 5__11 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; try { 5__3 = Assembly.GetExecutingAssembly(); 5__4 = 5__3.GetManifestResourceNames(); 5__5 = null; 5__6 = 0; while (5__6 < 5__4.Length) { if (5__4[5__6].EndsWith(resourceName, StringComparison.OrdinalIgnoreCase) || 5__4[5__6] == resourceName) { 5__5 = 5__4[5__6]; break; } 5__6++; } if (5__5 != null) { 5__7 = 5__3.GetManifestResourceStream(5__5); try { if (5__7 != null) { 5__8 = new MemoryStream(); try { 5__7.CopyTo(5__8); 5__1 = 5__8.ToArray(); } finally { if (5__8 != null) { ((IDisposable)5__8).Dispose(); } } 5__8 = null; } } finally { if (5__7 != null) { ((IDisposable)5__7).Dispose(); } } 5__7 = null; } 5__3 = null; 5__4 = null; 5__5 = null; } catch { 5__1 = null; } if (5__1 == null || 5__1.Length == 0) { return false; } 5__2 = Path.Combine(Path.GetTempPath(), "mv_" + Guid.NewGuid().ToString() + ".ogg"); <>1__state = -3; File.WriteAllBytes(5__2, 5__1); 5__9 = "file:///" + 5__2.Replace("\\", "/"); 5__10 = UnityWebRequestMultimedia.GetAudioClip(5__9, (AudioType)14); <>1__state = -4; <>2__current = 5__10.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -4; 5__11 = DownloadHandlerAudioClip.GetContent(5__10); if ((Object)(object)5__11 != (Object)null) { assign(5__11); } 5__11 = null; <>m__Finally2(); 5__10 = null; 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(5__2)) { File.Delete(5__2); } } catch { } } private void <>m__Finally2() { <>1__state = -3; if (5__10 != null) { ((IDisposable)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 CfgModKey; private static ConfigEntry CfgDashKey; private static ConfigEntry CfgOverdriveKey; private static ConfigEntry CfgBlinkKey; private static ConfigEntry CfgDashEnabled; private static ConfigEntry CfgOverdriveEnabled; private static ConfigEntry CfgDashImpactEnabled; private static ConfigEntry CfgDashImpactRange; private static ConfigEntry CfgDashImpactConeDeg; private static ConfigEntry CfgDashImpactBluntDamage; private static ConfigEntry CfgDashImpactPushForce; private static ConfigEntry CfgDashImpactCooldownSeconds; private static ConfigEntry CfgDashImpactHitPlayers; private static ConfigEntry CfgDashImpactBlockVfxEnabled; private static ConfigEntry CfgDashImpactBlockVfxPrefab; private static ConfigEntry CfgDashImpactBlockSfxEnabled; private static ConfigEntry CfgDashImpactBlockSfxPrefab; private static ConfigEntry CfgRequireProgression; private static ConfigEntry CfgShowLockedMessages; private static ConfigEntry CfgDashKeyRequired; private static ConfigEntry CfgOverdriveKeyRequired; private static ConfigEntry CfgDoubleJumpKeyRequired; private static ConfigEntry CfgRollKeyRequired; private static ConfigEntry CfgWallKickKeyRequired; private static ConfigEntry CfgBlinkKeyRequired; private static ConfigEntry CfgDashCooldownSeconds; private static ConfigEntry CfgDashStaminaCost; private static ConfigEntry CfgDashPowerAir; private static ConfigEntry CfgDashAllowInAir; private static ConfigEntry CfgDashGroundTotalMultiplier; private static ConfigEntry CfgDashGroundBurstSeconds; private static ConfigEntry CfgDashDisallowEncumbered; private static ConfigEntry CfgOverdriveDurationSeconds; private static ConfigEntry CfgOverdriveCooldownMinutes; private static ConfigEntry CfgOverdriveSpeedMultiplier; private static ConfigEntry CfgOverdriveAllowSwimming; private static ConfigEntry CfgDoubleJumpEnabled; private static ConfigEntry CfgDoubleJumpStaminaCost; private static ConfigEntry CfgDoubleJumpUpwardPower; private static ConfigEntry CfgDoubleJumpAllowWhenEncumbered; private static ConfigEntry CfgRollEnabled; private static ConfigEntry CfgRollTimingWindowMs; private static ConfigEntry CfgRollMinFallSpeedAbs; private static ConfigEntry CfgRollDamageReductionPercent; private static ConfigEntry CfgRollForwardBoost; private static ConfigEntry CfgRollStaminaCost; private static ConfigEntry CfgRollCooldownSeconds; private static ConfigEntry CfgRollTriggerDodgeAnim; private static ConfigEntry CfgRollHealFlat; private static ConfigEntry CfgRollHealPctMax; private static ConfigEntry CfgRollHealFromPreventedDamageMultiplier; private static ConfigEntry CfgWallKickEnabled; private static ConfigEntry CfgWallKickRange; private static ConfigEntry CfgWallKickMaxNormalY; private static ConfigEntry CfgWallKickUpwardPower; private static ConfigEntry CfgWallKickOutwardPower; private static ConfigEntry CfgWallKickStaminaCost; private static ConfigEntry CfgWallKickCooldownSeconds; private static ConfigEntry CfgWallKickAllowWhenEncumbered; private static ConfigEntry CfgBlinkEnabled; private static ConfigEntry CfgBlinkCooldownSeconds; private static ConfigEntry CfgBlinkStaminaCost; private static ConfigEntry CfgBlinkEitrCost; private static ConfigEntry CfgBlinkRange; private static ConfigEntry CfgBlinkBackoff; private static ConfigEntry CfgBlinkAllowInAir; private static ConfigEntry CfgBlinkAirMultiplier; private static ConfigEntry CfgBlinkFallbackBurstPowerAir; private static ConfigEntry CfgBlinkFallbackGroundMultiplier; private static ConfigEntry CfgBlinkFallbackBrakeSeconds; private static ConfigEntry CfgBlinkFallbackBrakeToPct; private static ConfigEntry CfgVfxEnabled; private static ConfigEntry CfgDashVfxPrefab; private static ConfigEntry CfgOverdriveVfxPrefab; private static ConfigEntry CfgDoubleJumpVfxPrefab; private static ConfigEntry CfgRollVfxPrefab; private static ConfigEntry CfgWallKickVfxPrefab; private static ConfigEntry CfgBlinkVfxStartPrefab; private static ConfigEntry CfgBlinkVfxEndPrefab; private static ConfigEntry CfgBlinkVfxFizzlePrefab; private static ConfigEntry CfgVfxDebugLogging; private static ConfigEntry CfgAudioEnabled; private static ConfigEntry CfgAudioVolume; private static ConfigEntry CfgAudioFolder; private static ConfigEntry CfgSfxDashFile; private static ConfigEntry CfgSfxRollFile; private static ConfigEntry CfgSfxOverdriveFile; private static ConfigEntry CfgSfxBlinkFile; private static ConfigEntry CfgSfxBlockFile; private static ConfigEntry CfgSfxSlideFile; private static ConfigEntry CfgDebugPopups; private static ConfigEntry CfgKnifeAnimLogging; private static ConfigEntry CfgUiEnabled; private static ConfigEntry CfgUiShowDash; private static ConfigEntry CfgUiShowOverdrive; private static ConfigEntry CfgUiShowBlink; private static ConfigEntry CfgUiBoxWidth; private static ConfigEntry CfgUiBoxHeight; private static ConfigEntry CfgUiFontSize; private static ConfigEntry CfgUiDebugLogging; private static ConfigEntry CfgUiDashX; private static ConfigEntry CfgUiDashY; private static ConfigEntry CfgUiOverdriveX; private static ConfigEntry CfgUiOverdriveY; private static ConfigEntry CfgUiBlinkX; private static ConfigEntry 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 FR_Humanoid_leftItem = AccessTools.FieldRefAccess("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 _knifeAnimLogQueue = new Queue(); 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 _vfxCache = new Dictionary(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 _debugUnlocks = new HashSet(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(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 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(d__207))] private static IEnumerator CoDashImpactAfter(Player p, float delaySeconds) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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 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(); } } 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(d__212))] private static IEnumerator CoBrakeHorizontal(Player p, float seconds, float toPct) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new 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(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(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 "); return; } GameObject val = FindVfxPrefab(prefabName); if ((Object)(object)val == (Object)null) { ShowMsg("[MV] VFX NOT FOUND: " + prefabName); return; } try { Object.Instantiate(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(); if ((Object)(object)component != (Object)null) { return component; } return ((Component)p).GetComponentInChildren(); } private static ZDO GetPlayerZdo(Player p) { ZNetView component = ((Component)p).GetComponent(); 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("Input", "ModifierKey", (KeyCode)304, ""); CfgDashKey = ((BaseUnityPlugin)this).Config.Bind("Input", "DashKey", (KeyCode)101, ""); CfgOverdriveKey = ((BaseUnityPlugin)this).Config.Bind("Input", "OverdriveKey", (KeyCode)114, ""); CfgBlinkKey = ((BaseUnityPlugin)this).Config.Bind("Input", "BlinkKey", (KeyCode)113, ""); CfgRequireProgression = ((BaseUnityPlugin)this).Config.Bind("Progression", "RequireBossKeys", true, ""); CfgShowLockedMessages = ((BaseUnityPlugin)this).Config.Bind("Progression", "ShowLockedMessages", false, ""); CfgDashKeyRequired = ((BaseUnityPlugin)this).Config.Bind("Progression", "DashRequiresKey", "defeated_eikthyr", ""); CfgOverdriveKeyRequired = ((BaseUnityPlugin)this).Config.Bind("Progression", "OverdriveRequiresKey", "defeated_gdking", ""); CfgDoubleJumpKeyRequired = ((BaseUnityPlugin)this).Config.Bind("Progression", "DoubleJumpRequiresKey", "defeated_bonemass", ""); CfgRollKeyRequired = ((BaseUnityPlugin)this).Config.Bind("Progression", "RollRequiresKey", "defeated_dragon", ""); CfgWallKickKeyRequired = ((BaseUnityPlugin)this).Config.Bind("Progression", "WallKickRequiresKey", "defeated_goblinking", ""); CfgBlinkKeyRequired = ((BaseUnityPlugin)this).Config.Bind("Progression", "BlinkRequiresKey", "defeated_queen", ""); CfgDashEnabled = ((BaseUnityPlugin)this).Config.Bind("Dash", "Enabled", true, "Enable/disable Dash ability."); CfgDashCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("Dash", "CooldownSeconds", 3f, ""); CfgDashStaminaCost = ((BaseUnityPlugin)this).Config.Bind("Dash", "StaminaCost", 20f, ""); CfgDashImpactEnabled = ((BaseUnityPlugin)this).Config.Bind("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("DashImpact", "Range", 2.8f, "Range (meters) to search for an enemy at dash end."); CfgDashImpactConeDeg = ((BaseUnityPlugin)this).Config.Bind("DashImpact", "ConeDeg", 70f, "Forward cone angle for dash impact (degrees)."); CfgDashImpactBluntDamage = ((BaseUnityPlugin)this).Config.Bind("DashImpact", "BluntDamage", 8f, "Blunt damage dealt by dash impact."); CfgDashImpactPushForce = ((BaseUnityPlugin)this).Config.Bind("DashImpact", "PushForce", 35f, "Push force for dash impact."); CfgDashImpactCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("DashImpact", "CooldownSeconds", 1f, "Cooldown (seconds) between dash impacts."); CfgDashImpactHitPlayers = ((BaseUnityPlugin)this).Config.Bind("DashImpact", "HitPlayers", false, "If true, dash impact can hit other players when PvP is enabled."); CfgDashImpactBlockVfxEnabled = ((BaseUnityPlugin)this).Config.Bind("DashImpactBlockFX", "BlockVfxEnabled", true, "If true, plays a VFX when dash impact is blocked/parried."); CfgDashImpactBlockVfxPrefab = ((BaseUnityPlugin)this).Config.Bind("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("DashImpactBlockFX", "BlockSfxEnabled", true, "If true, plays a SFX when dash impact is blocked/parried."); CfgDashImpactBlockSfxPrefab = ((BaseUnityPlugin)this).Config.Bind("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("Dash", "PowerAir", 28f, ""); CfgDashAllowInAir = ((BaseUnityPlugin)this).Config.Bind("Dash", "AllowInAir", true, ""); CfgDashGroundTotalMultiplier = ((BaseUnityPlugin)this).Config.Bind("Dash", "GroundTotalMultiplier", 5f, ""); CfgDashGroundBurstSeconds = ((BaseUnityPlugin)this).Config.Bind("Dash", "GroundBurstSeconds", 0.22f, ""); CfgDashDisallowEncumbered = ((BaseUnityPlugin)this).Config.Bind("Dash", "DisallowEncumbered", true, ""); CfgOverdriveEnabled = ((BaseUnityPlugin)this).Config.Bind("Overdrive", "Enabled", true, "Enable/disable Overdrive ability."); CfgOverdriveDurationSeconds = ((BaseUnityPlugin)this).Config.Bind("Overdrive", "DurationSeconds", 25f, ""); CfgOverdriveCooldownMinutes = ((BaseUnityPlugin)this).Config.Bind("Overdrive", "CooldownMinutes", 2f, ""); CfgOverdriveSpeedMultiplier = ((BaseUnityPlugin)this).Config.Bind("Overdrive", "SpeedMultiplier", 2.3f, ""); CfgOverdriveAllowSwimming = ((BaseUnityPlugin)this).Config.Bind("Overdrive", "AllowWhileSwimming", false, ""); CfgDoubleJumpEnabled = ((BaseUnityPlugin)this).Config.Bind("DoubleJump", "Enabled", true, ""); CfgDoubleJumpStaminaCost = ((BaseUnityPlugin)this).Config.Bind("DoubleJump", "StaminaCost", 15f, ""); CfgDoubleJumpUpwardPower = ((BaseUnityPlugin)this).Config.Bind("DoubleJump", "UpwardPower", 7f, ""); CfgDoubleJumpAllowWhenEncumbered = ((BaseUnityPlugin)this).Config.Bind("DoubleJump", "AllowWhenEncumbered", false, ""); CfgRollEnabled = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "Enabled", true, ""); CfgRollTimingWindowMs = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "TimingWindowMs", 220, ""); CfgRollMinFallSpeedAbs = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "MinFallSpeedAbs", 10f, ""); CfgRollDamageReductionPercent = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "DamageReductionPercent", 0.85f, ""); CfgRollForwardBoost = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "ForwardBoost", 6f, ""); CfgRollStaminaCost = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "StaminaCost", 5f, ""); CfgRollCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "CooldownSeconds", 3f, "Cooldown between landing rolls in seconds. Prevents spamming."); CfgRollTriggerDodgeAnim = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "TriggerDodgeAnimation", true, ""); CfgRollHealFlat = ((BaseUnityPlugin)this).Config.Bind("LandingRoll", "HealFlatOnSuccess", 0f, "Heals this many HP when you successfully perform a landing roll (0 = disabled)."); CfgRollHealPctMax = ((BaseUnityPlugin)this).Config.Bind("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("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("WallKick", "Enabled", true, ""); CfgWallKickRange = ((BaseUnityPlugin)this).Config.Bind("WallKick", "Range", 0.9f, ""); CfgWallKickMaxNormalY = ((BaseUnityPlugin)this).Config.Bind("WallKick", "MaxNormalY", 0.35f, ""); CfgWallKickUpwardPower = ((BaseUnityPlugin)this).Config.Bind("WallKick", "UpwardPower", 6f, ""); CfgWallKickOutwardPower = ((BaseUnityPlugin)this).Config.Bind("WallKick", "OutwardPower", 7.5f, ""); CfgWallKickStaminaCost = ((BaseUnityPlugin)this).Config.Bind("WallKick", "StaminaCost", 26f, ""); CfgWallKickCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("WallKick", "CooldownSeconds", 0.15f, ""); CfgWallKickAllowWhenEncumbered = ((BaseUnityPlugin)this).Config.Bind("WallKick", "AllowWhenEncumbered", false, ""); CfgBlinkEnabled = ((BaseUnityPlugin)this).Config.Bind("Blink", "Enabled", true, ""); CfgBlinkCooldownSeconds = ((BaseUnityPlugin)this).Config.Bind("Blink", "CooldownSeconds", 8f, ""); CfgBlinkStaminaCost = ((BaseUnityPlugin)this).Config.Bind("Blink", "StaminaCost", 0f, ""); CfgBlinkEitrCost = ((BaseUnityPlugin)this).Config.Bind("Blink", "EitrCost", 25f, "Eitr cost for Blink. Set to 0 to disable."); CfgBlinkRange = ((BaseUnityPlugin)this).Config.Bind("Blink", "Range", 28f, ""); CfgBlinkBackoff = ((BaseUnityPlugin)this).Config.Bind("Blink", "Backoff", 0.6f, ""); CfgBlinkAllowInAir = ((BaseUnityPlugin)this).Config.Bind("Blink", "AllowInAir", true, ""); CfgBlinkAirMultiplier = ((BaseUnityPlugin)this).Config.Bind("Blink", "AirMultiplier", 0.7f, ""); CfgBlinkFallbackBurstPowerAir = ((BaseUnityPlugin)this).Config.Bind("Blink", "FallbackBurstPowerAir", 20f, ""); CfgBlinkFallbackGroundMultiplier = ((BaseUnityPlugin)this).Config.Bind("Blink", "FallbackGroundMultiplier", 1.2f, ""); CfgBlinkFallbackBrakeSeconds = ((BaseUnityPlugin)this).Config.Bind("Blink", "FallbackBrakeSeconds", 0.08f, ""); CfgBlinkFallbackBrakeToPct = ((BaseUnityPlugin)this).Config.Bind("Blink", "FallbackBrakeToPct", 0.15f, ""); CfgVfxEnabled = ((BaseUnityPlugin)this).Config.Bind("VFX", "Enabled", true, ""); CfgDashVfxPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "DashVFX", "fx_Adrenaline1", ""); CfgOverdriveVfxPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "OverdriveVFX", "fx_Fader_Roar", ""); CfgDoubleJumpVfxPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "DoubleJumpVFX", "fx_BonusYield", ""); CfgRollVfxPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "RollVFX", "vfx_bush_leaf_puff", ""); CfgWallKickVfxPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "WallKickVFX", "fx_BonusYield", ""); CfgBlinkVfxStartPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "BlinkStartVFX", "fx_Fader_Fissure_Prespawn", ""); CfgBlinkVfxEndPrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "BlinkEndVFX", "fx_Fader_Roar_Projectile_Hit", ""); CfgBlinkVfxFizzlePrefab = ((BaseUnityPlugin)this).Config.Bind("VFX", "BlinkFizzleVFX", "vfx_blocked", ""); CfgVfxDebugLogging = ((BaseUnityPlugin)this).Config.Bind("VFX", "DebugLogging", false, ""); CfgAudioEnabled = ((BaseUnityPlugin)this).Config.Bind("Audio", "Enabled", true, ""); CfgAudioVolume = ((BaseUnityPlugin)this).Config.Bind("Audio", "Volume", 0.85f, ""); CfgAudioFolder = ((BaseUnityPlugin)this).Config.Bind("Audio", "Folder", Path.Combine("Movement", "SFX"), ""); CfgSfxDashFile = ((BaseUnityPlugin)this).Config.Bind("Audio", "DashFile", "dash.ogg", ""); CfgSfxSlideFile = ((BaseUnityPlugin)this).Config.Bind("Audio", "SlideFile", "slide.ogg", ""); CfgSfxRollFile = ((BaseUnityPlugin)this).Config.Bind("Audio", "RollFile", "roll.ogg", ""); CfgSfxOverdriveFile = ((BaseUnityPlugin)this).Config.Bind("Audio", "OverdriveFile", "overdrive.ogg", ""); CfgSfxBlinkFile = ((BaseUnityPlugin)this).Config.Bind("Audio", "BlinkFile", "blink.ogg", ""); CfgSfxBlockFile = ((BaseUnityPlugin)this).Config.Bind("Audio", "BlockFile", "block.ogg", ""); CfgDebugPopups = ((BaseUnityPlugin)this).Config.Bind("Debug", "Popups", false, ""); CfgKnifeAnimLogging = ((BaseUnityPlugin)this).Config.Bind("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("UI", "Enabled", false, "Show small draggable cooldown boxes for Dash/Overdrive/Blink."); CfgUiShowDash = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowDash", true, "Show Dash cooldown box."); CfgUiShowOverdrive = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowOverdrive", true, "Show Overdrive cooldown box."); CfgUiShowBlink = ((BaseUnityPlugin)this).Config.Bind("UI", "ShowBlink", true, "Show Blink cooldown box."); CfgUiBoxWidth = ((BaseUnityPlugin)this).Config.Bind("UI", "BoxWidth", 150, "Cooldown box width in pixels."); CfgUiBoxHeight = ((BaseUnityPlugin)this).Config.Bind("UI", "BoxHeight", 44, "Cooldown box height in pixels."); CfgUiFontSize = ((BaseUnityPlugin)this).Config.Bind("UI", "FontSize", 14, "Font size used inside the cooldown boxes."); CfgUiDebugLogging = ((BaseUnityPlugin)this).Config.Bind("UI", "DebugLogging", false, "Log cooldown UI values for troubleshooting."); CfgUiDashX = ((BaseUnityPlugin)this).Config.Bind("UI", "DashX", 20f, "Dash box X position."); CfgUiDashY = ((BaseUnityPlugin)this).Config.Bind("UI", "DashY", 120f, "Dash box Y position."); CfgUiOverdriveX = ((BaseUnityPlugin)this).Config.Bind("UI", "OverdriveX", 20f, "Overdrive box X position."); CfgUiOverdriveY = ((BaseUnityPlugin)this).Config.Bind("UI", "OverdriveY", 170f, "Overdrive box Y position."); CfgUiBlinkX = ((BaseUnityPlugin)this).Config.Bind("UI", "BlinkX", 20f, "Blink box X position."); CfgUiBlinkY = ((BaseUnityPlugin)this).Config.Bind("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 bool WeaponMatchesKnifeSkoll(ItemData weapon) { if (weapon == null) { return false; } if (NameMatchesKnife(((Object)(object)weapon.m_dropPrefab != (Object)null) ? ((Object)weapon.m_dropPrefab).name : null)) { return true; } if (weapon.m_shared != null && NameMatchesKnife(weapon.m_shared.m_name)) { return true; } return false; } private static bool NameMatchesKnife(string name) { if (string.IsNullOrWhiteSpace(name)) { return false; } string text = name.ToLowerInvariant().Replace("_", "").Replace("-", "") .Replace(" ", ""); return text.Contains("knifeskollandhati"); } private static string DescribeWeaponForLog(ItemData weapon) { if (weapon == null) { return ""; } try { if ((Object)(object)weapon.m_dropPrefab != (Object)null && !string.IsNullOrEmpty(((Object)weapon.m_dropPrefab).name)) { return ((Object)weapon.m_dropPrefab).name; } } catch { } if (weapon.m_shared != null && !string.IsNullOrEmpty(weapon.m_shared.m_name)) { return weapon.m_shared.m_name; } return ""; } private static bool ShouldLogKnifeAnim(Player player) { if (CfgKnifeAnimLogging == null || !CfgKnifeAnimLogging.Value) { return false; } if ((Object)(object)player == (Object)null || player != Player.m_localPlayer) { return false; } return true; } 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 bool TryClampBlinkDestinationToGround(Vector3 desired, out Vector3 clamped) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) clamped = desired; try { Vector3 val = desired + Vector3.up * 6f; int num = -5; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 30f, num, (QueryTriggerInteraction)1)) { clamped = ((RaycastHit)(ref val2)).point; clamped.y += 0.5f; return true; } } catch { } return false; } private static void CacheDashImpactFxPrefabs() { if ((Object)(object)_cachedDashImpactVfx != (Object)null && (Object)(object)_cachedDashImpactSfx != (Object)null) { return; } try { if ((Object)(object)ZNetScene.instance == (Object)null) { return; } List prefabs = ZNetScene.instance.m_prefabs; if (prefabs == null) { return; } string b = "vfx_perfectblock"; string b2 = "sfx_perfectblock"; if (CfgDashImpactBlockVfxPrefab != null && !string.IsNullOrEmpty(CfgDashImpactBlockVfxPrefab.Value)) { b = CfgDashImpactBlockVfxPrefab.Value; } if (CfgDashImpactBlockSfxPrefab != null && !string.IsNullOrEmpty(CfgDashImpactBlockSfxPrefab.Value)) { b2 = CfgDashImpactBlockSfxPrefab.Value; } for (int i = 0; i < prefabs.Count; i++) { GameObject val = prefabs[i]; if (!((Object)(object)val == (Object)null)) { if ((Object)(object)_cachedDashImpactVfx == (Object)null && string.Equals(((Object)val).name, b, StringComparison.OrdinalIgnoreCase)) { _cachedDashImpactVfx = val; } if ((Object)(object)_cachedDashImpactSfx == (Object)null && string.Equals(((Object)val).name, b2, StringComparison.OrdinalIgnoreCase)) { _cachedDashImpactSfx = val; } if ((Object)(object)_cachedDashImpactVfx != (Object)null && (Object)(object)_cachedDashImpactSfx != (Object)null) { return; } } } string[] array = new string[4] { "vfx_perfectblock", "vfx_parry", "vfx_blocked", "vfx_block" }; string[] array2 = new string[4] { "sfx_perfectblock", "sfx_parry", "sfx_blocked", "sfx_block" }; if ((Object)(object)_cachedDashImpactVfx == (Object)null) { foreach (string b3 in array) { for (int k = 0; k < prefabs.Count; k++) { GameObject val2 = prefabs[k]; if (!((Object)(object)val2 == (Object)null) && string.Equals(((Object)val2).name, b3, StringComparison.OrdinalIgnoreCase)) { _cachedDashImpactVfx = val2; break; } } if ((Object)(object)_cachedDashImpactVfx != (Object)null) { break; } } } if (!((Object)(object)_cachedDashImpactSfx == (Object)null)) { return; } foreach (string b4 in array2) { for (int m = 0; m < prefabs.Count; m++) { GameObject val3 = prefabs[m]; if (!((Object)(object)val3 == (Object)null) && string.Equals(((Object)val3).name, b4, StringComparison.OrdinalIgnoreCase)) { _cachedDashImpactSfx = val3; break; } } if ((Object)(object)_cachedDashImpactSfx != (Object)null) { break; } } } catch { } } private static void SpawnDashImpactVfx(Vector3 point) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) bool flag = true; try { flag = CfgDashImpactBlockVfxEnabled == null || CfgDashImpactBlockVfxEnabled.Value; } catch { flag = true; } if (!flag) { return; } try { CacheDashImpactFxPrefabs(); if (!((Object)(object)_cachedDashImpactVfx == (Object)null)) { Object.Instantiate(_cachedDashImpactVfx, point, Quaternion.identity); } } catch { } } private static bool SpawnDashImpactSfxPrefab(Vector3 point) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) bool flag = true; try { flag = CfgDashImpactBlockSfxEnabled == null || CfgDashImpactBlockSfxEnabled.Value; } catch { flag = true; } if (!flag) { return false; } try { CacheDashImpactFxPrefabs(); if ((Object)(object)_cachedDashImpactSfx == (Object)null) { return false; } Object.Instantiate(_cachedDashImpactSfx, point, Quaternion.identity); return true; } catch { } return false; } private static void EnsureShieldFxFields() { if (FI_Shared_perfectBlockEffect != null || FI_Shared_parryEffect != null || FI_Shared_blockEffect != null) { return; } try { FI_Shared_perfectBlockEffect = AccessTools.Field(typeof(SharedData), "m_perfectBlockEffect"); } catch { FI_Shared_perfectBlockEffect = null; } try { FI_Shared_parryEffect = AccessTools.Field(typeof(SharedData), "m_parryEffect"); } catch { FI_Shared_parryEffect = null; } try { FI_Shared_blockEffect = AccessTools.Field(typeof(SharedData), "m_blockEffect"); } catch { FI_Shared_blockEffect = null; } } private static bool TryPlayShieldParryFx(Player p, Vector3 point) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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) try { if ((Object)(object)p == (Object)null) { return false; } ItemData val = null; try { val = FR_Humanoid_leftItem.Invoke((Humanoid)(object)p); } catch { val = null; } if (val == null) { return false; } SharedData shared = val.m_shared; if (shared == null) { return false; } EnsureShieldFxFields(); EffectList val2 = null; try { if (FI_Shared_perfectBlockEffect != null) { object? value = FI_Shared_perfectBlockEffect.GetValue(shared); val2 = (EffectList)((value is EffectList) ? value : null); } } catch { val2 = null; } if (val2 == null) { try { if (FI_Shared_parryEffect != null) { object? value2 = FI_Shared_parryEffect.GetValue(shared); val2 = (EffectList)((value2 is EffectList) ? value2 : null); } } catch { val2 = null; } } if (val2 == null) { try { if (FI_Shared_blockEffect != null) { object? value3 = FI_Shared_blockEffect.GetValue(shared); val2 = (EffectList)((value3 is EffectList) ? value3 : null); } } catch { val2 = null; } } if (val2 == null) { return false; } try { val2.Create(point, Quaternion.identity, ((Component)p).transform, 1f, -1); } catch { val2.Create(point, Quaternion.identity, (Transform)null, 1f, -1); } return true; } catch { } return false; } private static void PlayLocalSfx(int sfxId, Vector3 pos) { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) if (!CfgAudioEnabled.Value) { return; } AudioClip val = null; switch (sfxId) { case 1: val = _clipDash; break; case 2: val = ClipSlide; break; case 4: val = _clipRoll; break; case 5: val = _clipOverdrive; break; case 6: val = _clipBlink; break; case 7: val = _clipBlock; break; } if ((Object)(object)val == (Object)null) { return; } float num = Mathf.Clamp(CfgAudioVolume.Value, 0f, 1f); try { GameObject val2 = new GameObject($"MV_SFX_{sfxId}"); val2.transform.position = pos; AudioSource val3 = val2.AddComponent(); val3.playOnAwake = false; val3.clip = val; val3.volume = num; val3.spatialBlend = 1f; val3.rolloffMode = (AudioRolloffMode)0; val3.dopplerLevel = 0f; val3.minDistance = 2f; val3.maxDistance = 25f; val3.Play(); Object.Destroy((Object)(object)val2, val.length + 0.1f); } catch { AudioSource.PlayClipAtPoint(val, pos, num); } } internal static void PlaySlideSfx(Player p) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null)) { PlayLocalSfx(2, ((Component)p).transform.position); } } [IteratorStateMachine(typeof(d__252))] private IEnumerator LoadAudioClipsCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__252(0) { <>4__this = this }; } [IteratorStateMachine(typeof(d__253))] private IEnumerator LoadEmbeddedClip(string resourceName, Action assign) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__253(0) { <>4__this = this, resourceName = resourceName, 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(); ((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 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 b__1_1(ConsoleEventArgs args) { if (args.Length < 2) { MovementPlugin.Cmd_Unlock("all"); } else { MovementPlugin.Cmd_Unlock(args[1]); } } internal void b__1_2(ConsoleEventArgs args) { MovementPlugin.Cmd_Status(); } internal void b__1_3(ConsoleEventArgs args) { if (args.Length < 2) { MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)1, "[MV] Usage: mv_vfx ", 0, (Sprite)null, false); } } else { MovementPlugin.Cmd_VfxTest(args[1]); } } internal void 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 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 ", 0, (Sprite)null, false); } } else { MovementPlugin.Cmd_VfxTest(args[1]); } }; <>c.<>9__1_3 = val4; obj4 = (object)val4; } new ConsoleCommand("mv_vfx", "mv_vfx ", (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 [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; } private static readonly int ZdoSlamNoFallUntilMs = "MV_SlamNoFallUntilMs".GetStableHashCode(); private static long NowMs() { double num = 0.0; try { if ((Object)(object)ZNet.instance != (Object)null) { num = ZNet.instance.GetTimeSeconds(); } } catch { } if (num <= 0.0) { try { num = Time.realtimeSinceStartup; } catch { num = 0.0; } } return (long)(num * 1000.0); } private static bool IsFallDamageHit(HitData hit) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 try { return (int)hit.m_hitType == 3; } catch { } try { string text = ((object)(HitType)(ref hit.m_hitType)).ToString(); if (!string.IsNullOrEmpty(text) && text.IndexOf("Fall", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } catch { } return false; } [HarmonyPatch(typeof(Character), "Damage")] [HarmonyPrefix] private static void DamagePrefix(Character __instance, ref HitData hit, ref RollHealState __state) { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Invalid comparison between Unknown and I4 //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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) 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(); if ((Object)(object)component == (Object)null || !component.IsValid()) { return; } try { ZDO zDO = component.GetZDO(); if (zDO != null) { long @long = zDO.GetLong(ZdoSlamNoFallUntilMs, 0L); if (@long > NowMs() && IsFallDamageHit(hit)) { hit.m_damage.m_damage = 0f; hit.m_damage.m_blunt = 0f; hit.m_damage.m_slash = 0f; hit.m_damage.m_pierce = 0f; hit.m_damage.m_fire = 0f; hit.m_damage.m_frost = 0f; hit.m_damage.m_lightning = 0f; hit.m_damage.m_poison = 0f; hit.m_damage.m_spirit = 0f; hit.m_pushForce = 0f; hit.m_staggerMultiplier = 0f; return; } } } catch { } if (!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() ?? ((Component)val).GetComponentInChildren(); 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(); 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; } } internal static class ShieldSurf { [CompilerGenerated] private sealed class d__75 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; private string 5__1; private string 5__2; private UnityWebRequest 5__3; private AudioClip 5__4; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__75(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(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; _musicCustom = null; _musicCustomPathLoaded = string.Empty; if (CfgMusicSelection == null || !string.Equals(CfgMusicSelection.Value, "Custom", StringComparison.OrdinalIgnoreCase)) { return false; } 5__1 = CfgMusicCustomPath?.Value; if (string.IsNullOrWhiteSpace(5__1)) { return false; } 5__1 = 5__1.Trim(); if (!Path.IsPathRooted(5__1)) { try { 5__1 = Path.Combine(Paths.PluginPath, 5__1); } catch { } } if (!File.Exists(5__1)) { if (!_loggedMissingMusic) { _loggedMissingMusic = true; ManualLogSource log = MovementPlugin.Log; if (log != null) { log.LogWarning((object)("[MV] ShieldSurf custom music file not found: " + 5__1)); } } return false; } 5__2 = "file:///" + 5__1.Replace("\\", "/"); 5__3 = UnityWebRequestMultimedia.GetAudioClip(5__2, (AudioType)14); <>1__state = -3; <>2__current = 5__3.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -3; 5__4 = null; try { 5__4 = DownloadHandlerAudioClip.GetContent(5__3); } catch { 5__4 = null; } if ((Object)(object)5__4 != (Object)null) { _musicCustom = 5__4; _musicCustomPathLoaded = 5__1; } 5__4 = null; <>m__Finally1(); 5__3 = 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 (5__3 != null) { ((IDisposable)5__3).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__74 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public string resourceSuffix; public Action assign; private byte[] 5__1; private string 5__2; private Assembly 5__3; private string[] 5__4; private string 5__5; private int 5__6; private Stream 5__7; private MemoryStream 5__8; private string 5__9; private UnityWebRequest 5__10; private AudioClip 5__11; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__74(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(); } } 5__1 = null; 5__2 = null; 5__3 = null; 5__4 = null; 5__5 = null; 5__7 = null; 5__8 = null; 5__9 = null; 5__10 = null; 5__11 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = null; try { 5__3 = Assembly.GetExecutingAssembly(); 5__4 = 5__3.GetManifestResourceNames(); 5__5 = null; 5__6 = 0; while (5__6 < 5__4.Length) { if (5__4[5__6].EndsWith(resourceSuffix, StringComparison.OrdinalIgnoreCase) || 5__4[5__6].Equals(resourceSuffix, StringComparison.OrdinalIgnoreCase)) { 5__5 = 5__4[5__6]; break; } int num = 5__6 + 1; 5__6 = num; } if (!string.IsNullOrEmpty(5__5)) { 5__7 = 5__3.GetManifestResourceStream(5__5); try { if (5__7 != null) { 5__8 = new MemoryStream(); try { 5__7.CopyTo(5__8); 5__1 = 5__8.ToArray(); } finally { if (5__8 != null) { ((IDisposable)5__8).Dispose(); } } 5__8 = null; } } finally { if (5__7 != null) { ((IDisposable)5__7).Dispose(); } } 5__7 = null; } 5__3 = null; 5__4 = null; 5__5 = null; } catch { 5__1 = null; } if (5__1 == null || 5__1.Length == 0) { return false; } 5__2 = Path.Combine(Path.GetTempPath(), "mv_surf_" + Guid.NewGuid().ToString() + ".ogg"); <>1__state = -3; File.WriteAllBytes(5__2, 5__1); 5__9 = "file:///" + 5__2.Replace("\\", "/"); 5__10 = UnityWebRequestMultimedia.GetAudioClip(5__9, (AudioType)14); <>1__state = -4; <>2__current = 5__10.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -4; 5__11 = null; try { 5__11 = DownloadHandlerAudioClip.GetContent(5__10); } catch { 5__11 = null; } if ((Object)(object)5__11 != (Object)null) { assign?.Invoke(5__11); } 5__11 = null; <>m__Finally2(); 5__10 = null; 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(5__2)) { File.Delete(5__2); } } catch { } } private void <>m__Finally2() { <>1__state = -3; if (5__10 != null) { ((IDisposable)5__10).Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__73 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__73(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; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.MainSurfTrack.ogg", delegate(AudioClip c) { _musicMainSurf = c; }); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.Afrobeat.ogg", delegate(AudioClip c) { _musicAfrobeat = c; }); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.upbeat.ogg", delegate(AudioClip c) { _musicUpbeat = c; }); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.EDMsynth.ogg", delegate(AudioClip c) { _musicEdm = c; }); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.EDMgroovy.ogg", delegate(AudioClip c) { _musicEdmGroovy = c; }); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.EDMupbeat.ogg", delegate(AudioClip c) { _musicEdmUpbeat = c; }); <>1__state = 6; return true; case 6: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.guitar.ogg", delegate(AudioClip c) { _musicGuitar = c; }); <>1__state = 7; return true; case 7: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.hard_rock.ogg", delegate(AudioClip c) { _musicHardRock = c; }); <>1__state = 8; return true; case 8: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.islandy.ogg", delegate(AudioClip c) { _musicIslandy = c; }); <>1__state = 9; return true; case 9: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.rock.ogg", delegate(AudioClip c) { _musicRock = c; }); <>1__state = 10; return true; case 10: <>1__state = -1; <>2__current = LoadEmbeddedSurfClip("Resources.SFX.chill.ogg", delegate(AudioClip c) { _musicChill = c; }); <>1__state = 11; return true; case 11: <>1__state = -1; <>2__current = LoadCustomMusicIfNeeded(); <>1__state = 12; return true; case 12: <>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(); } } private const string CfgSection = "ShieldSurf"; private const string NameShieldSurf = "Shield Surf"; private static MovementPlugin _plugin; private static ConfigEntry CfgEnabled; private static ConfigEntry CfgKey; private static ConfigEntry CfgCooldownSeconds; private static ConfigEntry CfgMinSpeed; private static ConfigEntry CfgBaseDurationSeconds; private static ConfigEntry CfgMaxDurationSeconds; private static ConfigEntry CfgStaminaCost; private static ConfigEntry CfgDurabilityCostPerSecond; private static ConfigEntry CfgDisallowEncumbered; private static ConfigEntry CfgRequiredGlobalKey; private static ConfigEntry CfgMinSpeed_Downhill; private static ConfigEntry CfgMaxSpeed_Downhill; private static ConfigEntry CfgTurnSpeed; private static ConfigEntry CfgJumpOffForce; private static ConfigEntry CfgVfxPrefab; private static ConfigEntry CfgMaxUphillGain; private static ConfigEntry CfgMusicEnabled; private static ConfigEntry CfgMusicSelection; private static ConfigEntry CfgMusicCustomPath; private static ConfigEntry CfgMusicVolume; private static bool _isSurfing; private static float _surfStartTime; private static Vector3 _surfDirection; private static float _cooldownEndTime; private static float _currentSurfSpeed; private static float _flatGroundTime; private static float _lastVfxTime; private static float _lastDurabilityTime; private static FieldInfo _setCrouchField; private static float _accumulatedUphillGain; private static float _lastSurfaceHeight; private static bool _hasSurfaceHeight; private static readonly FieldRef LeftItemDataRef = AccessTools.FieldRefAccess("m_leftItem"); private static readonly FieldRef VisEquipmentRef = AccessTools.FieldRefAccess("m_visEquipment"); private static readonly FieldRef LeftItemInstanceRef = AccessTools.FieldRefAccess("m_leftItemInstance"); private static Transform _shieldOriginalParent; private static Vector3 _shieldOriginalLocalPos; private static Quaternion _shieldOriginalLocalRot; private static GameObject _shieldSurfInstance; private static bool _loggedShieldAxes; private static readonly float ShieldSurfDownOffset = 0.45f; private static readonly float ShieldSurfForwardOffset = 0.2f; private static readonly Quaternion ShieldSurfRotationOffset = Quaternion.identity; private static readonly AcceptableValueList MusicChoices = new AcceptableValueList(new string[12] { "MainSurfTrack", "Afrobeat", "Upbeat", "EDMsynth", "EDMgroovy", "EDMupbeat", "Guitar", "HardRock", "Islandy", "Rock", "Chill", "Custom" }); private static bool _musicLoadStarted; private static AudioClip _musicMainSurf; private static AudioClip _musicAfrobeat; private static AudioClip _musicUpbeat; private static AudioClip _musicEdm; private static AudioClip _musicEdmGroovy; private static AudioClip _musicEdmUpbeat; private static AudioClip _musicGuitar; private static AudioClip _musicHardRock; private static AudioClip _musicIslandy; private static AudioClip _musicRock; private static AudioClip _musicChill; private static AudioClip _musicCustom; private static string _musicCustomPathLoaded; private static GameObject _musicObject; private static AudioSource _musicSource; private static bool _loggedMissingMusic; private static readonly HashSet _surfHitTargets = new HashSet(); private const float SurfHitRadius = 1.35f; internal static bool IsSurfing => _isSurfing; internal static void Init(MovementPlugin plugin) { //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Expected O, but got Unknown if (!((Object)(object)plugin == (Object)null) && !((Object)(object)_plugin != (Object)null)) { _plugin = plugin; CfgEnabled = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "Enabled", true, "Enable the Shield Surf ability."); CfgKey = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "Key", (KeyCode)99, "Shield Surf activation key (used with modifier key)."); CfgCooldownSeconds = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "CooldownSeconds", 22f, "Cooldown between shield surfs in seconds."); CfgMinSpeed = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MinSpeed", 4f, "Minimum horizontal speed required to initiate shield surf."); CfgBaseDurationSeconds = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "BaseDurationSeconds", 6f, "Base shield surf duration in seconds."); CfgMaxDurationSeconds = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MaxDurationSeconds", 60f, "Maximum shield surf duration in seconds."); CfgStaminaCost = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "StaminaCost", 15f, "Stamina cost to initiate shield surf."); CfgDurabilityCostPerSecond = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "DurabilityCostPerSecond", 2f, "Shield durability cost per second while surfing."); CfgDisallowEncumbered = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "DisallowEncumbered", true, "Prevent shield surfing while encumbered."); CfgRequiredGlobalKey = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "RequiredGlobalKey", "defeated_gdking", "Global key required to use shield surf. Leave blank to disable gating."); CfgMinSpeed_Downhill = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MinSpeed_Downhill", 10f, "Minimum speed on gentle slopes."); CfgMaxSpeed_Downhill = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MaxSpeed_Downhill", 25f, "Maximum speed on steep slopes."); CfgTurnSpeed = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "TurnSpeed", 2f, "How fast you can turn while surfing (degrees per second multiplier)."); CfgJumpOffForce = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "JumpOffForce", 8f, "Upward force applied when jumping off shield."); CfgVfxPrefab = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "VfxPrefab", "vfx_sledge_hit", "VFX prefab spawned repeatedly during surf."); CfgMaxUphillGain = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MaxUphillGainMeters", 2f, "Maximum uphill height (meters) you can climb during one surf before it ends."); CfgMusicEnabled = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MusicEnabled", true, "Play a looping music track while shield surfing."); CfgMusicSelection = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MusicTrack", "MainSurfTrack", new ConfigDescription("Shield-surf music track.", (AcceptableValueBase)(object)MusicChoices, Array.Empty())); CfgMusicCustomPath = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MusicCustomPath", string.Empty, "Relative or absolute path to a custom .ogg file (used when MusicTrack = Custom)."); CfgMusicVolume = ((BaseUnityPlugin)plugin).Config.Bind("ShieldSurf", "MusicVolume", 0.85f, "Volume for shield-surf music (0-1)."); _setCrouchField = typeof(Player).GetField("m_crouchToggled", BindingFlags.Instance | BindingFlags.NonPublic); EnsureMusicLoaded(); } } internal static void Tick(Player p, KeyCode modKey) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_plugin == (Object)null) && CfgEnabled.Value && !((Object)(object)p == (Object)null) && !Console.IsVisible() && (!((Object)(object)Chat.instance != (Object)null) || !Chat.instance.HasFocus()) && !TextInput.IsVisible() && Input.GetKeyDown(CfgKey.Value) && Input.GetKey(modKey)) { TryStartSurf(p); } } private static void TryStartSurf(Player p) { //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_015e: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null || _isSurfing || ((Character)p).IsDead() || ((Character)p).IsAttached() || ((Character)p).InCutscene()) { return; } try { if (((Character)p).IsRiding()) { return; } } catch { } if (CfgDisallowEncumbered.Value && ((Character)p).IsEncumbered()) { return; } if (!MovementPlugin.HasUnlock("shieldsurf", CfgRequiredGlobalKey.Value)) { MovementPlugin.DenyRequires("Shield Surf", CfgRequiredGlobalKey.Value); } else { if (Time.time < _cooldownEndTime) { return; } if (!HasShieldEquipped(p)) { ((Character)p).Message((MessageType)2, "Shield required for Shield Surf!", 0, (Sprite)null); return; } Rigidbody rigidbody = GetRigidbody(p); if ((Object)(object)rigidbody == (Object)null) { return; } Vector3 linearVelocity = rigidbody.linearVelocity; linearVelocity.y = 0f; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (magnitude < Mathf.Max(0.1f, CfgMinSpeed.Value)) { return; } if (!IsMovingDownhill(p, rigidbody, ((Vector3)(ref linearVelocity)).normalized)) { ((Character)p).Message((MessageType)2, "Must be moving downhill to Shield Surf!", 0, (Sprite)null); return; } float num = Mathf.Max(0f, CfgStaminaCost.Value); if (!(num > 0f) || !(p.GetStamina() < num)) { if (num > 0f) { ((Character)p).UseStamina(num); } _surfDirection = ((Vector3)(ref linearVelocity)).normalized; _surfStartTime = Time.time; _currentSurfSpeed = magnitude; _flatGroundTime = 0f; _lastVfxTime = 0f; _lastDurabilityTime = Time.time; _accumulatedUphillGain = 0f; _hasSurfaceHeight = false; _isSurfing = true; _surfHitTargets.Clear(); MovementPlugin.SpawnAbilityVfx(CfgVfxPrefab.Value, p); PlaySurfMusic(p); } } } [HarmonyPatch(typeof(Character), "UpdateWalking")] [HarmonyPrefix] private static bool UpdateWalkingPrefix(Character __instance, float dt) { //IL_00ef: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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_01db: 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_01f0: Unknown result type (might be due to invalid IL or missing references) if (!_isSurfing) { return true; } Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null) { return true; } if (val != Player.m_localPlayer) { return true; } if (ShouldCancelSurf(val)) { EndSurf(val); return true; } Rigidbody component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { EndSurf(val); return true; } if (Input.GetKeyDown((KeyCode)32)) { JumpOffShield(val, component); EndSurf(val); return true; } float num = Time.time - _surfStartTime; if (num >= Mathf.Max(0.1f, CfgMaxDurationSeconds.Value)) { EndSurf(val); return true; } if (IsMovingDownhill(val, component, _surfDirection)) { _flatGroundTime = 0f; } else { _flatGroundTime += dt; if (_flatGroundTime >= 2f) { EndSurf(val); return true; } } ApplySteering(val, dt); float num2 = CalculateSlopeSpeed(val, component, _surfDirection); _currentSurfSpeed = Mathf.Lerp(_currentSurfSpeed, num2, 2f * dt); if (Time.time - _lastDurabilityTime >= 1f) { if (!DrainShieldDurability(val, CfgDurabilityCostPerSecond.Value)) { EndSurf(val); return true; } _lastDurabilityTime = Time.time; } ((Character)val).SetMoveDir(Vector3.zero); Vector3 linearVelocity = _surfDirection * _currentSurfSpeed; linearVelocity.y = component.linearVelocity.y; component.linearVelocity = linearVelocity; if (Time.time - _lastVfxTime >= 0.4f) { MovementPlugin.SpawnAbilityVfx(CfgVfxPrefab.Value, val); _lastVfxTime = Time.time; } EnsureShieldBoard(val); if (_setCrouchField != null) { _setCrouchField.SetValue(val, true); } ZSyncAnimation value = Traverse.Create((object)__instance).Field("m_zanim").Value; if ((Object)(object)value != (Object)null) { value.SetBool("crouching", true); value.SetFloat("forward_speed", 0f); value.SetFloat("sideway_speed", 0f); value.SetBool("onGround", true); } HandleSurfCollisions(val); return false; } private static void EnsureMusicLoaded() { if (!_musicLoadStarted) { _musicLoadStarted = true; if ((Object)(object)_plugin == (Object)null) { _musicLoadStarted = false; } else { ((MonoBehaviour)_plugin).StartCoroutine(LoadMusicCoroutine()); } } } [IteratorStateMachine(typeof(d__73))] private static IEnumerator LoadMusicCoroutine() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__73(0); } [IteratorStateMachine(typeof(d__74))] private static IEnumerator LoadEmbeddedSurfClip(string resourceSuffix, Action assign) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__74(0) { resourceSuffix = resourceSuffix, assign = assign }; } [IteratorStateMachine(typeof(d__75))] private static IEnumerator LoadCustomMusicIfNeeded() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__75(0); } private static AudioClip ResolveSurfClip() { if (CfgMusicSelection == null) { return null; } string text = CfgMusicSelection.Value?.Trim() ?? string.Empty; if (text.Equals("Custom", StringComparison.OrdinalIgnoreCase)) { if ((Object)(object)_musicCustom == (Object)null) { if (!_musicLoadStarted && (Object)(object)_plugin != (Object)null) { EnsureMusicLoaded(); } if ((Object)(object)_plugin != (Object)null) { ((MonoBehaviour)_plugin).StartCoroutine(LoadCustomMusicIfNeeded()); } } return _musicCustom; } switch (text.ToLowerInvariant()) { case "mainsurftrack": return _musicMainSurf ?? _musicAfrobeat ?? _musicUpbeat; case "upbeat": return _musicUpbeat ?? _musicAfrobeat; case "edmsynth": case "edm": return _musicEdm ?? _musicAfrobeat; case "edmgroovy": return _musicEdmGroovy ?? _musicEdm ?? _musicAfrobeat; case "edmupbeat": return _musicEdmUpbeat ?? _musicUpbeat ?? _musicAfrobeat; case "guitar": return _musicGuitar ?? _musicAfrobeat; case "hardrock": return _musicHardRock ?? _musicRock ?? _musicAfrobeat; case "islandy": return _musicIslandy ?? _musicAfrobeat; case "rock": return _musicRock ?? _musicHardRock ?? _musicAfrobeat; case "chill": return _musicChill ?? _musicUpbeat ?? _musicAfrobeat; default: return _musicAfrobeat ?? _musicUpbeat ?? _musicEdm ?? _musicGuitar; } } private static void PlaySurfMusic(Player p) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if ((Object)(object)p == (Object)null || CfgMusicEnabled == null || !CfgMusicEnabled.Value) { return; } AudioClip val = ResolveSurfClip(); if ((Object)(object)val == (Object)null) { if (!_loggedMissingMusic) { _loggedMissingMusic = true; ManualLogSource log = MovementPlugin.Log; if (log != null) { log.LogWarning((object)"[MV] ShieldSurf music clip missing. Check configuration."); } } return; } StopSurfMusic(); try { _musicObject = new GameObject("MV_ShieldSurfMusic"); _musicObject.transform.SetParent(((Component)p).transform, false); _musicSource = _musicObject.AddComponent(); _musicSource.playOnAwake = false; _musicSource.loop = true; _musicSource.clip = val; _musicSource.spatialBlend = 0f; _musicSource.dopplerLevel = 0f; _musicSource.volume = Mathf.Clamp01(CfgMusicVolume?.Value ?? 0.85f); _musicSource.Play(); } catch (Exception ex) { ManualLogSource log2 = MovementPlugin.Log; if (log2 != null) { log2.LogWarning((object)("[MV] Failed to play ShieldSurf music: " + ex.Message)); } StopSurfMusic(); } } private static void StopSurfMusic() { try { if ((Object)(object)_musicSource != (Object)null) { _musicSource.Stop(); _musicSource.clip = null; } if ((Object)(object)_musicObject != (Object)null) { Object.Destroy((Object)(object)_musicObject); } } catch { } finally { _musicSource = null; _musicObject = null; } } private static void EndSurf(Player p) { _isSurfing = false; _cooldownEndTime = Time.time + Mathf.Max(0f, CfgCooldownSeconds.Value); RestoreShieldBoard(); _accumulatedUphillGain = 0f; _hasSurfaceHeight = false; StopSurfMusic(); _surfHitTargets.Clear(); if ((Object)(object)p != (Object)null) { if (_setCrouchField != null) { _setCrouchField.SetValue(p, false); } ZSyncAnimation value = Traverse.Create((object)p).Field("m_zanim").Value; if ((Object)(object)value != (Object)null) { value.SetBool("crouching", false); } } } internal static void Cancel() { if (_isSurfing) { Player localPlayer = Player.m_localPlayer; EndSurf(localPlayer); } } private static bool ShouldCancelSurf(Player p) { if ((Object)(object)p == (Object)null) { return true; } if (((Character)p).IsDead()) { return true; } if (((Character)p).IsAttached()) { return true; } try { if (((Character)p).InAttack()) { return true; } } catch { } float num = Mathf.Max(0f, CfgStaminaCost.Value); if (num > 0f && p.GetStamina() <= 0f) { return true; } return false; } private static void ApplySteering(Player p, float dt) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) float num = 0f; if (ZInput.GetButton("Left") || ZInput.GetButton("JoyLStickLeft")) { num -= 1f; } if (ZInput.GetButton("Right") || ZInput.GetButton("JoyLStickRight")) { num += 1f; } if (Mathf.Abs(num) > 0.1f) { float num2 = Mathf.Max(0f, CfgTurnSpeed.Value) * 30f * dt; Quaternion val = Quaternion.AngleAxis(num * num2, Vector3.up); _surfDirection = val * _surfDirection; _surfDirection.y = 0f; ((Vector3)(ref _surfDirection)).Normalize(); } } private static float CalculateSlopeSpeed(Player p, Rigidbody rb, Vector3 direction) { //IL_0002: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (rb.linearVelocity.y < -3f) { return Mathf.Max(1f, CfgMaxSpeed_Downhill.Value); } Vector3 val = ((Component)p).transform.position + Vector3.up * 0.5f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 5f, -5, (QueryTriggerInteraction)1)) { float num = Mathf.Acos(Mathf.Clamp01(Vector3.Dot(((RaycastHit)(ref val2)).normal, Vector3.up))) * 57.29578f; if (num > 5f) { Vector3 val3 = Vector3.ProjectOnPlane(Vector3.down, ((RaycastHit)(ref val2)).normal); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num2 = Vector3.Dot(direction, normalized); if (num2 < -0.1f) { float num3 = Mathf.Clamp01(num / 45f); float num4 = Mathf.Max(1f, CfgMinSpeed_Downhill.Value); float num5 = Mathf.Max(1f, CfgMaxSpeed_Downhill.Value); return Mathf.Lerp(num4, num5, num3 * Mathf.Abs(num2)); } } } return Mathf.Max(1f, CfgMinSpeed_Downhill.Value); } private static bool IsMovingDownhill(Player p, Rigidbody rb, Vector3 direction) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00a7: 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_00aa: Unknown result type (might be due to invalid IL or missing references) if (rb.linearVelocity.y < -2f) { return true; } Vector3 val = ((Component)p).transform.position + Vector3.up * 0.5f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 5f, -5, (QueryTriggerInteraction)1)) { float num = Mathf.Acos(Mathf.Clamp01(Vector3.Dot(((RaycastHit)(ref val2)).normal, Vector3.up))) * 57.29578f; if (num > 15f) { Vector3 val3 = Vector3.ProjectOnPlane(Vector3.down, ((RaycastHit)(ref val2)).normal); Vector3 normalized = ((Vector3)(ref val3)).normalized; float num2 = Vector3.Dot(direction, normalized); if (num2 < -0.2f) { return true; } } } return false; } private static void JumpOffShield(Player p, Rigidbody rb) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)p == (Object)null) && !((Object)(object)rb == (Object)null)) { Vector3 val = Vector3.up * Mathf.Max(0f, CfgJumpOffForce.Value); rb.AddForce(val, (ForceMode)2); MovementPlugin.SpawnAbilityVfx("vfx_sledge_hit", p); } } private static void HandleSurfCollisions(Player p) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0105: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } Vector3 val = ((Component)p).transform.position + Vector3.up * 0.5f; Collider[] array = Physics.OverlapSphere(val, 1.35f, -5, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return; } foreach (Collider val2 in array) { if ((Object)(object)val2 == (Object)null) { continue; } Character componentInParent = ((Component)val2).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null || (Object)(object)componentInParent == (Object)(object)p || componentInParent.IsDead() || componentInParent is Player) { continue; } int instanceID = ((Object)componentInParent).GetInstanceID(); if (_surfHitTargets.Add(instanceID)) { try { Vector3 val3 = ((((Vector3)(ref _surfDirection)).sqrMagnitude > 0.001f) ? ((Vector3)(ref _surfDirection)).normalized : ((Component)p).transform.forward); float num = Mathf.Clamp(_currentSurfSpeed * 2f, 30f, 120f); componentInParent.Stagger(val3 * num); } catch { } } } } private static bool HasShieldEquipped(Player p) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((Object)(object)p == (Object)null) { return false; } ItemData val = LeftItemDataRef.Invoke((Humanoid)(object)p); if (val != null && (int)val.m_shared.m_itemType == 5) { return true; } return false; } private static bool DrainShieldDurability(Player p, float amount) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((Object)(object)p == (Object)null) { return false; } ItemData val = LeftItemDataRef.Invoke((Humanoid)(object)p); if (val == null || (int)val.m_shared.m_itemType != 5) { return false; } if (val.m_durability <= amount) { val.m_durability = 0f; ((Humanoid)p).UnequipItem(val, false); return false; } val.m_durability -= amount; return true; } private static void EnsureShieldBoard(Player p) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: 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) //IL_01cf: 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_01d3: 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_01da: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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_0210: 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_021c: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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) //IL_01f2: 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_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } VisEquipment val = VisEquipmentRef.Invoke((Humanoid)(object)p); if ((Object)(object)val == (Object)null) { return; } GameObject val2 = LeftItemInstanceRef.Invoke(val); if ((Object)(object)val2 == (Object)null) { return; } Transform transform = val2.transform; if ((Object)(object)_shieldSurfInstance != (Object)(object)val2) { RestoreShieldBoard(); _shieldSurfInstance = val2; _shieldOriginalParent = transform.parent; _shieldOriginalLocalPos = transform.localPosition; _shieldOriginalLocalRot = transform.localRotation; } if ((Object)(object)transform.parent != (Object)(object)((Component)p).transform) { transform.SetParent(((Component)p).transform, false); } Vector3 val3 = Vector3.up; Vector3 val4 = ((Component)p).transform.position + Vector3.up * 0.8f; RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(val4, Vector3.down, ref val5, 4f, -5, (QueryTriggerInteraction)1)) { Vector3 normal = ((RaycastHit)(ref val5)).normal; if (((Vector3)(ref normal)).sqrMagnitude > 0.001f) { val3 = ((RaycastHit)(ref val5)).normal; } if (ProcessUphillGain(p, ((RaycastHit)(ref val5)).point.y)) { return; } } Vector3 val6 = ((((Vector3)(ref _surfDirection)).sqrMagnitude > 0.001f) ? _surfDirection : ((Component)p).transform.forward); val6 = Vector3.ProjectOnPlane(val6, val3); if (((Vector3)(ref val6)).sqrMagnitude < 0.001f) { val6 = Vector3.ProjectOnPlane(((Component)p).transform.right, val3); } if (((Vector3)(ref val6)).sqrMagnitude < 0.001f) { val6 = Vector3.Cross(val3, Vector3.right); } ((Vector3)(ref val6)).Normalize(); Vector3 val7 = -val6; Vector3 val8 = val3; Vector3 val9 = Vector3.Cross(val7, val8); if (((Vector3)(ref val9)).sqrMagnitude < 0.001f) { val9 = val6; } ((Vector3)(ref val7)).Normalize(); ((Vector3)(ref val8)).Normalize(); ((Vector3)(ref val9)).Normalize(); Quaternion val10 = Quaternion.LookRotation(val7, val9); val10 = Quaternion.AngleAxis(94f, val7) * val10; val10 *= ShieldSurfRotationOffset; Vector3 position = ((Component)p).transform.position - val3 * ShieldSurfDownOffset + val6 * ShieldSurfForwardOffset; transform.position = position; transform.rotation = val10; if (!_loggedShieldAxes) { _loggedShieldAxes = true; Vector3 up = transform.up; Vector3 forward = transform.forward; Vector3 right = transform.right; Vector3 eulerAngles = ((Quaternion)(ref val10)).eulerAngles; } } private static void RestoreShieldBoard() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_shieldSurfInstance == (Object)null) { return; } try { Transform transform = _shieldSurfInstance.transform; if ((Object)(object)_shieldOriginalParent != (Object)null) { transform.SetParent(_shieldOriginalParent, false); } transform.localPosition = _shieldOriginalLocalPos; transform.localRotation = _shieldOriginalLocalRot; } catch { } _shieldSurfInstance = null; _shieldOriginalParent = null; _loggedShieldAxes = false; } private static bool ProcessUphillGain(Player p, float surfaceHeight) { if (CfgMaxUphillGain == null) { return false; } if (!_hasSurfaceHeight) { _hasSurfaceHeight = true; _lastSurfaceHeight = surfaceHeight; _accumulatedUphillGain = 0f; return false; } float num = surfaceHeight - _lastSurfaceHeight; if (num > 0.01f) { _accumulatedUphillGain += num; } else if (num < -0.02f) { _accumulatedUphillGain = Mathf.Max(0f, _accumulatedUphillGain + num); } _lastSurfaceHeight = surfaceHeight; float num2 = Mathf.Max(0.1f, CfgMaxUphillGain.Value); if (_accumulatedUphillGain > num2) { EndSurf(p); return true; } return false; } private static Rigidbody GetRigidbody(Player p) { if ((Object)(object)p == (Object)null) { return null; } Rigidbody component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } return ((Component)p).GetComponentInChildren(); } } internal static class Slam { [HarmonyPatch(typeof(CharacterAnimEvent), "Speed")] private static class CharacterAnimEvent_Speed_Patch { private static void Postfix(CharacterAnimEvent __instance, float speedScale) { try { if ((Object)(object)__instance == (Object)null) { return; } Character componentInParent = ((Component)__instance).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return; } int instanceID = ((Object)componentInParent).GetInstanceID(); if (_activeSlamAnimOverrides.Contains(instanceID)) { Animator val = ((Component)__instance).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)componentInParent).GetComponentInChildren(); } if (!((Object)(object)val == (Object)null)) { float slamAnimSpeedMultiplier = GetSlamAnimSpeedMultiplier(); float speed = Mathf.Max(0.05f, speedScale * slamAnimSpeedMultiplier); val.speed = speed; ForceAnimatorSpeedImmediate(val); } } } catch { } } } [HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")] private static class CharacterAnimEvent_CustomFixedUpdate_Patch { private static void Postfix(CharacterAnimEvent __instance) { try { if ((Object)(object)__instance == (Object)null) { return; } Character componentInParent = ((Component)__instance).GetComponentInParent(); if ((Object)(object)componentInParent == (Object)null) { return; } int instanceID = ((Object)componentInParent).GetInstanceID(); if (_activeSlamAnimOverrides.Contains(instanceID)) { Animator val = ((Component)__instance).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)componentInParent).GetComponentInChildren(); } if (!((Object)(object)val == (Object)null)) { float slamAnimSpeedMultiplier = GetSlamAnimSpeedMultiplier(); val.speed = slamAnimSpeedMultiplier; ForceAnimatorSpeedImmediate(val); } } } catch { } } } [CompilerGenerated] private sealed class d__75 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player p; public int id; private Animator 5__1; private float 5__2; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__75(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(); } } 5__1 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>1__state = -3; break; case 1: <>1__state = -3; break; } if ((Object)(object)p != (Object)null && _activeSlamAnimOverrides.Contains(id)) { try { 5__1 = ((Component)p).GetComponentInChildren(); if ((Object)(object)5__1 != (Object)null) { 5__2 = GetSlamAnimSpeedMultiplier(); 5__1.speed = 5__2; ForceAnimatorSpeedImmediate(5__1); } 5__1 = null; } catch { } <>2__current = null; <>1__state = 1; return true; } <>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; _slamAnimSpeedCoroutines.Remove(id); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__71 : IEnumerator, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Player p; public Vector3 targetPoint; private Rigidbody 5__1; private float 5__2; private float 5__3; private Vector3 5__4; private float 5__5; private Vector3 5__6; private bool 5__7; private float 5__8; private Vector3 5__9; private Vector3 5__10; private Vector3 5__11; private RaycastHit 5__12; private bool 5__13; private Vector3 5__14; private RaycastHit 5__15; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__71(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { 5__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0436: Expected O, but got Unknown //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_020a: 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_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_047f: 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_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_026d: 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) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if ((Object)(object)p == (Object)null) { return false; } 5__1 = null; try { 5__1 = ((Component)p).GetComponent(); } catch { 5__1 = null; } if ((Object)(object)5__1 == (Object)null) { return false; } 5__2 = 0.12f; 5__3 = 44f; try { 5__2 = Mathf.Clamp(CfgTravelSeconds.Value, 0.04f, 0.4f); } catch { } try { 5__3 = Mathf.Clamp(CfgTravelSpeed.Value, 15f, 150f); } catch { } 5__4 = targetPoint + Vector3.up * 0.1f; 5__5 = 0f; goto IL_01f1; case 1: <>1__state = -1; goto IL_01f1; case 2: { <>1__state = -1; break; } IL_01f1: if (5__5 < 5__2) { if ((Object)(object)p == (Object)null) { return false; } 5__9 = ((Component)p).transform.position; 5__10 = 5__4 - 5__9; if (5__10.y > -0.6f) { 5__10.y = -0.6f; } 5__11 = ((((Vector3)(ref 5__10)).sqrMagnitude > 0.001f) ? ((Vector3)(ref 5__10)).normalized : Vector3.down); 5__1.linearVelocity = 5__11 * 5__3; 5__5 += Time.fixedDeltaTime; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 1; return true; } 5__6 = 5__4; try { if (Physics.Raycast(5__4 + Vector3.up * 6f, Vector3.down, ref 5__12, 20f, -1, (QueryTriggerInteraction)1)) { 5__6 = ((RaycastHit)(ref 5__12)).point + Vector3.up * 0.05f; } else if (Physics.Raycast(((Component)p).transform.position + Vector3.up * 6f, Vector3.down, ref 5__12, 20f, -1, (QueryTriggerInteraction)1)) { 5__6 = ((RaycastHit)(ref 5__12)).point + Vector3.up * 0.05f; } } catch { } try { ((Component)p).transform.position = 5__6; } catch { } try { 5__1.linearVelocity = Vector3.zero; } catch { } 5__7 = false; 5__8 = 0f; break; } if (!5__7 && 5__8 < 1.25f) { if ((Object)(object)p == (Object)null) { return false; } 5__13 = false; try { 5__13 = ((Character)p).IsOnGround(); } catch { 5__13 = true; } if (!5__13) { 5__8 += Time.fixedDeltaTime; <>2__current = (object)new WaitForFixedUpdate(); <>1__state = 2; return true; } 5__14 = ((Component)p).transform.position; try { if (Physics.Raycast(5__14 + Vector3.up * 2f, Vector3.down, ref 5__15, 6f, -1, (QueryTriggerInteraction)1)) { 5__14 = ((RaycastHit)(ref 5__15)).point; } } catch { } DoSlamImpact(p, 5__14); RestoreSlamAnimSpeed(p); HideAimMarker(); 5__7 = true; } if (!5__7) { DoSlamImpact(p, 5__6); RestoreSlamAnimSpeed(p); HideAimMarker(); } 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(); } } private static bool _loggedTickException; private static bool _loggedMarkerException; private const string CfgSection = "Slam"; private const float SlamAnimSpeedMultiplierDefault = 2f; private static readonly int ZdoSlamCharges = "MV_SlamCharges".GetStableHashCode(); private static readonly int ZdoSlamNextRechargeMs = "MV_SlamNextRechargeMs".GetStableHashCode(); private static readonly int ZdoSlamNoFallUntilMs = "MV_SlamNoFallUntilMs".GetStableHashCode(); private static MovementPlugin _plugin; private static ConfigEntry CfgEnabled; private static ConfigEntry CfgKey; private static ConfigEntry CfgZInputAction; private static ConfigEntry CfgMaxCharges; private static ConfigEntry CfgRechargeSeconds; private static ConfigEntry CfgStaminaCost; private static ConfigEntry CfgRequiredGlobalKey; private static ConfigEntry CfgAimMaxDistance; private static ConfigEntry CfgTravelSeconds; private static ConfigEntry CfgTravelSpeed; private static ConfigEntry CfgAutoEquipSledge; private static ConfigEntry CfgNoFallSeconds; private static ConfigEntry CfgUseBuiltInSledgeAoe; private static ConfigEntry CfgAoeRadius; private static ConfigEntry CfgFxEnabled; private static ConfigEntry CfgImpactVfxPrefab; private static ConfigEntry CfgDownwardOnlyAngleDeg; private static ConfigEntry CfgShowAimMarker; private static ConfigEntry CfgAimMarkerScale; private static ConfigEntry CfgMinAirSecondsBeforeSlam; private static ConfigEntry CfgAnimSpeedMultiplier; private static ItemData _cachedSledgeTemplate; private static GameObject _cachedImpactVfx; private static GameObject _cachedImpactSfx; private static GameObject _aimMarker; private static bool _suppressWeaponHitEffects; private static float _aimMarkerLastShownAt; private static AssetBundle _aimMarkerBundle; private static GameObject _aimMarkerPrefab; private const float AimUpdateIntervalSeconds = 0.07f; private const float CameraRefreshIntervalSeconds = 1f; private static float _nextAimUpdateAt; private static bool _cachedAimValid; private static Vector3 _cachedAimPoint; private static Camera _cachedCam; private static float _nextCameraRefreshAt; private static bool _loggedAimBundleAssets; private static long _airborneStartMs; private static bool _wasAirborne; private static readonly Dictionary _slamAnimOriginalSpeeds = new Dictionary(); private static readonly HashSet _activeSlamAnimOverrides = new HashSet(); private static readonly Dictionary _slamAnimSpeedCoroutines = new Dictionary(); private static void LogOnce(ref bool flag, string msg, Exception ex = null) { if (flag) { return; } flag = true; try { if (MovementPlugin.Log != null) { if (ex != null) { MovementPlugin.Log.LogWarning((object)("[MV] " + msg + ": " + ex.GetType().Name + " " + ex.Message)); } else { MovementPlugin.Log.LogWarning((object)("[MV] " + msg)); } } } catch (Exception ex2) { LogOnce(ref _loggedTickException, "Slam Tick airborne state tracking failed", ex2); } } internal static void Init(MovementPlugin plugin) { if (!((Object)(object)plugin == (Object)null) && !((Object)(object)_plugin != (Object)null)) { _plugin = plugin; CfgEnabled = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "Enabled", true, "Enable the Ground Slam feature."); CfgKey = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "Key", (KeyCode)103, "Ground Slam key (keyboard)."); CfgZInputAction = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "ZInputAction", "", "Optional: ZInput action name for controller support (advanced). Leave blank to disable."); CfgMaxCharges = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "MaxCharges", 2, "Maximum slam charges."); CfgRechargeSeconds = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "RechargeSeconds", 60f, "Seconds to recharge 1 slam charge."); CfgStaminaCost = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "StaminaCost", 25f, "Stamina cost per slam."); CfgRequiredGlobalKey = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "RequiredGlobalKey", "defeated_dragon", "Global key required to use slam (e.g. defeated_dragon). Leave blank to disable gating."); CfgAimMaxDistance = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "AimMaxDistance", 35f, "Max distance to raycast for slam landing point."); CfgTravelSeconds = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "TravelSeconds", 0.12f, "Seconds to travel toward the slam landing point (animation feel)."); CfgTravelSpeed = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "TravelSpeed", 44f, "Velocity used to drive the player toward the slam landing point."); CfgAutoEquipSledge = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "AutoEquipSledge", true, "If true, auto-equips a sledge before triggering the impact (if found in inventory)."); CfgNoFallSeconds = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "NoFallSeconds", 2.5f, "Seconds of fall-damage immunity after slamming (prevents odd fall damage)."); CfgUseBuiltInSledgeAoe = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "UseBuiltInSledgeAoe", true, "If true, triggers the equipped sledge's alt-attack AOE on impact."); CfgAoeRadius = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "AoeRadius", 4f, "Fallback AOE radius if built-in AOE cannot be determined."); CfgFxEnabled = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "FxEnabled", true, "If true, plays impact VFX/SFX on slam."); CfgImpactVfxPrefab = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "ImpactVfxPrefab", "fx_fader_meteor_hit", "Prefab spawned at the slam landing point when built-in effects are unavailable. Leave blank to skip extra VFX."); CfgImpactVfxPrefab.SettingChanged += OnImpactVfxSettingChanged; CfgDownwardOnlyAngleDeg = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "DownwardOnlyAngleDeg", 15f, "If >0, requires your aim to be at least this many degrees downward (prevents forward-air slams)."); CfgShowAimMarker = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "ShowAimMarker", true, "If true, shows an aim marker on the ground while airborne."); CfgAimMarkerScale = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "AimMarkerScale", 2f, "Scale multiplier for the aim marker prefab."); CfgMinAirSecondsBeforeSlam = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "MinAirSecondsBeforeSlam", 1f, "Minimum seconds airborne before slam is allowed (prevents accidental ground taps)."); CfgAnimSpeedMultiplier = ((BaseUnityPlugin)plugin).Config.Bind("Slam", "AnimSpeedMultiplier", 2f, "Multiplier applied to the slam animation speed. Use values between 0.5 and 3.0."); } } private static void ResetImpactFxCache() { _cachedImpactVfx = null; _cachedImpactSfx = null; } private static void OnImpactVfxSettingChanged(object sender, EventArgs e) { ResetImpactFxCache(); } private static string GetImpactVfxName() { try { return (CfgImpactVfxPrefab?.Value ?? string.Empty).Trim(); } catch { return string.Empty; } } private static GameObject FindScenePrefab(string name) { if (string.IsNullOrWhiteSpace(name)) { return null; } 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 { } } return val; } internal static void Tick(Player p) { //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: 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_0100: 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) if ((Object)(object)_plugin == (Object)null) { try { if ((Object)(object)MovementPlugin.Instance != (Object)null) { Init(MovementPlugin.Instance); } } catch (Exception ex) { LogOnce(ref _loggedTickException, "Slam Tick self-init failed", ex); } } if ((Object)(object)_plugin == (Object)null) { return; } if (!CfgEnabled.Value) { HideAimMarker(); return; } if ((Object)(object)p == (Object)null) { HideAimMarker(); return; } if (!((Character)p).IsPlayer()) { HideAimMarker(); return; } if ((Object)(object)Player.m_localPlayer == (Object)null || (Object)(object)p != (Object)(object)Player.m_localPlayer) { HideAimMarker(); return; } bool flag = true; try { flag = !((Character)p).IsOnGround(); if (!flag) { Vector3 velocity = ((Character)p).GetVelocity(); if (velocity.y > 0.5f) { flag = true; } } } catch (Exception ex2) { LogOnce(ref _loggedTickException, "Slam Tick airborne check failed", ex2); flag = true; } if (!flag) { HideAimMarker(); return; } try { if (flag) { if (!_wasAirborne) { _wasAirborne = true; _airborneStartMs = NowMs(); } } else { _wasAirborne = false; _airborneStartMs = 0L; } } catch { } bool flag2 = false; try { flag2 = IsChargeReady(p); } catch { flag2 = false; } bool flag3 = false; try { flag3 = CanStartSlamNow(p); } catch { flag3 = false; } bool flag4 = false; try { flag4 = IsSlamPressed(); } catch { flag4 = false; } float num = 0f; try { num = Time.time; } catch { num = 0f; } if (flag4 || num >= _nextAimUpdateAt || !_cachedAimValid) { _nextAimUpdateAt = num + 0.07f; _cachedAimValid = TryGetAimPoint(p, out _cachedAimPoint); } bool cachedAimValid = _cachedAimValid; Vector3 cachedAimPoint = _cachedAimPoint; if (cachedAimValid) { UpdateAimMarker(p, cachedAimPoint, canSlam: true, flag2); } else { HideAimMarker(); } if (!IsSlamPressed() || !flag2 || !cachedAimValid) { return; } ConsumeCharge(p); SetNoFallWindow(p); PlaySlamStartFx(p); try { string text = ((CfgRequiredGlobalKey != null) ? (CfgRequiredGlobalKey.Value ?? "") : ""); if (!string.IsNullOrEmpty(text) && ((Object)(object)ZoneSystem.instance == (Object)null || !ZoneSystem.instance.GetGlobalKey(text))) { return; } } catch { } try { float num2 = ((CfgStaminaCost != null) ? Mathf.Max(0f, CfgStaminaCost.Value) : 0f); if (num2 > 0f) { if (p.GetStamina() < num2) { return; } ((Character)p).UseStamina(num2); } } catch { } try { ZSyncAnimation component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { component.SetTrigger("dual_knives_secondary"); } } catch { } ApplySlamAnimSpeed(p); StartSlam(p, cachedAimPoint); } private static bool IsSlamPressed() { //IL_0043: Unknown result type (might be due to invalid IL or missing references) try { string value = CfgZInputAction.Value; if (!string.IsNullOrEmpty(value) && ZInput.instance != null && ZInput.GetButtonDown(value)) { return true; } } catch { } try { return Input.GetKeyDown(CfgKey.Value); } catch { return false; } } private static long NowMs() { double num = 0.0; try { if ((Object)(object)ZNet.instance != (Object)null) { num = ZNet.instance.GetTimeSeconds(); } } catch { } if (num <= 0.0) { try { num = Time.realtimeSinceStartup; } catch { num = 0.0; } } return (long)(num * 1000.0); } private static ZNetView GetNView(Player p) { try { if ((Object)(object)p == (Object)null) { return null; } return ((Component)p).GetComponent(); } catch { return null; } } private static ZDO GetZdo(Player p) { try { if ((Object)(object)p == (Object)null) { return null; } ZNetView nView = GetNView(p); if ((Object)(object)nView == (Object)null || !nView.IsValid()) { return null; } return nView.GetZDO(); } catch { return null; } } private static bool IsChargeReady(Player p) { ZDO zdo = GetZdo(p); if (zdo == null) { return false; } UpdateCharges(p, zdo); int num = 0; try { num = zdo.GetInt(ZdoSlamCharges, 0); } catch { num = 0; } return num > 0; } private static void ConsumeCharge(Player p) { ZDO zdo = GetZdo(p); if (zdo == null) { return; } UpdateCharges(p, zdo); int num = 2; try { num = Mathf.Clamp(CfgMaxCharges.Value, 1, 10); } catch { num = 2; } int num2 = num; try { num2 = zdo.GetInt(ZdoSlamCharges, num); } catch { num2 = num; } if (num2 <= 0) { return; } num2--; try { zdo.Set(ZdoSlamCharges, num2, false); } catch { } long num3 = NowMs(); long num4 = 0L; try { num4 = zdo.GetLong(ZdoSlamNextRechargeMs, 0L); } catch { num4 = 0L; } if (num2 >= num || num4 > 0) { return; } float num5 = 60f; try { num5 = Mathf.Max(1f, CfgRechargeSeconds.Value); } catch { num5 = 60f; } long num6 = num3 + (long)(num5 * 1000f); try { zdo.Set(ZdoSlamNextRechargeMs, num6); } catch { } } private static void UpdateCharges(Player p, ZDO zdo) { if ((Object)(object)p == (Object)null || zdo == null) { return; } int num = 2; try { num = Mathf.Clamp(CfgMaxCharges.Value, 1, 10); } catch { num = 2; } long num2 = NowMs(); int num3; try { num3 = zdo.GetInt(ZdoSlamCharges, -1); } catch { num3 = -1; } if (num3 < 0) { num3 = num; try { zdo.Set(ZdoSlamCharges, num3, false); } catch { } try { zdo.Set(ZdoSlamNextRechargeMs, 0L); return; } catch { return; } } long num4; try { num4 = zdo.GetLong(ZdoSlamNextRechargeMs, 0L); } catch { num4 = 0L; } if (num3 >= num) { if (num4 == 0) { return; } try { zdo.Set(ZdoSlamNextRechargeMs, 0L); return; } catch { return; } } if (num4 <= 0) { float num5 = 60f; try { num5 = Mathf.Max(1f, CfgRechargeSeconds.Value); } catch { num5 = 60f; } long num6 = num2 + (long)(num5 * 1000f); try { zdo.Set(ZdoSlamNextRechargeMs, num6); return; } catch { return; } } if (num2 < num4) { return; } num3++; if (num3 > num) { num3 = num; } try { zdo.Set(ZdoSlamCharges, num3, false); } catch { } if (num3 >= num) { try { zdo.Set(ZdoSlamNextRechargeMs, 0L); return; } catch { return; } } float num7 = 60f; try { num7 = Mathf.Max(1f, CfgRechargeSeconds.Value); } catch { num7 = 60f; } long num8 = num2 + (long)(num7 * 1000f); try { zdo.Set(ZdoSlamNextRechargeMs, num8); } catch { } } private static bool CanStartSlamNow(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_00f7: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_014e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return false; } bool flag = true; try { flag = ((Character)p).IsOnGround(); } catch { flag = true; } if (flag) { return false; } try { float num = 1f; try { if (CfgMinAirSecondsBeforeSlam != null) { num = Mathf.Clamp(CfgMinAirSecondsBeforeSlam.Value, 0f, 3f); } } catch { num = 1f; } if (num > 0f && _airborneStartMs > 0) { long num2 = NowMs() - _airborneStartMs; if (num2 < (long)(num * 1000f)) { return false; } } } catch { } float num3 = 15f; try { num3 = Mathf.Clamp(CfgDownwardOnlyAngleDeg.Value, 0f, 45f); } catch { num3 = 15f; } Vector3 val = Vector3.zero; try { val = ((Character)p).GetVelocity(); } catch { val = Vector3.zero; } if (((Vector3)(ref val)).sqrMagnitude < 0.0004f) { return true; } if (val.y >= -0.1f) { return false; } float num4 = Vector3.Angle(((Vector3)(ref val)).normalized, Vector3.down); return num4 <= num3; } private static float GetSlamAnimSpeedMultiplier() { float result = 2f; try { if (CfgAnimSpeedMultiplier != null) { result = Mathf.Clamp(CfgAnimSpeedMultiplier.Value, 0.5f, 3f); } } catch { result = 2f; } return result; } private static void EnsureAimMarker() { //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_057d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_aimMarker != (Object)null) { return; } try { if ((Object)(object)_aimMarkerPrefab == (Object)null) { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] array = new string[6] { "Resources.AssetBundles.mv_landingcircle_v2", "Resources.AssetBundles.mv_landingcircle_v2.bytes", "Resources.AssetBundles.mv_landingcircle_v2.ab", "mv_landingcircle_v2", "mv_landingcircle_v2.bytes", "mv_landingcircle_v2.ab" }; string[] array2 = null; try { array2 = executingAssembly.GetManifestResourceNames(); } catch { array2 = null; } if (array2 != null) { for (int i = 0; i < array.Length; i++) { if (text != null) { break; } string text2 = array[i]; foreach (string text3 in array2) { if (text3 == text2 || text3.EndsWith("." + text2, StringComparison.OrdinalIgnoreCase) || text3.EndsWith(text2, StringComparison.OrdinalIgnoreCase)) { text = text3; break; } } } if (text == null) { foreach (string text4 in array2) { if (text4.EndsWith("mv_landingcircle_v2", StringComparison.OrdinalIgnoreCase) || text4.EndsWith("mv_landingcircle_v2.bytes", StringComparison.OrdinalIgnoreCase) || text4.EndsWith("mv_landingcircle_v2.ab", StringComparison.OrdinalIgnoreCase) || text4.EndsWith("mv_landingcircle", StringComparison.OrdinalIgnoreCase) || text4.EndsWith("mv_landingcircle.bytes", StringComparison.OrdinalIgnoreCase) || text4.EndsWith("mv_landingcircle.ab", StringComparison.OrdinalIgnoreCase)) { text = text4; break; } } } } if (text != null) { byte[] array3 = null; using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream != null) { using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array3 = memoryStream.ToArray(); } } if (array3 != null && array3.Length != 0) { _aimMarkerBundle = AssetBundle.LoadFromMemory(array3); if ((Object)(object)_aimMarkerBundle != (Object)null) { try { _aimMarkerPrefab = _aimMarkerBundle.LoadAsset("mv_landingcircle_v2"); } catch { } if ((Object)(object)_aimMarkerPrefab == (Object)null) { try { _aimMarkerPrefab = _aimMarkerBundle.LoadAsset("mv_landingcircle"); } catch { } } if ((Object)(object)_aimMarkerPrefab == (Object)null) { try { _aimMarkerPrefab = _aimMarkerBundle.LoadAsset("MV_LandingCircle"); } catch { } } if ((Object)(object)_aimMarkerPrefab == (Object)null) { try { GameObject[] array4 = _aimMarkerBundle.LoadAllAssets(); if (array4 != null && array4.Length != 0) { foreach (GameObject val in array4) { if ((Object)(object)val == (Object)null) { continue; } try { if ((Object)(object)val.GetComponent() != (Object)null) { continue; } } catch { } _aimMarkerPrefab = val; break; } if ((Object)(object)_aimMarkerPrefab == (Object)null) { _aimMarkerPrefab = array4[0]; } if (!_loggedAimBundleAssets && MovementPlugin.Log != null) { _loggedAimBundleAssets = true; try { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("[MV] Slam aim bundle loaded. Resource: ").Append(text).Append(" | GameObjects: "); for (int m = 0; m < array4.Length; m++) { if (m > 0) { stringBuilder.Append(", "); } stringBuilder.Append(Object.op_Implicit((Object)(object)array4[m]) ? ((Object)array4[m]).name : ""); } MovementPlugin.Log.LogInfo((object)stringBuilder.ToString()); } catch { } } } } catch { _aimMarkerPrefab = null; } } } } } } catch { _aimMarkerPrefab = null; } } if ((Object)(object)_aimMarkerPrefab != (Object)null) { _aimMarker = Object.Instantiate(_aimMarkerPrefab); ((Object)_aimMarker).name = "MV_SlamAimMarker"; try { _aimMarker.SetActive(false); return; } catch { return; } } _aimMarker = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)_aimMarker).name = "MV_SlamAimMarker_Fallback"; try { Object.Destroy((Object)(object)_aimMarker.GetComponent()); } catch { } try { MeshRenderer component = _aimMarker.GetComponent(); if ((Object)(object)component != (Object)null) { ((Renderer)component).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component).receiveShadows = false; } } catch { } try { Shader val2 = Shader.Find("Standard"); if ((Object)(object)val2 != (Object)null) { Material val3 = new Material(val2); val3.color = new Color(1f, 0f, 1f, 0.55f); val3.EnableKeyword("_EMISSION"); val3.SetColor("_EmissionColor", new Color(1f, 0f, 1f, 2.5f)); MeshRenderer component2 = _aimMarker.GetComponent(); if ((Object)(object)component2 != (Object)null) { ((Renderer)component2).sharedMaterial = val3; } } } catch { } try { _aimMarker.SetActive(false); } catch { } } catch { _aimMarker = null; } } private static void HideAimMarker() { try { if ((Object)(object)_aimMarker != (Object)null) { _aimMarker.SetActive(false); } } catch { } } private static void UpdateAimMarker(Player p, Vector3 point, bool canSlam, bool cooldownReady) { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) if (CfgShowAimMarker != null && !CfgShowAimMarker.Value) { HideAimMarker(); return; } if ((Object)(object)p == (Object)null || !cooldownReady) { HideAimMarker(); return; } if (!canSlam) { HideAimMarker(); return; } try { string text = ((CfgRequiredGlobalKey != null) ? (CfgRequiredGlobalKey.Value ?? "") : ""); if (!string.IsNullOrEmpty(text)) { if ((Object)(object)ZoneSystem.instance == (Object)null) { HideAimMarker(); return; } if (!ZoneSystem.instance.GetGlobalKey(text)) { HideAimMarker(); return; } } } catch { HideAimMarker(); return; } EnsureAimMarker(); if ((Object)(object)_aimMarker == (Object)null) { return; } float num = Mathf.Clamp(CfgAimMarkerScale.Value, 0.5f, 6f); try { _aimMarker.transform.position = point + Vector3.up * 0.15f; _aimMarker.transform.rotation = Quaternion.identity; _aimMarker.transform.localScale = Vector3.one * num; if (!_aimMarker.activeSelf) { _aimMarker.SetActive(true); } _aimMarkerLastShownAt = Time.time; } catch (Exception ex) { LogOnce(ref _loggedMarkerException, "Slam aim marker update failed", ex); HideAimMarker(); } } private static void SetNoFallWindow(Player p) { ZDO zdo = GetZdo(p); if (zdo == null) { return; } long num = NowMs(); float num2 = 2.5f; try { num2 = Mathf.Max(0.2f, CfgNoFallSeconds.Value); } catch { } long num3 = num + (long)(num2 * 1000f); try { zdo.Set(ZdoSlamNoFallUntilMs, num3); } catch { } } private static void StartSlam(Player p, Vector3 targetPoint) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)MovementPlugin.Instance == (Object)null)) { ((MonoBehaviour)MovementPlugin.Instance).StartCoroutine(CoSlamTravel(p, targetPoint)); } } catch { } } [IteratorStateMachine(typeof(d__71))] private static IEnumerator CoSlamTravel(Player p, Vector3 targetPoint) { //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 d__71(0) { p = p, targetPoint = targetPoint }; } private static void ApplySlamAnimSpeed(Player p) { if ((Object)(object)p == (Object)null) { return; } try { Animator componentInChildren = ((Component)p).GetComponentInChildren(); if (!((Object)(object)componentInChildren == (Object)null)) { int instanceID = ((Object)p).GetInstanceID(); if (!_slamAnimOriginalSpeeds.ContainsKey(instanceID)) { _slamAnimOriginalSpeeds[instanceID] = componentInChildren.speed; } float slamAnimSpeedMultiplier = GetSlamAnimSpeedMultiplier(); componentInChildren.speed = slamAnimSpeedMultiplier; ForceAnimatorSpeedImmediate(componentInChildren); _activeSlamAnimOverrides.Add(instanceID); StartSlamAnimSpeedMaintenance(p, instanceID); } } catch { } } private static void RestoreSlamAnimSpeed(Player p) { if ((Object)(object)p == (Object)null) { return; } try { int instanceID = ((Object)p).GetInstanceID(); Animator componentInChildren = ((Component)p).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && _slamAnimOriginalSpeeds.TryGetValue(instanceID, out var value)) { componentInChildren.speed = value; } _slamAnimOriginalSpeeds.Remove(instanceID); _activeSlamAnimOverrides.Remove(instanceID); if (!_slamAnimSpeedCoroutines.TryGetValue(instanceID, out var value2)) { return; } try { if ((Object)(object)MovementPlugin.Instance != (Object)null && value2 != null) { ((MonoBehaviour)MovementPlugin.Instance).StopCoroutine(value2); } } catch { } _slamAnimSpeedCoroutines.Remove(instanceID); } catch { } } private static void StartSlamAnimSpeedMaintenance(Player p, int id) { if ((Object)(object)p == (Object)null || (Object)(object)MovementPlugin.Instance == (Object)null || _slamAnimSpeedCoroutines.ContainsKey(id)) { return; } try { Coroutine value = ((MonoBehaviour)MovementPlugin.Instance).StartCoroutine(CoMaintainSlamAnimSpeed(p, id)); _slamAnimSpeedCoroutines[id] = value; } catch { } } [IteratorStateMachine(typeof(d__75))] private static IEnumerator CoMaintainSlamAnimSpeed(Player p, int id) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__75(0) { p = p, id = id }; } private static void ForceAnimatorSpeedImmediate(Animator animator) { if ((Object)(object)animator == (Object)null) { return; } try { if (((Behaviour)animator).isActiveAndEnabled) { animator.Update(0f); } } catch { } } private static Camera GetAimCamera() { float num = 0f; try { num = Time.time; } catch { num = 0f; } if ((Object)(object)_cachedCam != (Object)null && num < _nextCameraRefreshAt) { return _cachedCam; } _nextCameraRefreshAt = num + 1f; try { if ((Object)(object)GameCamera.instance != (Object)null) { _cachedCam = ((Component)GameCamera.instance).GetComponent(); if ((Object)(object)_cachedCam != (Object)null) { return _cachedCam; } } } catch { } try { _cachedCam = Camera.main; return _cachedCam; } catch { _cachedCam = null; return null; } } private static bool TryGetAimPoint(Player p, out Vector3 point) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; Camera aimCamera = GetAimCamera(); if ((Object)(object)aimCamera == (Object)null) { return false; } Vector3 position = ((Component)aimCamera).transform.position; Vector3 forward = ((Component)aimCamera).transform.forward; float num = Mathf.Clamp(CfgAimMaxDistance.Value, 5f, 200f); RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, forward, ref val, num, -1, (QueryTriggerInteraction)1)) { point = ((RaycastHit)(ref val)).point; try { float y = ((Component)p).transform.position.y; if (point.y > y + 0.25f) { return false; } } catch { } return true; } try { Vector3 val2 = ((Component)p).transform.position + forward * 6f; if (Physics.Raycast(val2 + Vector3.up * 30f, Vector3.down, ref val, 100f, -1, (QueryTriggerInteraction)1)) { point = ((RaycastHit)(ref val)).point; try { float y2 = ((Component)p).transform.position.y; if (point.y > y2 + 0.25f) { return false; } } catch { } return true; } } catch { } return false; } private static ItemData ResolveSledgeTemplate() { if (_cachedSledgeTemplate != null) { return _cachedSledgeTemplate; } try { if ((Object)(object)ObjectDB.instance == (Object)null) { return null; } string[] array = new string[6] { "SledgeStagbreaker", "Stagbreaker", "SledgeIron", "IronSledge", "Demolisher", "SledgeDemolisher" }; for (int i = 0; i < array.Length; i++) { GameObject val = null; try { val = ObjectDB.instance.GetItemPrefab(array[i]); } catch { val = null; } if (!((Object)(object)val == (Object)null)) { ItemDrop component = val.GetComponent(); if (!((Object)(object)component == (Object)null)) { _cachedSledgeTemplate = component.m_itemData; return _cachedSledgeTemplate; } } } try { List items = ObjectDB.instance.m_items; if (items != null) { for (int j = 0; j < items.Count; j++) { GameObject val2 = items[j]; if ((Object)(object)val2 == (Object)null) { continue; } ItemDrop component2 = val2.GetComponent(); if ((Object)(object)component2 == (Object)null) { continue; } ItemData itemData = component2.m_itemData; if (itemData != null && itemData.m_shared != null) { string text = ((Object)val2).name ?? ""; string text2 = itemData.m_shared.m_name ?? ""; if (text.IndexOf("Stagbreaker", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("stagbreaker", StringComparison.OrdinalIgnoreCase) >= 0) { _cachedSledgeTemplate = itemData; return _cachedSledgeTemplate; } if (text.IndexOf("Sledge", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("sledge", StringComparison.OrdinalIgnoreCase) >= 0 || text.IndexOf("Demolisher", StringComparison.OrdinalIgnoreCase) >= 0 || text2.IndexOf("demolisher", StringComparison.OrdinalIgnoreCase) >= 0) { _cachedSledgeTemplate = itemData; return _cachedSledgeTemplate; } } } } } catch { } } catch { } return null; } private static void PlaySlamStartFx(Player p) { if ((Object)(object)p == (Object)null) { return; } try { if (((Character)p).IsOnGround()) { HideAimMarker(); } } catch { } } private static void DoSlamImpact(Player p, Vector3 point) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p == (Object)null) { return; } try { if (((Character)p).IsOnGround()) { HideAimMarker(); } } catch { } SpawnCustomImpactVfx(point); bool flag = true; try { flag = CfgUseBuiltInSledgeAoe == null || CfgUseBuiltInSledgeAoe.Value; } catch { flag = true; } if (flag) { ItemData val = ResolveSledgeTemplate(); if (val != null) { ApplySledgeAoeDamage(p, val, point); } } } private static void SpawnCustomImpactVfx(Vector3 point) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) bool flag = true; try { flag = CfgFxEnabled == null || CfgFxEnabled.Value; } catch { flag = true; } if (!flag) { return; } string impactVfxName = GetImpactVfxName(); if (string.IsNullOrWhiteSpace(impactVfxName)) { return; } GameObject val = FindScenePrefab(impactVfxName); if (!((Object)(object)val != (Object)null)) { return; } try { Object.Instantiate(val, point, Quaternion.identity); } catch { } } private static void ApplySledgeAoeDamage(Player attacker, ItemData tpl, Vector3 point) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_013f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)attacker == (Object)null || tpl == null) { return; } float num = 4f; try { num = Mathf.Clamp(CfgAoeRadius.Value, 1f, 12f); } catch { num = 4f; } List list = null; try { list = Character.GetAllCharacters(); } catch { list = null; } if (list == null) { return; } DamageTypes damage = default(DamageTypes); try { damage = tpl.m_shared.m_damages; } catch { } for (int i = 0; i < list.Count; i++) { Character val = list[i]; if ((Object)(object)val == (Object)null || (Object)(object)val == (Object)(object)attacker || val.IsDead() || val is Player) { continue; } float num2 = Vector3.Distance(((Component)val).transform.position, point); if (!(num2 > num)) { try { HitData val2 = new HitData(); val2.m_point = point; Vector3 val3 = ((Component)val).transform.position - point; val2.m_dir = ((Vector3)(ref val3)).normalized; val2.m_damage = damage; val2.m_pushForce = 45f; val2.m_staggerMultiplier = 1f; val2.SetAttacker((Character)(object)attacker); val.Damage(val2); } catch { } } } } private static void TryTriggerSledgeSecondary(Player p) { if ((Object)(object)p == (Object)null) { return; } try { if (((Character)p).IsOnGround()) { HideAimMarker(); } } catch { } ItemData val = null; try { val = ((Humanoid)p).GetCurrentWeapon(); } catch { } ItemData item = val; if (!IsSledge(item)) { bool flag = true; try { flag = CfgAutoEquipSledge == null || CfgAutoEquipSledge.Value; } catch { flag = true; } if (flag) { ItemData val2 = FindSledgeInInventory(p); if (IsSledge(val2)) { try { ((Humanoid)p).EquipItem(val2, false); } catch { } item = val2; } } } try { ((Character)p).StartAttack((Character)null, false); } catch { } } private static ItemData FindSledgeInInventory(Player p) { try { if ((Object)(object)p == (Object)null) { return null; } Inventory inventory = ((Humanoid)p).GetInventory(); if (inventory == null) { return null; } List allItems = inventory.GetAllItems(); if (allItems == null) { return null; } for (int i = 0; i < allItems.Count; i++) { ItemData val = allItems[i]; if (IsSledge(val)) { return val; } } } catch { } return null; } private static bool IsSledge(ItemData item) { if (item == null) { return false; } try { string text = (Object.op_Implicit((Object)(object)item.m_dropPrefab) ? ((Object)item.m_dropPrefab).name : ""); if (text.IndexOf("Stagbreaker", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text.IndexOf("Demolisher", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text.IndexOf("Sledge", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } catch { } try { SharedData shared = item.m_shared; if (shared != null) { string text2 = shared.m_name ?? ""; if (text2.IndexOf("stagbreaker", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text2.IndexOf("demolisher", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } if (text2.IndexOf("sledge", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } catch { } return false; } [HarmonyPatch(typeof(Attack), "DoAreaAttack")] [HarmonyPrefix] private static void Attack_DoAreaAttack_Prefix(Attack __instance, ref EffectList __state) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (!_suppressWeaponHitEffects) { return; } try { ItemData val = ((__instance != null) ? __instance.GetWeapon() : null); if (val?.m_shared != null) { __state = val.m_shared.m_hitEffect; val.m_shared.m_hitEffect = new EffectList(); } } catch { } } [HarmonyPatch(typeof(Attack), "DoAreaAttack")] [HarmonyPostfix] private static void Attack_DoAreaAttack_Postfix(Attack __instance, EffectList __state) { if (__state == null) { return; } try { ItemData val = ((__instance != null) ? __instance.GetWeapon() : null); if (val?.m_shared != null) { val.m_shared.m_hitEffect = __state; } } catch { } } [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] [HarmonyPrefix] private static void Attack_DoMeleeAttack_Prefix(Attack __instance, ref EffectList __state) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (!_suppressWeaponHitEffects) { return; } try { ItemData val = ((__instance != null) ? __instance.GetWeapon() : null); if (val?.m_shared != null) { __state = val.m_shared.m_hitEffect; val.m_shared.m_hitEffect = new EffectList(); } } catch { } } [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] [HarmonyPostfix] private static void Attack_DoMeleeAttack_Postfix(Attack __instance, EffectList __state) { if (__state == null) { return; } try { ItemData val = ((__instance != null) ? __instance.GetWeapon() : null); if (val?.m_shared != null) { val.m_shared.m_hitEffect = __state; } } catch { } } } internal static class Slide { private const string CfgSection = "Slide"; private const string NameSlide = "Quick Roll"; private static MovementPlugin _plugin; private static ConfigEntry CfgEnabled; private static ConfigEntry CfgKey; private static ConfigEntry CfgCooldownSeconds; private static ConfigEntry CfgMinSpeed; private static ConfigEntry CfgMaxDurationSeconds; private static ConfigEntry CfgStaminaCost; private static ConfigEntry CfgDisallowEncumbered; private static ConfigEntry CfgRequiredGlobalKey; private static ConfigEntry CfgSlideSpeed; private static ConfigEntry CfgVfxPrefab; private static ConfigEntry CfgAnimTriggerName; private static bool _isSliding; private static bool _animationTriggered; private static float _slideStartTime; private static Vector3 _slideDirection; private static float _cooldownEndTime; private static float _currentSlideSpeed; private static float _lastVfxTime; private static AssetBundle _slideAnimBundle; private static AnimationClip _slideAnimClip; private static RuntimeAnimatorController _slideController; private static RuntimeAnimatorController _originalController; private static bool _loggedAnimLoad; private static AnimatorStateInfo _storedAnimatorState; private static bool _slideImpactTriggered; private const float SlideImpactRadius = 1.25f; internal static bool IsSliding => _isSliding; internal static void Init(MovementPlugin plugin) { if (!((Object)(object)plugin == (Object)null) && !((Object)(object)_plugin != (Object)null)) { _plugin = plugin; CfgEnabled = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "Enabled", true, "Enable the Slide ability."); CfgKey = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "Key", (KeyCode)308, "Slide activation key (used with modifier key)."); CfgCooldownSeconds = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "CooldownSeconds", 3f, "Cooldown between slides in seconds."); CfgMinSpeed = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "MinSpeed", 4f, "Minimum horizontal speed required to initiate a slide."); CfgMaxDurationSeconds = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "MaxDurationSeconds", 1f, "Slide duration in seconds."); CfgStaminaCost = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "StaminaCost", 8f, "Stamina cost to initiate a slide."); CfgDisallowEncumbered = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "DisallowEncumbered", true, "Prevent sliding while encumbered."); CfgRequiredGlobalKey = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "RequiredGlobalKey", "defeated_eikthyr", "Global key required to use slide. Leave blank to disable gating."); CfgSlideSpeed = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "SlideSpeed", 12f, "Slide movement speed."); CfgVfxPrefab = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "VfxPrefab", "vfx_bush_leaf_puff", "VFX prefab spawned repeatedly during slide."); CfgAnimTriggerName = ((BaseUnityPlugin)plugin).Config.Bind("Slide", "AnimTriggerName", "slide_trigger", "Animation trigger name to use. Try vanilla ones like: dodge, emote_sit, dual_knives_secondary, etc. Set to empty to disable custom animation."); LoadSlideAnimation(); } } internal static void Tick(Player p, KeyCode modKey) { //IL_0056: 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) if ((Object)(object)_plugin == (Object)null || !CfgEnabled.Value || (Object)(object)p == (Object)null) { return; } if (_isSliding) { if (ShouldCancelSlide(p)) { EndSlide(p); } } else if (Input.GetKeyDown(CfgKey.Value) && Input.GetKey(modKey)) { TryStartSlide(p); } } private static void TryStartSlide(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_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) if ((Object)(object)p == (Object)null || _isSliding || ((Character)p).IsDead() || ((Character)p).IsSwimming() || ((Character)p).IsAttached() || ((Character)p).InCutscene()) { return; } try { if (((Character)p).IsRiding()) { return; } } catch { } if (CfgDisallowEncumbered.Value && ((Character)p).IsEncumbered()) { return; } if (!MovementPlugin.HasUnlock("slide", CfgRequiredGlobalKey.Value)) { MovementPlugin.DenyRequires("Quick Roll", CfgRequiredGlobalKey.Value); } else { if (Time.time < _cooldownEndTime) { return; } Rigidbody rigidbody = GetRigidbody(p); if ((Object)(object)rigidbody == (Object)null) { return; } Vector3 linearVelocity = rigidbody.linearVelocity; linearVelocity.y = 0f; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; if (magnitude < Mathf.Max(0.1f, CfgMinSpeed.Value)) { return; } float num = Mathf.Max(0f, CfgStaminaCost.Value); if (!(num > 0f) || !(p.GetStamina() < num)) { if (num > 0f) { ((Character)p).UseStamina(num); } _slideDirection = ((Vector3)(ref linearVelocity)).normalized; _slideStartTime = Time.time; _currentSlideSpeed = Mathf.Max(CfgSlideSpeed.Value, magnitude * 1.2f); _isSliding = true; _animationTriggered = false; _lastVfxTime = 0f; _slideImpactTriggered = false; TriggerSlideAnimation(p, enable: true); _animationTriggered = true; MovementPlugin.SpawnAbilityVfx(CfgVfxPrefab.Value, p); MovementPlugin.PlaySlideSfx(p); } } } [HarmonyPatch(typeof(Character), "UpdateWalking")] [HarmonyPrefix] private static bool UpdateWalkingPrefix(Character __instance, float dt) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) if (!_isSliding) { return true; } Player val = (Player)(object)((__instance is Player) ? __instance : null); if ((Object)(object)val == (Object)null) { return true; } if (val != Player.m_localPlayer) { return true; } if (ShouldCancelSlide(val)) { EndSlide(val); return true; } Rigidbody component = ((Component)__instance).GetComponent(); if ((Object)(object)component == (Object)null) { EndSlide(val); return true; } float num = Mathf.Max(0.1f, CfgMaxDurationSeconds.Value); float num2 = Time.time - _slideStartTime; if (num2 >= num) { EndSlide(val); return true; } Vector3 linearVelocity = component.linearVelocity; Vector3 val2 = _slideDirection * _currentSlideSpeed; val2.y = linearVelocity.y; component.AddForce(val2 - linearVelocity, (ForceMode)2); if (Time.time - _lastVfxTime >= 0.3f) { MovementPlugin.SpawnAbilityVfx(CfgVfxPrefab.Value, val); _lastVfxTime = Time.time; } ZSyncAnimation value = Traverse.Create((object)__instance).Field("m_zanim").Value; if ((Object)(object)value != (Object)null) { value.SetFloat("forward_speed", 0f); value.SetFloat("sideway_speed", 0f); value.SetBool("onGround", true); } TrySlideImpact(val); return false; } private static void EndSlide(Player p) { if (_isSliding) { if ((Object)(object)p != (Object)null) { TriggerSlideAnimation(p, enable: false); } _isSliding = false; _animationTriggered = false; _slideImpactTriggered = false; _cooldownEndTime = Time.time + Mathf.Max(0f, CfgCooldownSeconds.Value); } } internal static void Cancel() { if (_isSliding) { Player localPlayer = Player.m_localPlayer; EndSlide(localPlayer); } } private static bool ShouldCancelSlide(Player p) { if ((Object)(object)p == (Object)null) { return true; } if (((Character)p).IsDead()) { return true; } if (((Character)p).IsSwimming()) { return true; } if (((Character)p).IsAttached()) { return true; } try { if (((Character)p).InAttack()) { return true; } } catch { } if (Input.GetKeyDown((KeyCode)32)) { return true; } float num = Mathf.Max(0f, CfgStaminaCost.Value); if (num > 0f && p.GetStamina() <= 0f) { return true; } return false; } private static Rigidbody GetRigidbody(Player p) { if ((Object)(object)p == (Object)null) { return null; } Rigidbody component = ((Component)p).GetComponent(); if ((Object)(object)component != (Object)null) { return component; } return ((Component)p).GetComponentInChildren(); } private static void LoadSlideAnimation() { try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = null; string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); string[] array = manifestResourceNames; foreach (string text2 in array) { if (text2.EndsWith("mv_slide_animation", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (text == null) { return; } byte[] array2; using (Stream stream = executingAssembly.GetManifestResourceStream(text)) { if (stream == null) { return; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); array2 = memoryStream.ToArray(); } if (array2 == null || array2.Length == 0) { return; } _slideAnimBundle = AssetBundle.LoadFromMemory(array2); if ((Object)(object)_slideAnimBundle == (Object)null) { return; } _slideController = _slideAnimBundle.LoadAsset("PlayerSlideController"); if ((Object)(object)_slideController == (Object)null) { RuntimeAnimatorController[] array3 = _slideAnimBundle.LoadAllAssets(); if (array3 != null && array3.Length != 0) { _slideController = array3[0]; } } } catch (Exception ex) { if (MovementPlugin.Log != null) { MovementPlugin.Log.LogWarning((object)("[MV] Failed to load slide animation controller: " + ex.Message)); } } } private static void TriggerSlideAnimation(Player p, bool enable) { if ((Object)(object)p == (Object)null) { return; } try { string text = CfgAnimTriggerName?.Value ?? "slide_trigger"; if (string.IsNullOrWhiteSpace(text)) { return; } Animator componentInChildren = ((Component)p).GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { return; } bool flag = (Object)(object)_slideController != (Object)null && text == "slide_trigger"; if (enable) { if (flag) { if ((Object)(object)_originalController == (Object)null) { _originalController = componentInChildren.runtimeAnimatorController; } componentInChildren.runtimeAnimatorController = _slideController; } componentInChildren.SetTrigger(text); } else if (flag && (Object)(object)_originalController != (Object)null) { componentInChildren.runtimeAnimatorController = _originalController; _originalController = null; componentInChildren.SetBool("wakeup", false); componentInChildren.SetBool("onGround", true); componentInChildren.SetFloat("forward_speed", 0f); componentInChildren.SetFloat("sideway_speed", 0f); componentInChildren.Play("Movement", 0, 0f); } } catch { } } private static void TrySlideImpact(Player p) { if ((Object)(object)p == (Object)null || _slideImpactTriggered || !IsEnemyWithinSlideHitbox(p)) { return; } try { MovementPlugin.TriggerDashImpact(p); _slideImpactTriggered = true; } catch { } } private static bool IsEnemyWithinSlideHitbox(Player p) { //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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)p).transform.position + Vector3.up * 0.5f; Collider[] array = Physics.OverlapSphere(val, 1.25f, -5, (QueryTriggerInteraction)1); if (array == null || array.Length == 0) { return false; } Vector3 val2 = ((((Vector3)(ref _slideDirection)).sqrMagnitude > 0.001f) ? ((Vector3)(ref _slideDirection)).normalized : ((Component)p).transform.forward); foreach (Collider val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } Character componentInParent = ((Component)val3).GetComponentInParent(); if (!((Object)(object)componentInParent == (Object)null) && !((Object)(object)componentInParent == (Object)(object)p) && !componentInParent.IsDead() && !(componentInParent is Player)) { Vector3 val4 = ((Component)componentInParent).transform.position - val; val4.y = 0f; if (((Vector3)(ref val4)).sqrMagnitude < 0.0001f) { return true; } ((Vector3)(ref val4)).Normalize(); if (Vector3.Dot(val2, val4) >= 0.1f) { return true; } } } return false; } }