diff options
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r-- | src/game/Spell.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index ebb3a355a95..8d9cf6e5265 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -3125,18 +3125,26 @@ void Spell::SendCastResult(SpellCastResult result) if(((Player*)m_caster)->GetSession()->PlayerLoading()) // don't send cast results at loading time return; + SendCastResult((Player*)m_caster,m_spellInfo,m_cast_count,result); +} + +void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 cast_count, SpellCastResult result) +{ + if(result == SPELL_CAST_OK) + return; + WorldPacket data(SMSG_CAST_FAILED, (4+1+1)); - data << uint8(m_cast_count); // single cast or multi 2.3 (0/1) - data << uint32(m_spellInfo->Id); + data << uint8(cast_count); // single cast or multi 2.3 (0/1) + data << uint32(spellInfo->Id); data << uint8(result); // problem switch (result) { case SPELL_FAILED_REQUIRES_SPELL_FOCUS: - data << uint32(m_spellInfo->RequiresSpellFocus); + data << uint32(spellInfo->RequiresSpellFocus); break; case SPELL_FAILED_REQUIRES_AREA: // hardcode areas limitation case - switch(m_spellInfo->Id) + switch(spellInfo->Id) { case 41617: // Cenarion Mana Salve case 41619: // Cenarion Healing Salve @@ -3155,26 +3163,26 @@ void Spell::SendCastResult(SpellCastResult result) } break; case SPELL_FAILED_TOTEMS: - if(m_spellInfo->Totem[0]) - data << uint32(m_spellInfo->Totem[0]); - if(m_spellInfo->Totem[1]) - data << uint32(m_spellInfo->Totem[1]); + if(spellInfo->Totem[0]) + data << uint32(spellInfo->Totem[0]); + if(spellInfo->Totem[1]) + data << uint32(spellInfo->Totem[1]); break; case SPELL_FAILED_TOTEM_CATEGORY: - if(m_spellInfo->TotemCategory[0]) - data << uint32(m_spellInfo->TotemCategory[0]); - if(m_spellInfo->TotemCategory[1]) - data << uint32(m_spellInfo->TotemCategory[1]); + if(spellInfo->TotemCategory[0]) + data << uint32(spellInfo->TotemCategory[0]); + if(spellInfo->TotemCategory[1]) + data << uint32(spellInfo->TotemCategory[1]); break; case SPELL_FAILED_EQUIPPED_ITEM_CLASS: - data << uint32(m_spellInfo->EquippedItemClass); - data << uint32(m_spellInfo->EquippedItemSubClassMask); - //data << uint32(m_spellInfo->EquippedItemInventoryTypeMask); + data << uint32(spellInfo->EquippedItemClass); + data << uint32(spellInfo->EquippedItemSubClassMask); + //data << uint32(spellInfo->EquippedItemInventoryTypeMask); break; default: break; } - ((Player*)m_caster)->GetSession()->SendPacket(&data); + caster->GetSession()->SendPacket(&data); } void Spell::SendSpellStart() |