/// <summary> /// Cast a <see cref="Spell"/> with the supplied <see cref="SpellParameters"/>. /// </summary> public void CastSpell(SpellParameters parameters) { if (parameters == null) { throw new ArgumentNullException(); } if (DisableManager.Instance.IsDisabled(DisableType.BaseSpell, parameters.SpellInfo.BaseInfo.Entry.Id)) { if (this is Player player) { player.SendSystemMessage($"Unable to cast base spell {parameters.SpellInfo.BaseInfo.Entry.Id} because it is disabled."); } return; } if (DisableManager.Instance.IsDisabled(DisableType.Spell, parameters.SpellInfo.Entry.Id)) { if (this is Player player) { player.SendSystemMessage($"Unable to cast spell {parameters.SpellInfo.Entry.Id} because it is disabled."); } return; } var spell = new Spell.Spell(this, parameters); spell.Cast(); pendingSpells.Add(spell); }
/// <summary> /// Cast a <see cref="Spell"/> with the supplied <see cref="SpellParameters"/>. /// </summary> public void CastSpell(SpellParameters parameters) { if (parameters == null) { throw new ArgumentNullException(); } var spell = new Spell.Spell(this, parameters); spell.Cast(); pendingSpells.Add(spell); }
/// <summary> /// Cancel a <see cref="Spell"/> based on its casting id /// </summary> /// <param name="castingId">Casting ID of the spell to cancel</param> public void CancelSpellCast(uint castingId) { Spell.Spell spell = pendingSpells.SingleOrDefault(s => s.CastingId == castingId); spell?.CancelCast(CastResult.SpellCancelled); }