mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01:37:00 +00:00
[11971] Add wrapper HasAttribute to check if a spell has an attribute
Signed-off-by: Schmoozerd <schmoozerd@scriptdev2.com>
This commit is contained in:
parent
85c694b53e
commit
7fd1f64319
12 changed files with 382 additions and 352 deletions
|
|
@ -114,7 +114,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
|||
if (Player* modOwner = spell->GetCaster()->GetSpellModOwner())
|
||||
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
|
||||
|
||||
if (!(spellInfo->Attributes & (SPELL_ATTR_UNK4|SPELL_ATTR_TRADESPELL)))
|
||||
if (!spellInfo->HasAttribute(SPELL_ATTR_UNK4) && !spellInfo->HasAttribute(SPELL_ATTR_TRADESPELL))
|
||||
castTime = int32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
|
||||
else
|
||||
{
|
||||
|
|
@ -123,7 +123,7 @@ uint32 GetSpellCastTime(SpellEntry const* spellInfo, Spell const* spell)
|
|||
}
|
||||
}
|
||||
|
||||
if (spellInfo->Attributes & SPELL_ATTR_RANGED && (!spell || !spell->IsAutoRepeat()))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_RANGED) && (!spell || !spell->IsAutoRepeat()))
|
||||
castTime += 500;
|
||||
|
||||
return (castTime > 0) ? uint32(castTime) : 0;
|
||||
|
|
@ -296,7 +296,7 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo)
|
|||
switch (spellInfo->DmgClass)
|
||||
{
|
||||
case SPELL_DAMAGE_CLASS_MELEE:
|
||||
if (spellInfo->AttributesEx3 & SPELL_ATTR_EX3_REQ_OFFHAND)
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX3_REQ_OFFHAND))
|
||||
return OFF_ATTACK;
|
||||
else
|
||||
return BASE_ATTACK;
|
||||
|
|
@ -306,7 +306,7 @@ WeaponAttackType GetWeaponAttackType(SpellEntry const *spellInfo)
|
|||
break;
|
||||
default:
|
||||
// Wands
|
||||
if (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_AUTOREPEAT_FLAG)
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX2_AUTOREPEAT_FLAG))
|
||||
return RANGED_ATTACK;
|
||||
else
|
||||
return BASE_ATTACK;
|
||||
|
|
@ -324,7 +324,7 @@ bool IsPassiveSpell(uint32 spellId)
|
|||
|
||||
bool IsPassiveSpell(SpellEntry const *spellInfo)
|
||||
{
|
||||
return (spellInfo->Attributes & SPELL_ATTR_PASSIVE) != 0;
|
||||
return spellInfo->HasAttribute(SPELL_ATTR_PASSIVE);
|
||||
}
|
||||
|
||||
bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 spellId_2)
|
||||
|
|
@ -416,7 +416,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
|
|||
{
|
||||
// Well Fed buffs (must be exclusive with Food / Drink replenishment effects, or else Well Fed will cause them to be removed)
|
||||
// SpellIcon 2560 is Spell 46687, does not have this flag
|
||||
if ((spellInfo->AttributesEx2 & SPELL_ATTR_EX2_FOOD_BUFF) || spellInfo->SpellIconID == 2560)
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX2_FOOD_BUFF) || spellInfo->SpellIconID == 2560)
|
||||
return SPELL_WELL_FED;
|
||||
}
|
||||
break;
|
||||
|
|
@ -457,7 +457,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
|
|||
case SPELLFAMILY_PRIEST:
|
||||
{
|
||||
// "Well Fed" buff from Blessed Sunfruit, Blessed Sunfruit Juice, Alterac Spring Water
|
||||
if ((spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_SITTING) &&
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_CASTABLE_WHILE_SITTING) &&
|
||||
(spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK) &&
|
||||
(spellInfo->SpellIconID == 52 || spellInfo->SpellIconID == 79))
|
||||
return SPELL_WELL_FED;
|
||||
|
|
@ -487,7 +487,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
|
|||
return SPELL_HAND;
|
||||
|
||||
// skip Heart of the Crusader that have also same spell family mask
|
||||
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x00000820180400)) && (spellInfo->AttributesEx3 & 0x200) && (spellInfo->SpellIconID != 237))
|
||||
if (spellInfo->IsFitToFamilyMask(UI64LIT(0x00000820180400)) && spellInfo->HasAttribute(SPELL_ATTR_EX3_UNK9) && (spellInfo->SpellIconID != 237))
|
||||
return SPELL_JUDGEMENT;
|
||||
|
||||
// only paladin auras have this (for palaldin class family)
|
||||
|
|
@ -517,7 +517,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
|
|||
if ((IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_CREATURES) ||
|
||||
IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_RESOURCES) ||
|
||||
IsSpellHaveAura(spellInfo, SPELL_AURA_TRACK_STEALTHED)) &&
|
||||
((spellInfo->AttributesEx & SPELL_ATTR_EX_UNK17) || (spellInfo->AttributesEx6 & SPELL_ATTR_EX6_UNK12)))
|
||||
(spellInfo->HasAttribute(SPELL_ATTR_EX_UNK17) || spellInfo->HasAttribute(SPELL_ATTR_EX6_UNK12)))
|
||||
return SPELL_TRACKER;
|
||||
|
||||
// elixirs can have different families, but potion most ofc.
|
||||
|
|
@ -803,7 +803,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex)
|
|||
spellproto->SpellFamilyName == SPELLFAMILY_GENERIC)
|
||||
return false;
|
||||
// but not this if this first effect (don't found better check)
|
||||
if (spellproto->Attributes & 0x4000000 && effIndex == EFFECT_INDEX_0)
|
||||
if (spellproto->HasAttribute(SPELL_ATTR_UNK26) && effIndex == EFFECT_INDEX_0)
|
||||
return false;
|
||||
break;
|
||||
case SPELL_AURA_TRANSFORM:
|
||||
|
|
@ -882,7 +882,7 @@ bool IsPositiveEffect(SpellEntry const *spellproto, SpellEffectIndex effIndex)
|
|||
return false;
|
||||
|
||||
// AttributesEx check
|
||||
if(spellproto->AttributesEx & SPELL_ATTR_EX_NEGATIVE)
|
||||
if (spellproto->HasAttribute(SPELL_ATTR_EX_NEGATIVE))
|
||||
return false;
|
||||
|
||||
// ok, positive
|
||||
|
|
@ -911,7 +911,7 @@ bool IsPositiveSpell(SpellEntry const *spellproto)
|
|||
bool IsSingleTargetSpell(SpellEntry const *spellInfo)
|
||||
{
|
||||
// all other single target spells have if it has AttributesEx5
|
||||
if ( spellInfo->AttributesEx5 & SPELL_ATTR_EX5_SINGLE_TARGET_SPELL )
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX5_SINGLE_TARGET_SPELL))
|
||||
return true;
|
||||
|
||||
// TODO - need found Judgements rule
|
||||
|
|
@ -987,7 +987,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
|
|||
|
||||
if(actAsShifted)
|
||||
{
|
||||
if (spellInfo->Attributes & SPELL_ATTR_NOT_SHAPESHIFT) // not while shapeshifted
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_NOT_SHAPESHIFT)) // not while shapeshifted
|
||||
return SPELL_FAILED_NOT_SHAPESHIFT;
|
||||
else if (spellInfo->Stances != 0) // needs other shapeshift
|
||||
return SPELL_FAILED_ONLY_SHAPESHIFT;
|
||||
|
|
@ -995,7 +995,7 @@ SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32
|
|||
else
|
||||
{
|
||||
// needs shapeshift
|
||||
if(!(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0)
|
||||
if(!spellInfo->HasAttribute(SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0)
|
||||
return SPELL_FAILED_ONLY_SHAPESHIFT;
|
||||
}
|
||||
|
||||
|
|
@ -1881,7 +1881,7 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) cons
|
|||
return false;
|
||||
|
||||
// Allow stack passive and not passive spells
|
||||
if ((spellInfo_1->Attributes & SPELL_ATTR_PASSIVE)!=(spellInfo_2->Attributes & SPELL_ATTR_PASSIVE))
|
||||
if (spellInfo_1->HasAttribute(SPELL_ATTR_PASSIVE) != spellInfo_2->HasAttribute(SPELL_ATTR_PASSIVE))
|
||||
return false;
|
||||
|
||||
// Specific spell family spells
|
||||
|
|
@ -3894,7 +3894,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
|||
}
|
||||
|
||||
// continent limitation (virtual continent), ignore for GM
|
||||
if ((spellInfo->AttributesEx4 & SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND) && !(player && player->isGameMaster()))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX4_CAST_ONLY_IN_OUTLAND) && !(player && player->isGameMaster()))
|
||||
{
|
||||
uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
|
||||
|
|
@ -3903,7 +3903,7 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
|||
}
|
||||
|
||||
// raid instance limitation
|
||||
if (spellInfo->AttributesEx6 & SPELL_ATTR_EX6_NOT_IN_RAID_INSTANCE)
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX6_NOT_IN_RAID_INSTANCE))
|
||||
{
|
||||
MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
|
||||
if (!mapEntry || mapEntry->IsRaid())
|
||||
|
|
@ -3927,13 +3927,13 @@ SpellCastResult SpellMgr::GetSpellAllowedInLocationError(SpellEntry const *spell
|
|||
// do not allow spells to be cast in arenas
|
||||
// - with SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA flag
|
||||
// - with greater than 10 min CD
|
||||
if ((spellInfo->AttributesEx4 & SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA) ||
|
||||
(GetSpellRecoveryTime(spellInfo) > 10 * MINUTE * IN_MILLISECONDS && !(spellInfo->AttributesEx4 & SPELL_ATTR_EX4_USABLE_IN_ARENA)))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX4_NOT_USABLE_IN_ARENA) ||
|
||||
(GetSpellRecoveryTime(spellInfo) > 10 * MINUTE * IN_MILLISECONDS && !spellInfo->HasAttribute(SPELL_ATTR_EX4_USABLE_IN_ARENA)))
|
||||
if (player && player->InArena())
|
||||
return SPELL_FAILED_NOT_IN_ARENA;
|
||||
|
||||
// Spell casted only on battleground
|
||||
if ((spellInfo->AttributesEx3 & SPELL_ATTR_EX3_BATTLEGROUND))
|
||||
if (spellInfo->HasAttribute(SPELL_ATTR_EX3_BATTLEGROUND))
|
||||
if (!player || !player->InBattleGround())
|
||||
return SPELL_FAILED_ONLY_BATTLEGROUNDS;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue