public SpellCastResult CheckCast(bool strict) { // check death state if (!Caster.IsAlive() && !SpellInfo.IsPassive()) { return(SpellCastResult.CASTER_DEAD); } // check cooldowns to prevent cheating if (!SpellInfo.IsPassive()) { if (!Caster.Character.SpellHistory.IsReady(SpellInfo, IsIgnoringCooldowns())) { if (TriggeredByAuraSpell != null) { return(SpellCastResult.DONT_REPORT); } else { return(SpellCastResult.NOT_READY); } } } // Check global cooldown if (strict && !(TriggerCastFlags.HasFlag(TriggerCastFlags.IGNORE_GCD) && HasGlobalCooldown())) { return(SpellCastResult.NOT_READY); } // Check for line of sight for spells with dest /*if (m_targets.HasDst()) * { * float x, y, z; * m_targets.GetDstPos()->GetPosition(x, y, z); * * if (!m_spellInfo->HasAttribute(SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, NULL, SPELL_DISABLE_LOS) && !m_caster->IsWithinLOS(x, y, z)) * return SPELL_FAILED_LINE_OF_SIGHT; * }*/ SpellCastResult castResult = SpellCastResult.SPELL_CAST_OK; // Triggered spells also have range check /// @todo determine if there is some flag to enable/disable the check castResult = CheckRange(strict); if (castResult != SpellCastResult.SPELL_CAST_OK) { return(castResult); } return(SpellCastResult.SUCCESS); }
public bool IsIgnoringCooldowns() { return(TriggerCastFlags.HasFlag(TriggerCastFlags.IGNORE_SPELL_AND_CATEGORY_CD)); }