aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-08 17:25:02 -0500
committermegamage <none@none>2009-06-08 17:25:02 -0500
commit4e130dcdfdd30b84fb5e0b0531c817c7b6c64ff9 (patch)
tree09f871f8eab58afe981e99fa74cef6bcf0777e7c /src/game/Spell.cpp
parent6578cce47133eb017a7ab6b14c91d6c5b80b226a (diff)
[7980] Implement item use target requirements store and check (new table `item_required_target`). Author: NoFantasy
Signed-off-by: VladimirMangos <vladimir@getmangos.com> * Also implement this table reload * Static Spell::SendCastResult function for call not from spell code. Can be also used in scripts where need send explicitly spell cast error to client. --HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp40
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()