public static async Task <bool> TrackSpellCast() { // Manage SpellCastHistory entries if (SpellCastHistory.Count > 20) { SpellCastHistory.Remove(SpellCastHistory.Last()); if (BaseSettings.Instance.DebugSpellCastHistory) { Application.Current.Dispatcher.Invoke(delegate { Debug.Instance.SpellCastHistory = new List <SpellCastHistoryItem>(SpellCastHistory); }); } } // If we're not casting we can return false to keep going down the tree if (!Core.Me.IsCasting) { return(false); } // The possibility here is that we're teleporting (casting) // So if the timer isn't running, it means Magitek didn't cast it, and the cast shouldn't be monitored if (!CastingTime.IsRunning) { return(false); } await GambitLogic.ToastGambits(); #region Debug and Target Checks if (BaseSettings.Instance.DebugPlayerCasting) { Debug.Instance.CastingTime = CastingTime.ElapsedMilliseconds.ToString(); } #endregion #region Interrupt Casting Checks if (CastingGambit) { return(true); } if (!SpellTarget.IsTargetable) { await CancelCast("Target is no Longer Targetable"); } if (!SpellTarget.IsValid) { await CancelCast("Target is no Longer Valid"); } if (await GambitLogic.InterruptCast()) { await CancelCast(); return(true); } // ReSharper disable once SwitchStatementMissingSomeCases switch (RotationManager.CurrentRotation) { case ClassJobType.BlueMage: { if (BlueMage.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.Scholar: { if (Scholar.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.Arcanist: { if (Scholar.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.WhiteMage: { if (WhiteMage.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.Conjurer: { if (WhiteMage.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.Astrologian: { if (Astrologian.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.Summoner: { if (Summoner.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.BlackMage: { if (BlackMage.NeedToInterruptCast()) { await CancelCast(); } break; } case ClassJobType.Sage: { if (Sage.NeedToInterruptCast()) { await CancelCast(); } break; } } #endregion return(true); }