aboutsummaryrefslogtreecommitdiff
path: root/src/game/Spell.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-12-31 10:03:07 -0600
committermegamage <none@none>2008-12-31 10:03:07 -0600
commitba58ddac9c302953fc15987bc84d5f858a011e56 (patch)
tree5bafa1aa17b64d7e325a347f4538eb8402b222a3 /src/game/Spell.cpp
parentaa3b89d7764c093ba87ee2cf99775e3aedc37637 (diff)
parent3885ce94d9be86616bb01e660a70087fcbfc6ffd (diff)
*Update to HG 730.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Spell.cpp')
-rw-r--r--src/game/Spell.cpp20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index f188ab46465..e31d9f06b07 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1964,6 +1964,11 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
{
+ if(m_CastItem)
+ m_castItemGUID = m_CastItem->GetGUID();
+ else
+ m_castItemGUID = 0;
+
m_targets = *targets;
m_spellState = SPELL_STATE_PREPARING;
@@ -3774,14 +3779,15 @@ uint8 Spell::CanCast(bool strict)
if(uint8 castResult = CheckRange(strict))
return castResult;
+ if(!m_IsTriggeredSpell)
{
if(uint8 castResult = CheckPower())
return castResult;
- }
- if(!m_triggeredByAuraSpell) // triggered spell not affected by stun/etc
+ //if(!m_triggeredByAuraSpell) // triggered spell not affected by stun/etc
if(uint8 castResult = CheckCasterAuras())
return castResult;
+ }
for (int i = 0; i < 3; i++)
{
@@ -4663,7 +4669,12 @@ uint8 Spell::CheckItems()
uint32 itemid, itemcount;
Player* p_caster = (Player*)m_caster;
- if(m_CastItem)
+ if(!m_CastItem)
+ {
+ if(m_castItemGUID)
+ return SPELL_FAILED_ITEM_NOT_READY;
+ }
+ else
{
itemid = m_CastItem->GetEntry();
if( !p_caster->HasItemCount(itemid,1) )
@@ -5141,6 +5152,9 @@ void Spell::UpdatePointers()
if(m_originalCaster && !m_originalCaster->IsInWorld()) m_originalCaster = NULL;
}
+ if(m_castItemGUID && m_caster->GetTypeId() == TYPEID_PLAYER)
+ m_CastItem = ((Player*)m_caster)->GetItemByGuid(m_castItemGUID);
+
m_targets.Update(m_caster);
}