[11971] Add wrapper HasAttribute to check if a spell has an attribute

Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
Schmoozerd 2012-04-21 02:02:23 +02:00
parent 85c694b53e
commit 7fd1f64319
12 changed files with 382 additions and 352 deletions

View file

@ -3262,12 +3262,12 @@ bool Player::IsNeedCastPassiveLikeSpellAtLearn(SpellEntry const* spellInfo) cons
if (IsNeedCastSpellAtFormApply(spellInfo, form)) // SPELL_ATTR_PASSIVE | SPELL_ATTR_UNK7 spells
return true; // all stance req. cases, not have auarastate cases
if (!(spellInfo->Attributes & SPELL_ATTR_PASSIVE))
if (!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE))
return false;
// note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
bool need_cast = (!spellInfo->Stances || !form && (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
bool need_cast = !spellInfo->Stances || !form && spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT);
// Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
@ -5918,7 +5918,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type, Pl
}
// current range for button of totem bar is from ACTION_BUTTON_SHAMAN_TOTEMS_BAR to (but not including) ACTION_BUTTON_SHAMAN_TOTEMS_BAR + 12
else if(button >= ACTION_BUTTON_SHAMAN_TOTEMS_BAR && button < (ACTION_BUTTON_SHAMAN_TOTEMS_BAR + 12)
&& !(spellProto->AttributesEx7 & SPELL_ATTR_EX7_TOTEM_SPELL))
&& !spellProto->HasAttribute(SPELL_ATTR_EX7_TOTEM_SPELL))
{
if (msg)
sLog.outError( "Spell action %u not added into button %u for player %s: attempt to add non totem spell to totem bar", action, button, player->GetName() );
@ -19091,7 +19091,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs )
}
// Not send cooldown for this spells
if (spellInfo->Attributes & SPELL_ATTR_DISABLED_WHILE_ACTIVE)
if (spellInfo->HasAttribute(SPELL_ATTR_DISABLED_WHILE_ACTIVE))
continue;
if((idSchoolMask & GetSpellSchoolMask(spellInfo)) && GetSpellCooldownDelay(unSpellId) < unTimeMs )
@ -20869,8 +20869,7 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const
{
// don't take reagents for spells with SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP
if (spellInfo->AttributesEx5 & SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP &&
HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
if (spellInfo->HasAttribute(SPELL_ATTR_EX5_NO_REAGENT_WHILE_PREP) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION))
return true;
// Check no reagent use mask