[7011] Add check Aura Spell req in Spell::CanCast

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-03 03:00:54 +03:00
parent 88208bc9a7
commit 1f4b00a848
6 changed files with 30 additions and 6 deletions

View file

@ -3516,6 +3516,12 @@ uint8 Spell::CanCast(bool strict)
if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot))) if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot)))
return SPELL_FAILED_CASTER_AURASTATE; return SPELL_FAILED_CASTER_AURASTATE;
// Caster aura req check if need
if(m_spellInfo->casterAuraSpell && !m_caster->isAuraPresent(m_spellInfo->casterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->excludeCasterAuraSpell && m_caster->isAuraPresent(m_spellInfo->excludeCasterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
// cancel autorepeat spells if cast start when moving // cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code) // (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
if( m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->isMoving() ) if( m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )
@ -3534,6 +3540,12 @@ uint8 Spell::CanCast(bool strict)
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot))) if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
return SPELL_FAILED_TARGET_AURASTATE; return SPELL_FAILED_TARGET_AURASTATE;
// Target aura req check if need
if(m_spellInfo->targetAuraSpell && !target->isAuraPresent(m_spellInfo->targetAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->excludeTargetAuraSpell && target->isAuraPresent(m_spellInfo->excludeTargetAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(target != m_caster) if(target != m_caster)
{ {
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds // target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds

View file

@ -3803,6 +3803,17 @@ Aura* Unit::GetAura(uint32 spellId, uint32 effindex)
return NULL; return NULL;
} }
bool Unit::isAuraPresent(uint32 spellId)
{
for (int i=0; i<3; ++i)
{
AuraMap::iterator iter = m_Auras.find(spellEffectPair(spellId, i));
if (iter != m_Auras.end())
return true;
}
return false;
}
void Unit::AddDynObject(DynamicObject* dynObj) void Unit::AddDynObject(DynamicObject* dynObj)
{ {
m_dynObjGUIDs.push_back(dynObj->GetGUID()); m_dynObjGUIDs.push_back(dynObj->GetGUID());

View file

@ -1247,6 +1247,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint8 GetVisibleAurasCount() { return m_visibleAuras.size(); } uint8 GetVisibleAurasCount() { return m_visibleAuras.size(); }
Aura* GetAura(uint32 spellId, uint32 effindex); Aura* GetAura(uint32 spellId, uint32 effindex);
bool isAuraPresent(uint32 spellId);
AuraMap & GetAuras() { return m_Auras; } AuraMap & GetAuras() { return m_Auras; }
AuraMap const& GetAuras() const { return m_Auras; } AuraMap const& GetAuras() const { return m_Auras; }
AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; } AuraList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }

View file

@ -1082,10 +1082,10 @@ struct SpellEntry
uint32 TargetAuraState; // 18 m_targetAuraState uint32 TargetAuraState; // 18 m_targetAuraState
uint32 CasterAuraStateNot; // 19 m_excludeCasterAuraState uint32 CasterAuraStateNot; // 19 m_excludeCasterAuraState
uint32 TargetAuraStateNot; // 20 m_excludeTargetAuraState uint32 TargetAuraStateNot; // 20 m_excludeTargetAuraState
//uint32 casterAuraSpell; // 21 m_casterAuraSpell not used uint32 casterAuraSpell; // 21 m_casterAuraSpell
//uint32 targetAuraSpell; // 22 m_targetAuraSpell not used uint32 targetAuraSpell; // 22 m_targetAuraSpell
//uint32 excludeCasterAuraSpell; // 23 m_excludeCasterAuraSpell not used uint32 excludeCasterAuraSpell; // 23 m_excludeCasterAuraSpell
//uint32 excludeTargetAuraSpell; // 24 m_excludeTargetAuraSpell not used uint32 excludeTargetAuraSpell; // 24 m_excludeTargetAuraSpell
uint32 CastingTimeIndex; // 25 m_castingTimeIndex uint32 CastingTimeIndex; // 25 m_castingTimeIndex
uint32 RecoveryTime; // 26 m_recoveryTime uint32 RecoveryTime; // 26 m_recoveryTime
uint32 CategoryRecoveryTime; // 27 m_categoryRecoveryTime uint32 CategoryRecoveryTime; // 27 m_categoryRecoveryTime

View file

@ -70,7 +70,7 @@ const char SkillLineAbilityfmt[]="niiiixxiiiiixx";
const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; const char SoundEntriesfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char SpellCastTimefmt[]="nixx"; const char SpellCastTimefmt[]="nixx";
const char SpellDurationfmt[]="niii"; const char SpellDurationfmt[]="niii";
const char SpellEntryfmt[]="niiiiiiiiixiiiiiiiiiixxxxiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiix"; const char SpellEntryfmt[]="niiiiiiiiixiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiifxiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffffffiiiiiiiiiiiiiiiiiiiiifffiiiiiiiiiiiiiiifffiiiiiiiiiiiiixssssssssssssssssxssssssssssssssssxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiiiiiiiiiiixfffxxxiiiiix";
const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx"; const char SpellFocusObjectfmt[]="nxxxxxxxxxxxxxxxxx";
const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx"; const char SpellItemEnchantmentfmt[]="nxiiiiiixxxiiissssssssssssssssxiiiixx";
const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX"; const char SpellItemEnchantmentConditionfmt[]="nbbbbbxxxxxbbbbbbbbbbiiiiiXXXXX";

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7010" #define REVISION_NR "7011"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__