Core/Conditions: use proper SpellCastResult instead of Notification when CONDITION_SOURCE_TYPE_SPELL fails
This commit is contained in:
1 parent
fc974d6fbe
commit
e83c5d1a0f
6 files changed
+70
-30
No files matched your search
@@ -4866,17 +4866,12 @@ SpellCastResult Spell::CheckCast(bool strict)
|
||||
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_SPELL, m_spellInfo->Id);
|
||||
if (!conditions.empty() && !sConditionMgr->IsObjectMeetToConditions(condInfo, conditions))
|
||||
{
|
||||
// send error msg to player if condition failed and text message available
|
||||
// TODO: using WorldSession::SendNotification is not blizzlike
|
||||
if (Player* playerCaster = m_caster->ToPlayer())
|
||||
// mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
|
||||
if (condInfo.mLastFailedCondition && condInfo.mLastFailedCondition->ErrorType)
|
||||
{
|
||||
// mLastFailedCondition can be NULL if there was an error processing the condition in Condition::Meets (i.e. wrong data for ConditionTarget or others)
|
||||
if (playerCaster->GetSession() && condInfo.mLastFailedCondition
|
||||
&& condInfo.mLastFailedCondition->ErrorTextId)
|
||||
{
|
||||
playerCaster->GetSession()->SendNotification(condInfo.mLastFailedCondition->ErrorTextId);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
if (condInfo.mLastFailedCondition->ErrorType == SPELL_FAILED_CUSTOM_ERROR)
|
||||
m_customError = SpellCustomErrors(condInfo.mLastFailedCondition->ErrorTextId);
|
||||
return SpellCastResult(condInfo.mLastFailedCondition->ErrorType);
|
||||
}
|
||||
if (!condInfo.mLastFailedCondition || !condInfo.mLastFailedCondition->ConditionTarget)
|
||||
return SPELL_FAILED_CASTER_AURASTATE;
|
||||
|
||||
Reference in new issue
Block a user