[11977] More uses of wrappers introduced in 11971

Also fix a typo that caused problems with Stances

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2012-04-23 22:48:27 +02:00
parent 8433b67599
commit e29e640341
7 changed files with 35 additions and 37 deletions

View file

@ -1887,7 +1887,7 @@ valid examples:
if (linkedSpell)
{
// spells with that flag have a prefix of "$PROFESSION: "
if (linkedSpell->Attributes & SPELL_ATTR_TRADESPELL)
if (linkedSpell->HasAttribute(SPELL_ATTR_TRADESPELL))
{
// lookup skillid
SkillLineAbilityMapBounds bounds = sSpellMgr.GetSkillLineAbilityMapBounds(linkedSpell->Id);

View file

@ -446,11 +446,11 @@ class Spell
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
bool IsNextMeleeSwingSpell() const
{
return m_spellInfo->Attributes & (SPELL_ATTR_ON_NEXT_SWING_1|SPELL_ATTR_ON_NEXT_SWING_2);
return m_spellInfo->HasAttribute(SPELL_ATTR_ON_NEXT_SWING_1) || m_spellInfo->HasAttribute(SPELL_ATTR_ON_NEXT_SWING_2);
}
bool IsRangedSpell() const
{
return m_spellInfo->Attributes & SPELL_ATTR_RANGED;
return m_spellInfo->HasAttribute(SPELL_ATTR_RANGED);
}
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
bool IsMeleeAttackResetSpell() const { return !m_IsTriggeredSpell && (m_spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK); }
@ -759,7 +759,7 @@ namespace MaNGOS
{
// there are still more spells which can be casted on dead, but
// they are no AOE and don't have such a nice SPELL_ATTR flag
if ( (i_TargetType != SPELL_TARGETS_ALL && !itr->getSource()->isTargetableForAttack(i_spell.m_spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD))
if ((i_TargetType != SPELL_TARGETS_ALL && !itr->getSource()->isTargetableForAttack(i_spell.m_spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD)))
// mostly phase check
|| !itr->getSource()->IsInMap(i_originalCaster))
continue;

View file

@ -432,7 +432,7 @@ m_isPersistent(false), m_in_use(0), m_spellAuraHolder(holder)
modOwner->ApplySpellMod(spellproto->Id, SPELLMOD_ACTIVATION_TIME, m_modifier.periodictime);
// Start periodic on next tick or at aura apply
if (!(spellproto->AttributesEx5 & SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY))
if (!spellproto->HasAttribute(SPELL_ATTR_EX5_START_PERIODIC_AT_APPLY))
m_periodicTimer = m_modifier.periodictime;
}
@ -4982,7 +4982,7 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
Unit *target = GetTarget();
if (apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
if (apply && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY))
{
uint32 mechanic = 1 << (misc-1);
@ -5025,7 +5025,7 @@ void Aura::HandleModMechanicImmunityMask(bool apply, bool /*Real*/)
{
uint32 mechanic = m_modifier.m_miscvalue;
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
if (apply && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY))
GetTarget()->RemoveAurasAtMechanicImmunity(mechanic,GetId());
// check implemented in Unit::IsImmuneToSpell and Unit::IsImmuneToSpellEffect
@ -5049,7 +5049,7 @@ void Aura::HandleAuraModEffectImmunity(bool apply, bool /*Real*/)
void Aura::HandleAuraModStateImmunity(bool apply, bool Real)
{
if(apply && Real && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
if (apply && Real && GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY))
{
Unit::AuraList const& auraList = GetTarget()->GetAurasByType(AuraType(m_modifier.m_miscvalue));
for(Unit::AuraList::const_iterator itr = auraList.begin(); itr != auraList.end();)
@ -5073,14 +5073,13 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
target->ApplySpellImmune(GetId(), IMMUNITY_SCHOOL, m_modifier.m_miscvalue, apply);
// remove all flag auras (they are positive, but they must be removed when you are immune)
if( GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
&& GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD )
if (GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY) && GetSpellProto()->HasAttribute(SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD))
target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
// TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
if( Real && apply
&& GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
&& IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
if (Real && apply
&& GetSpellProto()->HasAttribute(SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
&& IsPositiveSpell(GetId())) // Only positive immunity removes auras
{
uint32 school_mask = m_modifier.m_miscvalue;
Unit::SpellAuraHolderMap& Auras = target->GetSpellAuraHolderMap();
@ -5089,10 +5088,10 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
next = iter;
++next;
SpellEntry const *spell = iter->second->GetSpellProto();
if((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
&& !( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability
&& !iter->second->IsPositive() //Don't remove positive spells
&& spell->Id != GetId() ) //Don't remove self
if ((GetSpellSchoolMask(spell) & school_mask) // Check for school mask
&& !spell->HasAttribute(SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability
&& !iter->second->IsPositive() // Don't remove positive spells
&& spell->Id != GetId() ) // Don't remove self
{
target->RemoveAurasDueToSpell(spell->Id);
if(Auras.empty())
@ -5786,7 +5785,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool /*Real*/)
}
//recalculate current HP/MP after applying aura modifications (only for spells with 0x10 flag)
if ((m_modifier.m_miscvalue == STAT_STAMINA) && (maxHPValue > 0) && (GetSpellProto()->Attributes & 0x10))
if (m_modifier.m_miscvalue == STAT_STAMINA && maxHPValue > 0 && GetSpellProto()->HasAttribute(SPELL_ATTR_UNK4))
{
// newHP = (curHP / maxHP) * newMaxHP = (newMaxHP * curHP) / maxHP -> which is better because no int -> double -> int conversion is needed
uint32 newHPValue = (target->GetMaxHealth() * curHPValue) / maxHPValue;
@ -6584,7 +6583,7 @@ void Aura::HandleShapeshiftBoosts(bool apply)
for (Unit::SpellAuraHolderMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
{
SpellEntry const *spellInfo = itr->second->GetSpellProto();
if (itr->second->IsPassive() && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)
if (itr->second->IsPassive() && spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT)
&& (spellInfo->StancesNot & (1<<(form-1))))
{
target->RemoveAurasDueToSpell(itr->second->GetId());
@ -6705,7 +6704,7 @@ void Aura::HandleShapeshiftBoosts(bool apply)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first);
if (!spellInfo || !IsPassiveSpell(spellInfo))
continue;
if ((spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->StancesNot & (1<<(form-1)))
if (spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && (spellInfo->StancesNot & (1<<(form-1))))
target->CastSpell(target, itr->first, true, NULL, this);
}
}
@ -7186,7 +7185,7 @@ void Aura::PeriodicTick()
if (pCaster->GetTypeId() == TYPEID_PLAYER)
pdamage -= target->GetSpellDamageReduction(pdamage);
target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !GetSpellProto()->HasAttribute(SPELL_ATTR_EX2_CANT_REFLECTED));
DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s attacked %s for %u dmg inflicted by %u abs is %u",
GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(),absorb);
@ -7278,7 +7277,7 @@ void Aura::PeriodicTick()
if (GetCasterGuid().IsPlayer())
pdamage -= target->GetSpellDamageReduction(pdamage);
target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !(spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_REFLECTED));
target->CalculateDamageAbsorbAndResist(pCaster, GetSpellSchoolMask(spellProto), DOT, pdamage, &absorb, &resist, !spellProto->HasAttribute(SPELL_ATTR_EX2_CANT_REFLECTED));
DETAIL_FILTER_LOG(LOG_FILTER_PERIODIC_AFFECTS, "PeriodicTick: %s health leech of %s for %u dmg inflicted by %u abs is %u",
GetCasterGuid().GetString().c_str(), target->GetGuidStr().c_str(), pdamage, GetId(),absorb);
@ -8579,8 +8578,8 @@ m_permanent(false), m_isRemovedOnShapeLost(true), m_deleted(false), m_in_use(0)
m_isRemovedOnShapeLost = (GetCasterGuid() == m_target->GetObjectGuid() &&
m_spellProto->Stances &&
!(m_spellProto->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) &&
!(m_spellProto->Attributes & SPELL_ATTR_NOT_SHAPESHIFT));
!m_spellProto->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) &&
!m_spellProto->HasAttribute(SPELL_ATTR_NOT_SHAPESHIFT));
Unit* unitCaster = caster && caster->isType(TYPEMASK_UNIT) ? (Unit*)caster : NULL;
@ -8669,7 +8668,7 @@ void SpellAuraHolder::_AddSpellAuraHolder()
// set infinity cooldown state for spells
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if (m_spellProto->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
if (m_spellProto->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE))
{
Item* castItem = m_castItemGuid ? ((Player*)caster)->GetItemByGuid(m_castItemGuid) : NULL;
((Player*)caster)->AddSpellAndCategoryCooldowns(m_spellProto,castItem ? castItem->GetEntry() : 0, NULL,true);
@ -8877,7 +8876,7 @@ void SpellAuraHolder::_RemoveSpellAuraHolder()
// reset cooldown state for spells
if(caster && caster->GetTypeId() == TYPEID_PLAYER)
{
if ( GetSpellProto()->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE )
if (GetSpellProto()->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE))
// note: item based cooldowns and cooldown spell mods with charges ignored (unknown existing cases)
((Player*)caster)->SendCooldownEvent(GetSpellProto());
}

View file

@ -3532,7 +3532,7 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex)
if (spellInfo->EquippedItemClass >=0 && m_caster->GetTypeId()==TYPEID_PLAYER)
{
// main hand weapon required
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_MAIN_HAND)
if (spellInfo->HasAttribute(SPELL_ATTR_EX3_MAIN_HAND))
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(BASE_ATTACK, true, false);
@ -3546,7 +3546,7 @@ void Spell::EffectTriggerSpell(SpellEffectIndex effIndex)
}
// offhand hand weapon required
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
if (spellInfo->HasAttribute(SPELL_ATTR_EX3_REQ_OFFHAND))
{
Item* item = ((Player*)m_caster)->GetWeaponForAttack(OFF_ATTACK, true, false);
@ -4898,7 +4898,7 @@ void Spell::EffectDispel(SpellEffectIndex eff_idx)
if (!holder->IsPositive())
positive = false;
else
positive = (holder->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_NEGATIVE)==0;
positive = !holder->GetSpellProto()->HasAttribute(SPELL_ATTR_EX_NEGATIVE);
// do not remove positive auras if friendly target
// negative auras if non-friendly target
@ -9234,7 +9234,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffectIndex eff_idx)
if (holder && (1<<holder->GetSpellProto()->Dispel) & dispelMask)
{
// Need check for passive? this
if (holder->IsPositive() && !holder->IsPassive() && !(holder->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_NOT_STEALABLE))
if (holder->IsPositive() && !holder->IsPassive() && !holder->GetSpellProto()->HasAttribute(SPELL_ATTR_EX4_NOT_STEALABLE))
steal_list.push_back(holder);
}
}

View file

@ -449,7 +449,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
if (!spellInfo)
return;
if (spellInfo->Attributes & SPELL_ATTR_CANT_CANCEL)
if (spellInfo->HasAttribute(SPELL_ATTR_CANT_CANCEL))
return;
if (IsPassiveSpell(spellInfo))

View file

@ -246,13 +246,12 @@ inline bool IsSpellRemoveAllMovementAndControlLossEffects(SpellEntry const* spel
inline bool IsDeathOnlySpell(SpellEntry const *spellInfo)
{
return spellInfo->AttributesEx3 & SPELL_ATTR_EX3_CAST_ON_DEAD
|| spellInfo->Id == 2584;
return spellInfo->HasAttribute(SPELL_ATTR_EX3_CAST_ON_DEAD) || spellInfo->Id == 2584;
}
inline bool IsDeathPersistentSpell(SpellEntry const *spellInfo)
{
return spellInfo->AttributesEx3 & SPELL_ATTR_EX3_DEATH_PERSISTENT;
return spellInfo->HasAttribute(SPELL_ATTR_EX3_DEATH_PERSISTENT);
}
inline bool IsNonCombatSpell(SpellEntry const *spellInfo)
@ -467,11 +466,11 @@ inline bool IsChanneledSpell(SpellEntry const* spellInfo)
inline bool IsNeedCastSpellAtFormApply(SpellEntry const* spellInfo, ShapeshiftForm form)
{
if ((!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && spellInfo->HasAttribute(SPELL_ATTR_UNK7)) || !form)
if ((!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR_UNK7)) || !form)
return false;
// passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast!
return (spellInfo->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
return (spellInfo->Stances & (1<<(form-1)) && !spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
}

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11976"
#define REVISION_NR "11977"
#endif // __REVISION_NR_H__