Replace values by defines

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-29 20:38:26 +03:00
parent fdfd9c647a
commit 59861857e5
4 changed files with 16 additions and 13 deletions

View file

@ -277,7 +277,7 @@ enum ItemQualities
#define SPELL_ATTR_EX2_UNK0 0x00000001 // 0 #define SPELL_ATTR_EX2_UNK0 0x00000001 // 0
#define SPELL_ATTR_EX2_UNK1 0x00000002 // 1 #define SPELL_ATTR_EX2_UNK1 0x00000002 // 1
#define SPELL_ATTR_EX2_UNK2 0x00000004 // 2 #define SPELL_ATTR_EX2_CANT_REFLECTED 0x00000004 // 2 ? used for detect can or not spell reflected
#define SPELL_ATTR_EX2_UNK3 0x00000008 // 3 #define SPELL_ATTR_EX2_UNK3 0x00000008 // 3
#define SPELL_ATTR_EX2_UNK4 0x00000010 // 4 #define SPELL_ATTR_EX2_UNK4 0x00000010 // 4
#define SPELL_ATTR_EX2_AUTOREPEAT_FLAG 0x00000020 // 5 #define SPELL_ATTR_EX2_AUTOREPEAT_FLAG 0x00000020 // 5

View file

@ -363,7 +363,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
// determine reflection // determine reflection
m_canReflect = false; m_canReflect = false;
if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && (m_spellInfo->AttributesEx2 & 0x4)==0) if(m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC && !(m_spellInfo->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED))
{ {
for(int j=0;j<3;j++) for(int j=0;j<3;j++)
{ {
@ -373,7 +373,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j],m_spellInfo->EffectImplicitTargetB[j])) if(!IsPositiveTarget(m_spellInfo->EffectImplicitTargetA[j],m_spellInfo->EffectImplicitTargetB[j]))
m_canReflect = true; m_canReflect = true;
else else
m_canReflect = (m_spellInfo->AttributesEx & (1<<7)) ? true : false; m_canReflect = (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NEGATIVE) ? true : false;
if(m_canReflect) if(m_canReflect)
continue; continue;
@ -4602,15 +4602,16 @@ uint8 Spell::CheckCasterAuras() const
//Check whether the cast should be prevented by any state you might have. //Check whether the cast should be prevented by any state you might have.
uint8 prevented_reason = 0; uint8 prevented_reason = 0;
// Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out // Have to check if there is a stun aura. Otherwise will have problems with ghost aura apply while logging out
if(!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED) && m_caster->HasAuraType(SPELL_AURA_MOD_STUN)) uint32 unitflag = m_caster->GetUInt32Value(UNIT_FIELD_FLAGS); // Get unit state
if(unitflag & UNIT_FLAG_STUNNED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
prevented_reason = SPELL_FAILED_STUNNED; prevented_reason = SPELL_FAILED_STUNNED;
else if(m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_CONFUSED) && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED)) else if(unitflag & UNIT_FLAG_CONFUSED && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
prevented_reason = SPELL_FAILED_CONFUSED; prevented_reason = SPELL_FAILED_CONFUSED;
else if(m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_FLEEING) && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED)) else if(unitflag & UNIT_FLAG_FLEEING && !(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
prevented_reason = SPELL_FAILED_FLEEING; prevented_reason = SPELL_FAILED_FLEEING;
else if(m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED) && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE) else if(unitflag & UNIT_FLAG_SILENCED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
prevented_reason = SPELL_FAILED_SILENCED; prevented_reason = SPELL_FAILED_SILENCED;
else if(m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) else if(unitflag & UNIT_FLAG_PACIFIED && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
prevented_reason = SPELL_FAILED_PACIFIED; prevented_reason = SPELL_FAILED_PACIFIED;
// Attr must make flag drop spell totally immune from all effects // Attr must make flag drop spell totally immune from all effects

View file

@ -424,8 +424,10 @@ m_updated(false), m_isRemovedOnShapeLost(true), m_in_use(false)
if(modOwner) if(modOwner)
modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges); modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, m_procCharges);
m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() && m_spellProto->Stances && m_isRemovedOnShapeLost = (m_caster_guid==m_target->GetGUID() &&
!(m_spellProto->AttributesEx2 & 0x80000) && !(m_spellProto->Attributes & 0x10000)); m_spellProto->Stances &&
!(m_spellProto->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) &&
!(m_spellProto->Attributes & SPELL_ATTR_NOT_SHAPESHIFT));
} }
Aura::~Aura() Aura::~Aura()
@ -3351,7 +3353,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
} }
// Wyvern Sting // Wyvern Sting
if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellIconID == 1721) if (m_spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags & 0x0000100000000000LL)
{ {
Unit* caster = GetCaster(); Unit* caster = GetCaster();
if( !caster || caster->GetTypeId()!=TYPEID_PLAYER ) if( !caster || caster->GetTypeId()!=TYPEID_PLAYER )
@ -5202,7 +5204,7 @@ void Aura::HandleShapeshiftBoosts(bool apply)
if(itr->second->state == PLAYERSPELL_REMOVED) continue; if(itr->second->state == PLAYERSPELL_REMOVED) continue;
if(itr->first==spellId || itr->first==spellId2) continue; if(itr->first==spellId || itr->first==spellId2) continue;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !(spellInfo->Attributes & ((1<<6) | (1<<7)))) continue; if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR_PASSIVE | (1<<7)))) continue;
if (spellInfo->Stances & (1<<form)) if (spellInfo->Stances & (1<<form))
m_target->CastSpell(m_target, itr->first, true, NULL, this); m_target->CastSpell(m_target, itr->first, true, NULL, this);
} }

View file

@ -465,7 +465,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
return false; return false;
// AttributesEx check // AttributesEx check
if(spellproto->AttributesEx & (1<<7)) if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE)
return false; return false;
// ok, positive // ok, positive