*Check item existance requirements for mainhand/offhand weapon spells.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-04-30 22:41:36 +02:00
parent b225a3adf1
commit 6e933320b2
3 changed files with 36 additions and 36 deletions
+34 -2
View File
@@ -3625,8 +3625,8 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_DONT_REPORT;
// only check at first call, Stealth auras are already removed at second call
// for now, ignore triggered spells
if( strict && !m_IsTriggeredSpell)
// for now, ignore triggered by aura spells
if( strict && !m_triggeredByAuraSpell)
{
bool checkForm = true;
// Ignore form req aura
@@ -5182,6 +5182,38 @@ SpellCastResult Spell::CheckItems()
}
}
// check weapon presence in slots for main/offhand weapons
if(m_spellInfo->EquippedItemClass >=0)
{
// main hand weapon required
if(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(BASE_ATTACK);
// skip spell if no weapon in slot or broken
if(!item || item->IsBroken() )
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
// skip spell if weapon not fit to triggered spell
if(!item->IsFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
// offhand hand weapon required
if(m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK);
// skip spell if no weapon in slot or broken
if(!item || item->IsBroken() )
return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
// skip spell if weapon not fit to triggered spell
if(!item->IsFitToSpellRequirements(m_spellInfo))
return m_IsTriggeredSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}
}
return SPELL_CAST_OK;
}
-32
View File
@@ -2101,38 +2101,6 @@ void Spell::EffectTriggerSpell(uint32 i)
return;
}
// some triggered spells require specific equipment
if(spellInfo->EquippedItemClass >=0 && m_caster->GetTypeId()==TYPEID_PLAYER)
{
// main hand weapon required
if(spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(BASE_ATTACK);
// skip spell if no weapon in slot or broken
if(!item || item->IsBroken() )
return;
// skip spell if weapon not fit to triggered spell
if(!item->IsFitToSpellRequirements(spellInfo))
return;
}
// offhand hand weapon required
if(spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK);
// skip spell if no weapon in slot or broken
if(!item || item->IsBroken() )
return;
// skip spell if weapon not fit to triggered spell
if(!item->IsFitToSpellRequirements(spellInfo))
return;
}
}
// some triggered spells must be casted instantly (for example, if next effect case instant kill caster)
bool instant = false;
for(uint32 j = i+1; j < 3; ++j)
+2 -2
View File
@@ -5986,7 +5986,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
triggered_spell_id = 32221;
}
else
return true;
return false;
break;
}
// Seal of the Martyr do damage trigger
@@ -6003,7 +6003,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
triggered_spell_id = 53718;
}
else
return true;
return false;
break;
}
// Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)