OregonCore  revision 3611e8a-git
Your Favourite TBC server
SpellMgr.h File Reference
#include <ace/Singleton.h>
#include "SharedDefines.h"
#include "DBCStructure.h"
#include "DBCStores.h"
#include "Database/SQLStorage.h"
#include "SpellAuraDefines.h"
#include "DisableMgr.h"
#include "Utilities/UnorderedMap.h"
#include "VMapFactory.h"
#include <map>

Go to the source code of this file.

Classes

struct  SpellProcEventEntry
 
struct  SpellEnchantProcEntry
 
struct  SpellThreatEntry
 
struct  SpellTargetEntry
 
struct  SpellTargetPosition
 
class  PetAura
 
struct  SpellChainNode
 
struct  SpellLearnSkillNode
 
struct  SpellLearnSpellNode
 
struct  SpellDummyConditionEntry
 
class  SpellMgr
 

Macros

#define SPELLFAMILYFLAG_ROGUE_VANISH   0x000000800LL
 
#define SPELLFAMILYFLAG_ROGUE_STEALTH   0x000400000LL
 
#define SPELLFAMILYFLAG_ROGUE_BACKSTAB   0x000800004LL
 
#define SPELLFAMILYFLAG_ROGUE_SAP   0x000000080LL
 
#define SPELLFAMILYFLAG_ROGUE_FEINT   0x008000000LL
 
#define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT   0x000200000LL
 
#define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE   0x9003E0000LL
 
#define SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR   0x000004000LL
 
#define SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK   0x080000000LL
 
#define SPELL_LINKED_MAX_SPELLS   200000
 
#define MELEE_BASED_TRIGGER_MASK
 
#define SPELL_GROUP_DB_RANGE_MIN   1000
 
#define SPELL_GROUP_STACK_RULE_MAX   3
 
#define MAX_SPELL_TARGET_TYPE   3
 
#define sSpellMgr   SpellMgr::Instance()
 

Typedefs

typedef std::map< uint32, uint64SpellAffectMap
 
typedef UNORDERED_MAP< uint32, SpellProcEventEntrySpellProcEventMap
 
typedef UNORDERED_MAP< uint32, SpellEnchantProcEntrySpellEnchantProcEventMap
 
typedef std::multimap< uint32, SpellGroupSpellSpellGroupMap
 
typedef std::pair< SpellSpellGroupMap::const_iterator, SpellSpellGroupMap::const_iterator > SpellSpellGroupMapBounds
 
typedef std::multimap< SpellGroup, int32SpellGroupSpellMap
 
typedef std::pair< SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_iterator > SpellGroupSpellMapBounds
 
typedef std::map< SpellGroup, SpellGroupStackRuleSpellGroupStackMap
 
typedef std::map< uint32, SpellThreatEntrySpellThreatMap
 
typedef UNORDERED_MAP< uint32, SpellTargetPositionSpellTargetPositionMap
 
typedef std::map< uint32, PetAuraSpellPetAuraMap
 
typedef UNORDERED_MAP< uint32, SpellChainNodeSpellChainMap
 
typedef UNORDERED_MAP< uint32, uint32SpellRequiredMap
 
typedef std::multimap< uint32, uint32SpellsRequiringSpellMap
 
typedef std::map< uint32, SpellLearnSkillNodeSpellLearnSkillMap
 
typedef std::multimap< uint32, SpellLearnSpellNodeSpellLearnSpellMap
 
typedef std::multimap< uint32, SkillLineAbilityEntry const * > SkillLineAbilityMap
 
typedef std::vector< uint32SpellCustomAttribute
 
typedef std::map< int32, std::vector< int32 > > SpellLinkedMap
 
typedef std::multimap< uint32, SpellDummyConditionEntrySpellDummyConditionMap
 

Enumerations

enum  SpellFamilyNames {
  SPELLFAMILY_GENERIC = 0, SPELLFAMILY_UNK1 = 1, SPELLFAMILY_MAGE = 3, SPELLFAMILY_WARRIOR = 4,
  SPELLFAMILY_WARLOCK = 5, SPELLFAMILY_PRIEST = 6, SPELLFAMILY_DRUID = 7, SPELLFAMILY_ROGUE = 8,
  SPELLFAMILY_HUNTER = 9, SPELLFAMILY_PALADIN = 10, SPELLFAMILY_SHAMAN = 11, SPELLFAMILY_UNK2 = 12,
  SPELLFAMILY_POTION = 13
}
 
enum  SpellEffectTargetTypes {
  SPELL_REQUIRE_NONE, SPELL_REQUIRE_UNIT, SPELL_REQUIRE_DEST, SPELL_REQUIRE_ITEM,
  SPELL_REQUIRE_CASTER
}
 
enum  SpellSelectTargetTypes {
  TARGET_TYPE_DEFAULT, TARGET_TYPE_UNIT_CASTER, TARGET_TYPE_UNIT_TARGET, TARGET_TYPE_UNIT_NEARBY,
  TARGET_TYPE_AREA_SRC, TARGET_TYPE_AREA_DST, TARGET_TYPE_AREA_CONE, TARGET_TYPE_DEST_CASTER,
  TARGET_TYPE_DEST_TARGET, TARGET_TYPE_DEST_DEST, TARGET_TYPE_DEST_SPECIAL, TARGET_TYPE_CHANNEL
}
 
enum  SpellSpecific {
  SPELL_SPECIFIC_NORMAL = 0, SPELL_SPECIFIC_SEAL = 1, SPELL_SPECIFIC_AURA = 3, SPELL_SPECIFIC_STING = 4,
  SPELL_SPECIFIC_CURSE = 5, SPELL_SPECIFIC_ASPECT = 6, SPELL_SPECIFIC_TRACKER = 7, SPELL_SPECIFIC_WARLOCK_ARMOR = 8,
  SPELL_SPECIFIC_MAGE_ARMOR = 9, SPELL_SPECIFIC_ELEMENTAL_SHIELD = 10, SPELL_SPECIFIC_MAGE_POLYMORPH = 11, SPELL_SPECIFIC_JUDGEMENT = 13,
  SPELL_SPECIFIC_WARLOCK_CORRUPTION = 17, SPELL_SPECIFIC_DRINK = 19, SPELL_SPECIFIC_FOOD = 20, SPELL_SPECIFIC_CHARM = 21,
  SPELL_SPECIFIC_WARRIOR_ENRAGE = 22, SPELL_SPECIFIC_ARMOR_REDUCE = 23
}
 
enum  SpellLinkedType { SPELL_LINK_CAST = 0, SPELL_LINK_HIT = 1 * 200000, SPELL_LINK_AURA = 2 * 200000, SPELL_LINK_REMOVE = 0 }
 
enum  ProcFlags {
  PROC_FLAG_NONE = 0x00000000, PROC_FLAG_KILLED = 0x00000001, PROC_FLAG_KILL = 0x00000002, PROC_FLAG_DONE_MELEE_AUTO_ATTACK = 0x00000004,
  PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK = 0x00000008, PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS = 0x00000010, PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS = 0x00000020, PROC_FLAG_DONE_RANGED_AUTO_ATTACK = 0x00000040,
  PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK = 0x00000080, PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS = 0x00000100, PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS = 0x00000200, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS = 0x00000400,
  PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS = 0x00000800, PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG = 0x00001000, PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG = 0x00002000, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS = 0x00004000,
  PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS = 0x00008000, PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG = 0x00010000, PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG = 0x00020000, PROC_FLAG_DONE_PERIODIC = 0x00040000,
  PROC_FLAG_TAKEN_PERIODIC = 0x00080000, PROC_FLAG_TAKEN_DAMAGE = 0x00100000, PROC_FLAG_DONE_TRAP_ACTIVATION = 0x00200000, PROC_FLAG_DONE_MAINHAND_ATTACK = 0x00400000,
  PROC_FLAG_DONE_OFFHAND_ATTACK = 0x00800000, PROC_FLAG_DEATH = 0x01000000, AUTO_ATTACK_PROC_FLAG_MASK, MELEE_PROC_FLAG_MASK,
  RANGED_PROC_FLAG_MASK, SPELL_PROC_FLAG_MASK, SPELL_CAST_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK | PROC_FLAG_DONE_TRAP_ACTIVATION | RANGED_PROC_FLAG_MASK, PERIODIC_PROC_FLAG_MASK = PROC_FLAG_DONE_PERIODIC | PROC_FLAG_TAKEN_PERIODIC,
  DONE_HIT_PROC_FLAG_MASK, TAKEN_HIT_PROC_FLAG_MASK, REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK
}
 
enum  ProcFlagsEx {
  PROC_EX_NONE = 0x0000000, PROC_EX_NORMAL_HIT = 0x0000001, PROC_EX_CRITICAL_HIT = 0x0000002, PROC_EX_MISS = 0x0000004,
  PROC_EX_RESIST = 0x0000008, PROC_EX_DODGE = 0x0000010, PROC_EX_PARRY = 0x0000020, PROC_EX_BLOCK = 0x0000040,
  PROC_EX_EVADE = 0x0000080, PROC_EX_IMMUNE = 0x0000100, PROC_EX_DEFLECT = 0x0000200, PROC_EX_ABSORB = 0x0000400,
  PROC_EX_REFLECT = 0x0000800, PROC_EX_INTERRUPT = 0x0001000, PROC_EX_RESERVED1 = 0x0002000, PROC_EX_RESERVED2 = 0x0004000,
  PROC_EX_RESERVED3 = 0x0008000, PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, PROC_EX_INTERNAL_HOT = 0x1000000,
  PROC_EX_INTERNAL_DOT = 0x2000000
}
 
enum  SpellGroup {
  SPELL_GROUP_ELIXIR_BATTLE = 1, SPELL_GROUP_ELIXIR_GUARDIAN = 2, SPELL_GROUP_ELIXIR_UNSTABLE = 3, SPELL_GROUP_ELIXIR_SHATTRATH = 4,
  SPELL_GROUP_CORE_RANGE_MAX = 5
}
 
enum  SpellGroupStackRule { SPELL_GROUP_STACK_RULE_DEFAULT = 0, SPELL_GROUP_STACK_RULE_EXCLUSIVE = 1, SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER = 2 }
 
enum  SpellScriptTargetType { SPELL_TARGET_TYPE_GAMEOBJECT = 0, SPELL_TARGET_TYPE_CREATURE = 1, SPELL_TARGET_TYPE_DEAD = 2 }
 
enum  SpellCustomAttributes {
  SPELL_ATTR_CU_CONE_BACK = 0x00000002, SPELL_ATTR_CU_CONE_LINE = 0x00000004, SPELL_ATTR_CU_SHARE_DAMAGE = 0x00000008, SPELL_ATTR_CU_AURA_HOT = 0x00000010,
  SPELL_ATTR_CU_AURA_DOT = 0x00000020, SPELL_ATTR_CU_AURA_CC = 0x00000040, SPELL_ATTR_CU_AURA_SPELL = 0x00000080, SPELL_ATTR_CU_DIRECT_DAMAGE = 0x00000100,
  SPELL_ATTR_CU_CHARGE = 0x00000200, SPELL_ATTR_CU_LINK_CAST = 0x00000400, SPELL_ATTR_CU_LINK_HIT = 0x00000800, SPELL_ATTR_CU_LINK_AURA = 0x00001000,
  SPELL_ATTR_CU_LINK_REMOVE = 0x00002000, SPELL_ATTR_CU_MOVEMENT_IMPAIR = 0x00004000, SPELL_ATTR_CU_IGNORE_ARMOR = 0x00008000, SPELL_ATTR_CU_CAST_BY_ITEM_ONLY = 0x00010000,
  SPELL_ATTR_CU_FIXED_AMOUNT = 0x00020000, SPELL_ATTR_CU_ANY_TARGET = 0x00040000, SPELL_ATTR_CU_PICKPOCKET = 0x00080000
}
 
enum  SpellDummyConditionBitmask {
  SDC_BTM_CASTER_MUST_NOT_HAVE_PET = 1 << 0, SDC_BTM_CASTER_MUST_NOT_HAVE_CHARM = 1 << 1, SDC_BTM_CASTER_MUST_BE_UNDERWATER = 1 << 2, SDC_BTM_TARGET_MUST_BE_CREATURE = 1 << 3,
  SDC_BTM_TARGET_MUST_BE_PLAYER = 1 << 4, SDC_BTM_TARGET_MUST_BE_FRIENDLY = 1 << 5, SDC_BTM_TARGET_MUST_BE_HOSTILE = 1 << 6, SDC_BTM_TARGET_MUST_BE_DEAD = 1 << 7,
  SDC_BTM_CASTER_MUST_BE_OUT_OF_COMBAT = 1 << 8, SDC_BTM_TARGET_MUST_NOT_BE_HIER_LEVEL = 1 << 9, SDC_BTM_NEEDS_SCRIPT_CHECK = 1 << 18, SDC_BTM_TARGET_TYPE_NONE = 1 << 19,
  SDC_BTM_TARGET_TYPE_BEAST = 1 << 20, SDC_BTM_TARGET_TYPE_DRAGONKIN = 1 << 21, SDC_BTM_TARGET_TYPE_DEMON = 1 << 20, SDC_BTM_TARGET_TYPE_ELEMENTAL = 1 << 22,
  SDC_BTM_TARGET_TYPE_GIANT = 1 << 23, SDC_BTM_TARGET_TYPE_UNDEAD = 1 << 24, SDC_BTM_TARGET_TYPE_HUMANOID = 1 << 25, SDC_BTM_TARGET_TYPE_CRITTER = 1 << 26,
  SDC_BTM_TARGET_TYPE_MECHANICAL = 1 << 27, SDC_BTM_TARGET_TYPE_10 = 1 << 28, SDC_BTM_TARGET_TYPE_TOTEM = 1 << 29, SDC_BTM_TARGET_TYPE_NON_COMBAT_PET = 1 << 30,
  SDC_BTM_TARGET_TYPE_GAS_CLOUD = 1 << 31
}
 
enum  SpellDummyCondition {
  SDC_NONE = 0, SDC_AURA_TARGET = 1, SDC_AURA_CASTER = 2, SDC_QUEST_TAKEN = 3,
  SDC_QUEST_REWARDED = 4, SDC_HAS_SPELL = 5, SDC_ACTIVE_EVENT = 6, SDC_TEAM = 7,
  SDC_CASTER_HP_PCT = 8, SDC_TARGET_HP_PCT = 9, SDC_CASTER_MANA_PCT = 10, SDC_TARGET_MANA_PCT = 11,
  SDC_TARGET_IN_ARC = 12, SDC_TARGET_EXACT_ENTRY = 13, SDC_TARGET_TYPE_FLAGS = 14, SDC_TARGET_FAMILY = 15
}
 

Functions

SpellSpecific GetSpellSpecific (uint32 spellId)
 
float GetSpellRadiusForHostile (SpellRadiusEntry const *radius)
 
float GetSpellRadiusForFriend (SpellRadiusEntry const *radius)
 
uint32 GetSpellCastTime (SpellEntry const *spellInfo, Spell const *spell=NULL)
 
float GetSpellMinRange (SpellRangeEntry const *range)
 
float GetSpellMaxRange (SpellRangeEntry const *range)
 
uint32 GetSpellRangeType (SpellRangeEntry const *range)
 
uint32 GetSpellRecoveryTime (SpellEntry const *spellInfo)
 
int32 GetSpellDuration (SpellEntry const *spellInfo)
 
int32 GetSpellMaxDuration (SpellEntry const *spellInfo)
 
bool IsSpellIgnoringLOS (SpellEntry const *spellInfo)
 
float GetSpellRadius (SpellEntry const *spellInfo, uint32 effectIdx, bool positive)
 
float GetSpellMaxRange (SpellEntry const *spellInfo)
 
float GetSpellMinRange (SpellEntry const *spellInfo)
 
float GetSpellMinRange (uint32 id)
 
float GetSpellMaxRange (uint32 id)
 
bool IsSpellHaveEffect (SpellEntry const *spellInfo, SpellEffects effect)
 
bool IsSealSpell (SpellEntry const *spellInfo)
 
bool IsElementalShield (SpellEntry const *spellInfo)
 
bool IsSpellEffectTriggerSpell (const SpellEntry *entry, SpellEffIndex eff_idx)
 
bool IsSpellEffectAbleToCrit (const SpellEntry *entry, SpellEffIndex index)
 
bool IsSpellAbleToCrit (const SpellEntry *entry)
 
bool IsSpellRemoveAllMovementAndControlLossEffects (SpellEntry const *spellProto)
 
bool IsDeathOnlySpell (SpellEntry const *spellInfo)
 
uint32 CalculatePowerCost (SpellEntry const *spellInfo, Unit const *caster, SpellSchoolMask schoolMask)
 
int32 CompareAuraRanks (uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
 
bool IsPassiveSpell (uint32 spellId)
 
bool IsPassiveSpell (SpellEntry const *spellInfo)
 
bool IsAutocastableSpell (uint32 spellId)
 
bool IsDeathPersistentSpell (SpellEntry const *spellInfo)
 
bool IsNonCombatSpell (SpellEntry const *spellInfo)
 
bool IsPositiveSpell (uint32 spellId)
 
bool IsPositiveEffect (uint32 spellId, uint32 effIndex)
 
bool IsPositiveTarget (uint32 targetA, uint32 targetB)
 
bool IsSingleTargetSpell (SpellEntry const *spellInfo)
 
bool IsSingleTargetSpells (SpellEntry const *spellInfo1, SpellEntry const *spellInfo2)
 
bool IsBinarySpell (SpellEntry const *spellInfo)
 
bool IsAuraAddedBySpell (uint32 auraType, uint32 spellId)
 
bool IsSpellAllowedInLocation (SpellEntry const *spellInfo, uint32 map_id, uint32 zone_id, uint32 area_id)
 
bool IsAreaOfEffectSpell (SpellEntry const *spellInfo)
 
bool IsFarUnitTargetEffect (uint32 effect)
 
bool IsFarDestTargetEffect (uint32 effect)
 
bool IsAreaAuraEffect (uint32 effect)
 
bool IsDispel (SpellEntry const *spellInfo)
 
bool IsDispelSpell (SpellEntry const *spellInfo)
 
bool isSpellBreakStealth (SpellEntry const *spellInfo)
 
bool IsAutoRepeatRangedSpell (SpellEntry const *spellInfo)
 
SpellCastResult GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form)
 
bool IsChanneledSpell (SpellEntry const *spellInfo)
 
bool NeedsComboPoints (SpellEntry const *spellInfo)
 
SpellSchoolMask GetSpellSchoolMask (SpellEntry const *spellInfo)
 
uint32 GetSpellMechanicMask (SpellEntry const *spellInfo, int32 effect)
 
Mechanics GetEffectMechanic (SpellEntry const *spellInfo, int32 effect)
 
uint32 GetDispelMask (DispelType dispel)
 
DiminishingGroup GetDiminishingReturnsGroupForSpell (SpellEntry const *spellproto, bool triggered)
 
bool IsDiminishingReturnsGroupDurationLimited (DiminishingGroup group)
 
DiminishingReturnsType GetDiminishingReturnsGroupType (DiminishingGroup group)
 
bool IsPrimaryProfessionSkill (uint32 skill)
 
bool IsProfessionSkill (uint32 skill)
 

Variables

bool IsAreaEffectTarget [TOTAL_SPELL_TARGETS]
 

Macro Definition Documentation

#define MAX_SPELL_TARGET_TYPE   3

Definition at line 706 of file SpellMgr.h.

Referenced by ConditionMgr::isConditionTypeValid().

#define MELEE_BASED_TRIGGER_MASK
Value:
PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | \
PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | \
PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | \
PROC_FLAG_DONE_RANGED_AUTO_ATTACK | \
PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK | \
PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | \
PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS)

Definition at line 602 of file SpellMgr.h.

Referenced by Unit::ProcDamageAndSpellFor().

#define SPELL_GROUP_DB_RANGE_MIN   1000

Definition at line 668 of file SpellMgr.h.

#define SPELL_GROUP_STACK_RULE_MAX   3

Definition at line 685 of file SpellMgr.h.

Referenced by SpellMgr::LoadSpellGroupStackRules().

#define SPELL_LINKED_MAX_SPELLS   200000

Definition at line 117 of file SpellMgr.h.

Referenced by SpellMgr::LoadSpellLinked().

#define SPELLFAMILYFLAG_ROGUE__FINISHING_MOVE   0x9003E0000LL

Definition at line 90 of file SpellMgr.h.

Referenced by Unit::HandleDummyAuraProc().

#define SPELLFAMILYFLAG_ROGUE_BACKSTAB   0x000800004LL

Definition at line 86 of file SpellMgr.h.

#define SPELLFAMILYFLAG_ROGUE_FEINT   0x008000000LL

Definition at line 88 of file SpellMgr.h.

#define SPELLFAMILYFLAG_ROGUE_KIDNEYSHOT   0x000200000LL

Definition at line 89 of file SpellMgr.h.

#define SPELLFAMILYFLAG_ROGUE_SAP   0x000000080LL

Definition at line 87 of file SpellMgr.h.

#define SPELLFAMILYFLAG_ROGUE_STEALTH   0x000400000LL

Definition at line 85 of file SpellMgr.h.

Referenced by Spell::EffectTriggerSpell().

#define SPELLFAMILYFLAG_ROGUE_VANISH   0x000000800LL

Definition at line 84 of file SpellMgr.h.

Referenced by Spell::EffectSanctuary().

#define SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK   0x080000000LL

Definition at line 92 of file SpellMgr.h.

#define SPELLFAMILYFLAG_WARRIOR_SUNDERARMOR   0x000004000LL

Definition at line 91 of file SpellMgr.h.

Referenced by Spell::SpellDamageWeaponDmg().

#define sSpellMgr   SpellMgr::Instance()

Definition at line 1239 of file SpellMgr.h.

Referenced by Spell::_handle_immediate_phase(), Unit::AddAura(), Pet::addSpell(), Player::AddSpell(), ThreatCalcHelper::calcThreat(), Pet::CanTakeMoreActiveSpells(), Spell::cast(), Unit::CastCustomSpell(), Player::CastItemCombatSpell(), Unit::CastSpell(), Spell::CheckCast(), Spell::CheckDummyCast(), Spell::CheckPetCast(), Spell::CheckTarget(), Spell::DoSpellHitOnUnit(), Spell::EffectDummy(), Spell::EffectEnergize(), Spell::FillTargetMap(), Player::GetHighestLearnedRankOf(), Pet::GetTPForSpell(), Player::GetTrainerSpellState(), Aura::HandleAddModifier(), Aura::HandleAuraDummy(), WorldSession::HandleCastSpellOpcode(), ChatHandler::HandleLearnAllMySpellsCommand(), ChatHandler::HandleLookupSpellCommand(), Unit::HandleProcTriggerSpell(), ChatHandler::HandleReloadSpellAffectCommand(), ChatHandler::HandleReloadSpellGroupsCommand(), ChatHandler::HandleReloadSpellGroupStackRulesCommand(), ChatHandler::HandleReloadSpellLearnSpellCommand(), ChatHandler::HandleReloadSpellLinkedSpellCommand(), ChatHandler::HandleReloadSpellPetAurasCommand(), ChatHandler::HandleReloadSpellProcEventCommand(), ChatHandler::HandleReloadSpellRequiredCommand(), ChatHandler::HandleReloadSpellTargetPositionCommand(), ChatHandler::HandleReloadSpellThreatsCommand(), Spell::HandleThreatSpells(), Unit::HasHigherRankOfAura(), Pet::InitPetCreateSpells(), Spell::IsAffectedBy(), Player::IsAffectedBySpellmod(), Unit::IsDamageReducedByArmor(), Player::IsSpellFitByClassAndRace(), Unit::IsTriggeredAtSpellProcEvent(), ChatHandler::isValidChatMessage(), Player::LearnQuestRewardedSpells(), Player::LearnSpell(), Player::LearnSpellHighestRank(), LoadSkillDiscoveryTable(), Aura::PeriodicTick(), Unit::RemoveAura(), Unit::RemoveMovementImpairingAuras(), Unit::RemoveNoStackAurasDueToAura(), Unit::RemoveRankAurasDueToSpell(), Player::RemoveSpell(), Player::ResetTalents(), WorldSession::SendTrainerList(), World::SetInitialWorldSettings(), Player::SetSkill(), Spell::SetTargetMap(), Spell::Spell(), AreaAura::Update(), Player::UpdateAreaDependentAuras(), Aura::UpdateAuraDuration(), and Player::UpdateCraftSkill().

Typedef Documentation

typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap

Definition at line 811 of file SpellMgr.h.

typedef std::map<uint32, uint64> SpellAffectMap

Definition at line 520 of file SpellMgr.h.

Definition at line 786 of file SpellMgr.h.

typedef std::vector<uint32> SpellCustomAttribute

Definition at line 854 of file SpellMgr.h.

Definition at line 922 of file SpellMgr.h.

typedef std::multimap<SpellGroup, int32> SpellGroupSpellMap

Definition at line 675 of file SpellMgr.h.

typedef std::pair<SpellGroupSpellMap::const_iterator, SpellGroupSpellMap::const_iterator> SpellGroupSpellMapBounds

Definition at line 676 of file SpellMgr.h.

Definition at line 687 of file SpellMgr.h.

Definition at line 801 of file SpellMgr.h.

Definition at line 809 of file SpellMgr.h.

typedef std::map<int32, std::vector<int32> > SpellLinkedMap

Definition at line 856 of file SpellMgr.h.

typedef std::map<uint32, PetAura> SpellPetAuraMap

Definition at line 774 of file SpellMgr.h.

Definition at line 789 of file SpellMgr.h.

typedef std::multimap<uint32, SpellGroup > SpellSpellGroupMap

Definition at line 671 of file SpellMgr.h.

typedef std::pair<SpellSpellGroupMap::const_iterator, SpellSpellGroupMap::const_iterator> SpellSpellGroupMapBounds

Definition at line 672 of file SpellMgr.h.

typedef std::multimap<uint32, uint32> SpellsRequiringSpellMap

Definition at line 791 of file SpellMgr.h.

Definition at line 696 of file SpellMgr.h.

Enumeration Type Documentation

enum ProcFlags
Enumerator
PROC_FLAG_NONE 
PROC_FLAG_KILLED 
PROC_FLAG_KILL 
PROC_FLAG_DONE_MELEE_AUTO_ATTACK 
PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK 
PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS 
PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS 
PROC_FLAG_DONE_RANGED_AUTO_ATTACK 
PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK 
PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS 
PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS 
PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS 
PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS 
PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG 
PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG 
PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS 
PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS 
PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG 
PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG 
PROC_FLAG_DONE_PERIODIC 
PROC_FLAG_TAKEN_PERIODIC 
PROC_FLAG_TAKEN_DAMAGE 
PROC_FLAG_DONE_TRAP_ACTIVATION 
PROC_FLAG_DONE_MAINHAND_ATTACK 
PROC_FLAG_DONE_OFFHAND_ATTACK 
PROC_FLAG_DEATH 
AUTO_ATTACK_PROC_FLAG_MASK 
MELEE_PROC_FLAG_MASK 
RANGED_PROC_FLAG_MASK 
SPELL_PROC_FLAG_MASK 
SPELL_CAST_PROC_FLAG_MASK 
PERIODIC_PROC_FLAG_MASK 
DONE_HIT_PROC_FLAG_MASK 
TAKEN_HIT_PROC_FLAG_MASK 
REQ_SPELL_PHASE_PROC_FLAG_MASK 

Definition at line 523 of file SpellMgr.h.

524 {
525  PROC_FLAG_NONE = 0x00000000,
526 
527  PROC_FLAG_KILLED = 0x00000001, // 00 Killed by agressor - not sure about this flag
528  PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward)
529 
530  PROC_FLAG_DONE_MELEE_AUTO_ATTACK = 0x00000004, // 02 Done melee auto attack
531  PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK = 0x00000008, // 03 Taken melee auto attack
532 
533  PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS = 0x00000010, // 04 Done attack by Spell that has dmg class melee
534  PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS = 0x00000020, // 05 Taken attack by Spell that has dmg class melee
535 
536  PROC_FLAG_DONE_RANGED_AUTO_ATTACK = 0x00000040, // 06 Done ranged auto attack
537  PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK = 0x00000080, // 07 Taken ranged auto attack
538 
539  PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS = 0x00000100, // 08 Done attack by Spell that has dmg class ranged
540  PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS = 0x00000200, // 09 Taken attack by Spell that has dmg class ranged
541 
542  PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS = 0x00000400, // 10 Done positive spell that has dmg class none
543  PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS = 0x00000800, // 11 Taken positive spell that has dmg class none
544 
545  PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG = 0x00001000, // 12 Done negative spell that has dmg class none
546  PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG = 0x00002000, // 13 Taken negative spell that has dmg class none
547 
548  PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS = 0x00004000, // 14 Done positive spell that has dmg class magic
549  PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS = 0x00008000, // 15 Taken positive spell that has dmg class magic
550 
551  PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG = 0x00010000, // 16 Done negative spell that has dmg class magic
552  PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG = 0x00020000, // 17 Taken negative spell that has dmg class magic
553 
554  PROC_FLAG_DONE_PERIODIC = 0x00040000, // 18 Successful do periodic (damage / healing)
555  PROC_FLAG_TAKEN_PERIODIC = 0x00080000, // 19 Taken spell periodic (damage / healing)
556 
557  PROC_FLAG_TAKEN_DAMAGE = 0x00100000, // 20 Taken any damage
558  PROC_FLAG_DONE_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation (possibly needs name change to ON_GAMEOBJECT_CAST or USE)
559 
560  PROC_FLAG_DONE_MAINHAND_ATTACK = 0x00400000, // 22 Done main-hand melee attacks (spell and autoattack)
561  PROC_FLAG_DONE_OFFHAND_ATTACK = 0x00800000, // 23 Done off-hand melee attacks (spell and autoattack)
562 
563  PROC_FLAG_DEATH = 0x01000000, // 24 Died in any way
564 
565  // flag masks
568 
572 
575 
582 
584 
586 
592 
598 
599  REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK
600 };
Enumerator
PROC_EX_NONE 
PROC_EX_NORMAL_HIT 
PROC_EX_CRITICAL_HIT 
PROC_EX_MISS 
PROC_EX_RESIST 
PROC_EX_DODGE 
PROC_EX_PARRY 
PROC_EX_BLOCK 
PROC_EX_EVADE 
PROC_EX_IMMUNE 
PROC_EX_DEFLECT 
PROC_EX_ABSORB 
PROC_EX_REFLECT 
PROC_EX_INTERRUPT 
PROC_EX_RESERVED1 
PROC_EX_RESERVED2 
PROC_EX_RESERVED3 
PROC_EX_EX_TRIGGER_ALWAYS 
PROC_EX_EX_ONE_TIME_TRIGGER 
PROC_EX_INTERNAL_HOT 
PROC_EX_INTERNAL_DOT 

Definition at line 611 of file SpellMgr.h.

612 {
613  PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag)
614  PROC_EX_NORMAL_HIT = 0x0000001, // If set only from normal hit (only damage spells)
615  PROC_EX_CRITICAL_HIT = 0x0000002,
616  PROC_EX_MISS = 0x0000004,
617  PROC_EX_RESIST = 0x0000008,
618  PROC_EX_DODGE = 0x0000010,
619  PROC_EX_PARRY = 0x0000020,
620  PROC_EX_BLOCK = 0x0000040,
621  PROC_EX_EVADE = 0x0000080,
622  PROC_EX_IMMUNE = 0x0000100,
623  PROC_EX_DEFLECT = 0x0000200,
624  PROC_EX_ABSORB = 0x0000400,
625  PROC_EX_REFLECT = 0x0000800,
626  PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used)
627  PROC_EX_RESERVED1 = 0x0002000,
628  PROC_EX_RESERVED2 = 0x0004000,
629  PROC_EX_RESERVED3 = 0x0008000,
630  PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always ( no matter another flags) used for drop charges
631  PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not used)
632  PROC_EX_INTERNAL_HOT = 0x1000000, // Only for internal use
633  PROC_EX_INTERNAL_DOT = 0x2000000 // Only for internal use
634 };
Enumerator
SPELL_ATTR_CU_CONE_BACK 
SPELL_ATTR_CU_CONE_LINE 
SPELL_ATTR_CU_SHARE_DAMAGE 
SPELL_ATTR_CU_AURA_HOT 
SPELL_ATTR_CU_AURA_DOT 
SPELL_ATTR_CU_AURA_CC 
SPELL_ATTR_CU_AURA_SPELL 
SPELL_ATTR_CU_DIRECT_DAMAGE 
SPELL_ATTR_CU_CHARGE 
SPELL_ATTR_CU_LINK_CAST 
SPELL_ATTR_CU_LINK_HIT 
SPELL_ATTR_CU_LINK_AURA 
SPELL_ATTR_CU_LINK_REMOVE 
SPELL_ATTR_CU_MOVEMENT_IMPAIR 

related to movement impiaring effects

SPELL_ATTR_CU_IGNORE_ARMOR 

must ignore armor

SPELL_ATTR_CU_CAST_BY_ITEM_ONLY 

must be cast from item, never directly

SPELL_ATTR_CU_FIXED_AMOUNT 

ignore bonus healing/damage

SPELL_ATTR_CU_ANY_TARGET 

approves cast on any target, even when its non-attackable

See also
Spell::CheckTarget, useful with crafted/forced targets
SPELL_ATTR_CU_PICKPOCKET 

Spell is Pickpocket.

Definition at line 830 of file SpellMgr.h.

831 {
832  //SPELL_ATTR_CU_PLAYERS_ONLY 0x00000001
833  SPELL_ATTR_CU_CONE_BACK = 0x00000002,
834  SPELL_ATTR_CU_CONE_LINE = 0x00000004,
835  SPELL_ATTR_CU_SHARE_DAMAGE = 0x00000008,
836  SPELL_ATTR_CU_AURA_HOT = 0x00000010,
837  SPELL_ATTR_CU_AURA_DOT = 0x00000020,
838  SPELL_ATTR_CU_AURA_CC = 0x00000040,
839  SPELL_ATTR_CU_AURA_SPELL = 0x00000080,
840  SPELL_ATTR_CU_DIRECT_DAMAGE = 0x00000100,
841  SPELL_ATTR_CU_CHARGE = 0x00000200,
842  SPELL_ATTR_CU_LINK_CAST = 0x00000400,
843  SPELL_ATTR_CU_LINK_HIT = 0x00000800,
844  SPELL_ATTR_CU_LINK_AURA = 0x00001000,
845  SPELL_ATTR_CU_LINK_REMOVE = 0x00002000,
846  SPELL_ATTR_CU_MOVEMENT_IMPAIR = 0x00004000,
847  SPELL_ATTR_CU_IGNORE_ARMOR = 0x00008000,
848  SPELL_ATTR_CU_CAST_BY_ITEM_ONLY= 0x00010000,
849  SPELL_ATTR_CU_FIXED_AMOUNT = 0x00020000,
850  SPELL_ATTR_CU_ANY_TARGET = 0x00040000,
851  SPELL_ATTR_CU_PICKPOCKET = 0x00080000,
852 };
Spell is Pickpocket.
Definition: SpellMgr.h:851
must ignore armor
Definition: SpellMgr.h:847
approves cast on any target, even when its non-attackable
Definition: SpellMgr.h:850
ignore bonus healing/damage
Definition: SpellMgr.h:849
related to movement impiaring effects
Definition: SpellMgr.h:846
must be cast from item, never directly
Definition: SpellMgr.h:848
Enumerator
SDC_NONE 
SDC_AURA_TARGET 
SDC_AURA_CASTER 
SDC_QUEST_TAKEN 
SDC_QUEST_REWARDED 
SDC_HAS_SPELL 
SDC_ACTIVE_EVENT 
SDC_TEAM 
SDC_CASTER_HP_PCT 
SDC_TARGET_HP_PCT 
SDC_CASTER_MANA_PCT 
SDC_TARGET_MANA_PCT 
SDC_TARGET_IN_ARC 
SDC_TARGET_EXACT_ENTRY 
SDC_TARGET_TYPE_FLAGS 
SDC_TARGET_FAMILY 

Definition at line 888 of file SpellMgr.h.

Enumerator
SDC_BTM_CASTER_MUST_NOT_HAVE_PET 
SDC_BTM_CASTER_MUST_NOT_HAVE_CHARM 
SDC_BTM_CASTER_MUST_BE_UNDERWATER 
SDC_BTM_TARGET_MUST_BE_CREATURE 
SDC_BTM_TARGET_MUST_BE_PLAYER 
SDC_BTM_TARGET_MUST_BE_FRIENDLY 
SDC_BTM_TARGET_MUST_BE_HOSTILE 
SDC_BTM_TARGET_MUST_BE_DEAD 
SDC_BTM_CASTER_MUST_BE_OUT_OF_COMBAT 
SDC_BTM_TARGET_MUST_NOT_BE_HIER_LEVEL 
SDC_BTM_NEEDS_SCRIPT_CHECK 
SDC_BTM_TARGET_TYPE_NONE 
SDC_BTM_TARGET_TYPE_BEAST 
SDC_BTM_TARGET_TYPE_DRAGONKIN 
SDC_BTM_TARGET_TYPE_DEMON 
SDC_BTM_TARGET_TYPE_ELEMENTAL 
SDC_BTM_TARGET_TYPE_GIANT 
SDC_BTM_TARGET_TYPE_UNDEAD 
SDC_BTM_TARGET_TYPE_HUMANOID 
SDC_BTM_TARGET_TYPE_CRITTER 
SDC_BTM_TARGET_TYPE_MECHANICAL 
SDC_BTM_TARGET_TYPE_10 
SDC_BTM_TARGET_TYPE_TOTEM 
SDC_BTM_TARGET_TYPE_NON_COMBAT_PET 
SDC_BTM_TARGET_TYPE_GAS_CLOUD 

Definition at line 858 of file SpellMgr.h.

859 {
870  // bits 10 - 17 are reserved
871  SDC_BTM_NEEDS_SCRIPT_CHECK = 1 << 18,
872  SDC_BTM_TARGET_TYPE_NONE = 1 << 19,
873  SDC_BTM_TARGET_TYPE_BEAST = 1 << 20,
875  SDC_BTM_TARGET_TYPE_DEMON = 1 << 20,
877  SDC_BTM_TARGET_TYPE_GIANT = 1 << 23,
878  SDC_BTM_TARGET_TYPE_UNDEAD = 1 << 24,
880  SDC_BTM_TARGET_TYPE_CRITTER = 1 << 26,
882  SDC_BTM_TARGET_TYPE_10 = 1 << 28,
883  SDC_BTM_TARGET_TYPE_TOTEM = 1 << 29,
886 };
Enumerator
SPELL_REQUIRE_NONE 
SPELL_REQUIRE_UNIT 
SPELL_REQUIRE_DEST 
SPELL_REQUIRE_ITEM 
SPELL_REQUIRE_CASTER 

Definition at line 58 of file SpellMgr.h.

Enumerator
SPELLFAMILY_GENERIC 
SPELLFAMILY_UNK1 
SPELLFAMILY_MAGE 
SPELLFAMILY_WARRIOR 
SPELLFAMILY_WARLOCK 
SPELLFAMILY_PRIEST 
SPELLFAMILY_DRUID 
SPELLFAMILY_ROGUE 
SPELLFAMILY_HUNTER 
SPELLFAMILY_PALADIN 
SPELLFAMILY_SHAMAN 
SPELLFAMILY_UNK2 
SPELLFAMILY_POTION 

Definition at line 40 of file SpellMgr.h.

enum SpellGroup
Enumerator
SPELL_GROUP_ELIXIR_BATTLE 
SPELL_GROUP_ELIXIR_GUARDIAN 
SPELL_GROUP_ELIXIR_UNSTABLE 
SPELL_GROUP_ELIXIR_SHATTRATH 
SPELL_GROUP_CORE_RANGE_MAX 

Definition at line 659 of file SpellMgr.h.

Enumerator
SPELL_GROUP_STACK_RULE_DEFAULT 
SPELL_GROUP_STACK_RULE_EXCLUSIVE 
SPELL_GROUP_STACK_RULE_EXCLUSIVE_FROM_SAME_CASTER 

Definition at line 678 of file SpellMgr.h.

Enumerator
SPELL_LINK_CAST 
SPELL_LINK_HIT 
SPELL_LINK_AURA 
SPELL_LINK_REMOVE 

Definition at line 119 of file SpellMgr.h.

120 {
121  SPELL_LINK_CAST = 0, // +: cast; -: remove
122  SPELL_LINK_HIT = 1 * 200000,
123  SPELL_LINK_AURA = 2 * 200000, // +: aura; -: immune
124  SPELL_LINK_REMOVE = 0,
125 };
Enumerator
SPELL_TARGET_TYPE_GAMEOBJECT 
SPELL_TARGET_TYPE_CREATURE 
SPELL_TARGET_TYPE_DEAD 

Definition at line 699 of file SpellMgr.h.

Enumerator
TARGET_TYPE_DEFAULT 
TARGET_TYPE_UNIT_CASTER 
TARGET_TYPE_UNIT_TARGET 
TARGET_TYPE_UNIT_NEARBY 
TARGET_TYPE_AREA_SRC 
TARGET_TYPE_AREA_DST 
TARGET_TYPE_AREA_CONE 
TARGET_TYPE_DEST_CASTER 
TARGET_TYPE_DEST_TARGET 
TARGET_TYPE_DEST_DEST 
TARGET_TYPE_DEST_SPECIAL 
TARGET_TYPE_CHANNEL 

Definition at line 67 of file SpellMgr.h.

Enumerator
SPELL_SPECIFIC_NORMAL 
SPELL_SPECIFIC_SEAL 
SPELL_SPECIFIC_AURA 
SPELL_SPECIFIC_STING 
SPELL_SPECIFIC_CURSE 
SPELL_SPECIFIC_ASPECT 
SPELL_SPECIFIC_TRACKER 
SPELL_SPECIFIC_WARLOCK_ARMOR 
SPELL_SPECIFIC_MAGE_ARMOR 
SPELL_SPECIFIC_ELEMENTAL_SHIELD 
SPELL_SPECIFIC_MAGE_POLYMORPH 
SPELL_SPECIFIC_JUDGEMENT 
SPELL_SPECIFIC_WARLOCK_CORRUPTION 
SPELL_SPECIFIC_DRINK 
SPELL_SPECIFIC_FOOD 
SPELL_SPECIFIC_CHARM 
SPELL_SPECIFIC_WARRIOR_ENRAGE 
SPELL_SPECIFIC_ARMOR_REDUCE 

Definition at line 95 of file SpellMgr.h.

96 {
111  SPELL_SPECIFIC_FOOD = 20,
115 };

Function Documentation

uint32 CalculatePowerCost ( SpellEntry const *  spellInfo,
Unit const *  caster,
SpellSchoolMask  schoolMask 
)

Definition at line 303 of file SpellMgr.cpp.

References SpellEntry::Attributes, SpellEntry::AttributesEx, SpellEntry::AttributesEx4, Unit::GetAttackTime(), Unit::GetCreateHealth(), Unit::GetCreateMana(), GetFirstSchoolInMask(), Object::GetFloatValue(), Unit::GetHealth(), Object::GetInt32Value(), Unit::getLevel(), Unit::GetMaxPower(), Unit::GetPower(), Unit::GetSpellModOwner(), SpellEntry::Id, Unit::IsControlledByPlayer(), SpellEntry::manaCost, SpellEntry::ManaCostPercentage, MAX_POWERS, OFF_ATTACK, POWER_ENERGY, POWER_FOCUS, POWER_HAPPINESS, POWER_HEALTH, POWER_MANA, POWER_RAGE, SpellEntry::powerType, GtNPCManaCostScalerEntry::ratio, sGtNPCManaCostScalerStore, sLog, SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION, SPELL_ATTR1_DRAIN_ALL_POWER, SPELL_ATTR4_SPELL_VS_EXTEND_COST, SpellEntry::spellLevel, SPELLMOD_COST, UNIT_FIELD_POWER_COST_MODIFIER, and UNIT_FIELD_POWER_COST_MULTIPLIER.

Referenced by CreatureEventAI::CanCast(), IsDeathOnlySpell(), Spell::prepare(), and SmartScript::ProcessAction().

304 {
305  // Spell drain all exist power on cast (Only paladin lay of Hands)
306  if (spellInfo->AttributesEx & SPELL_ATTR1_DRAIN_ALL_POWER)
307  {
308  // If power type - health drain all
309  if (spellInfo->powerType == POWER_HEALTH)
310  return caster->GetHealth();
311  // Else drain all power
312  if (spellInfo->powerType < MAX_POWERS)
313  return caster->GetPower(Powers(spellInfo->powerType));
314  sLog.outError("CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id);
315  return 0;
316  }
317 
318  // Base powerCost
319  int32 powerCost = spellInfo->manaCost;
320  // PCT cost from total amount
321  if (spellInfo->ManaCostPercentage)
322  {
323  switch (spellInfo->powerType)
324  {
325  // health as power used
326  case POWER_HEALTH:
327  powerCost += spellInfo->ManaCostPercentage * caster->GetCreateHealth() / 100;
328  break;
329  case POWER_MANA:
330  powerCost += spellInfo->ManaCostPercentage * caster->GetCreateMana() / 100;
331  break;
332  case POWER_RAGE:
333  case POWER_FOCUS:
334  case POWER_ENERGY:
335  case POWER_HAPPINESS:
336  powerCost += spellInfo->ManaCostPercentage * caster->GetMaxPower(Powers(spellInfo->powerType)) / 100;
337  break;
338  default:
339  sLog.outError("CalculateManaCost: Unknown power type '%d' in spell %d", spellInfo->powerType, spellInfo->Id);
340  return 0;
341  }
342  }
343  SpellSchools school = GetFirstSchoolInMask(schoolMask);
344  // Flat mod from caster auras by spell school
345  powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school);
346  // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
347  if (spellInfo->AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST)
348  powerCost += caster->GetAttackTime(OFF_ATTACK) / 100;
349  // Apply cost mod by spell
350  if (Player* modOwner = caster->GetSpellModOwner())
351  modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_COST, powerCost);
352 
353  if (!caster->IsControlledByPlayer() && spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)
354  {
355  GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(spellInfo->spellLevel - 1);
356  GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1);
357  if (spellScaler && casterScaler)
358  powerCost *= casterScaler->ratio / spellScaler->ratio;
359  }
360 
361  // PCT mod from user auras by school
362  powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school)));
363  if (powerCost < 0)
364  powerCost = 0;
365  return powerCost;
366 }
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
SpellSchools
DBCStorage< GtNPCManaCostScalerEntry > sGtNPCManaCostScalerStore(GtNPCManaCostScalerfmt)
#define sLog
Log class singleton.
Definition: Log.h:187
ACE_INT32 int32
Definition: Define.h:67
#define MAX_POWERS
Powers
Player * GetSpellModOwner() const
Definition: Unit.cpp:11748
Definition: Player.h:922
int32 CompareAuraRanks ( uint32  spellId_1,
uint32  effIndex_1,
uint32  spellId_2,
uint32  effIndex_2 
)

Definition at line 384 of file SpellMgr.cpp.

References SpellEntry::EffectBasePoints, and sSpellStore.

Referenced by IsDeathOnlySpell(), and Unit::RemoveNoStackAurasDueToAura().

385 {
386  SpellEntry const* spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
387  SpellEntry const* spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
388  if (!spellInfo_1 || !spellInfo_2) return 0;
389  if (spellId_1 == spellId_2) return 0;
390 
391  int32 diff = spellInfo_1->EffectBasePoints[effIndex_1] - spellInfo_2->EffectBasePoints[effIndex_2];
392  if (spellInfo_1->EffectBasePoints[effIndex_1] + 1 < 0 && spellInfo_2->EffectBasePoints[effIndex_2] + 1 < 0) return -diff;
393  else return diff;
394 }
ACE_INT32 int32
Definition: Define.h:67
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:729
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
DiminishingGroup GetDiminishingReturnsGroupForSpell ( SpellEntry const *  spellproto,
bool  triggered 
)

Definition at line 3038 of file SpellMgr.cpp.

References SpellEntry::Attributes, DIMINISHING_BANISH, DIMINISHING_BLIND_CYCLONE, DIMINISHING_CONTROLLED_ROOT, DIMINISHING_CONTROLLED_STUN, DIMINISHING_DISARM, DIMINISHING_DISORIENT, DIMINISHING_ENTRAPMENT, DIMINISHING_FEAR, DIMINISHING_FREEZE, DIMINISHING_HORROR, DIMINISHING_KIDNEYSHOT, DIMINISHING_LIMITONLY, DIMINISHING_MIND_CONTROL, DIMINISHING_NONE, DIMINISHING_ROOT, DIMINISHING_SILENCE, DIMINISHING_SLEEP, DIMINISHING_STUN, SpellEntry::GetAllEffectsMechanicMask(), SpellEntry::Id, IsPositiveSpell(), MECHANIC_BANISH, MECHANIC_CHARM, MECHANIC_DISARM, MECHANIC_FEAR, MECHANIC_FREEZE, MECHANIC_HORROR, MECHANIC_KNOCKOUT, MECHANIC_POLYMORPH, MECHANIC_ROOT, MECHANIC_SAPPED, MECHANIC_SHACKLE, MECHANIC_SLEEP, MECHANIC_STUN, SPELLFAMILY_DRUID, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_UNK1, SPELLFAMILY_WARLOCK, SPELLFAMILY_WARRIOR, SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, SpellEntry::SpellIconID, and SpellEntry::SpellVisual.

Referenced by Spell::DoSpellHitOnUnit(), GetDispelMask(), and Spell::handle_immediate().

3039 {
3040  if (!spellproto || IsPositiveSpell(spellproto->Id))
3041  return DIMINISHING_NONE;
3042 
3043  // Explicit Diminishing Groups
3044  switch (spellproto->SpellFamilyName)
3045  {
3046  // Event + General spells
3047  case SPELLFAMILY_UNK1:
3048  return DIMINISHING_NONE;
3049  case SPELLFAMILY_MAGE:
3050  {
3051  // Item "Magic Dust" shouldn't be limited in PvP and
3052  // does not share DR with other sleep mechanics.
3053  if (spellproto->SpellIconID == 44)
3054  return DIMINISHING_NONE;
3055  break;
3056  // Frost Nova / Freeze (Water Elemental)
3057  if (spellproto->SpellIconID == 193)
3059  break;
3060  }
3061  case SPELLFAMILY_WARRIOR:
3062  {
3063  // Hamstring - limit duration to 10s in PvP
3064  if (spellproto->SpellFamilyFlags & 0x00000000002LL)
3065  return DIMINISHING_LIMITONLY;
3066  break;
3067  }
3068  case SPELLFAMILY_WARLOCK:
3069  {
3070  // Death Coil
3071  if (spellproto->SpellFamilyFlags & 0x00000080000LL)
3072  return DIMINISHING_HORROR;
3073  // Seduction
3074  else if (spellproto->SpellFamilyFlags & 0x00040000000LL)
3075  return DIMINISHING_FEAR;
3076  // Curses/etc
3077  else if (spellproto->SpellFamilyFlags & 0x00080000000LL)
3078  return DIMINISHING_LIMITONLY;
3079  // Unstable affliction dispel silence
3080  else if (spellproto->Id == 31117)
3081  return DIMINISHING_SILENCE;
3082  break;
3083  }
3084  case SPELLFAMILY_DRUID:
3085  {
3086  // Cyclone
3087  if (spellproto->SpellFamilyFlags & 0x02000000000LL)
3089  // Nature's Grasp trigger
3090  if (spellproto->SpellFamilyFlags & 0x00000000200LL && spellproto->Attributes == 0x49010000)
3092  break;
3093  }
3094  case SPELLFAMILY_ROGUE:
3095  {
3096  // Kidney Shot
3097  if (spellproto->SpellFamilyFlags & 0x00000200000LL)
3098  return DIMINISHING_KIDNEYSHOT;
3099  // Gouge
3100  else if (spellproto->SpellFamilyFlags & 0x00000000008LL)
3101  return DIMINISHING_DISORIENT;
3102  // Blind
3103  else if (spellproto->SpellFamilyFlags & 0x00001000000LL)
3105  break;
3106  }
3107  case SPELLFAMILY_HUNTER:
3108  {
3109  // Freezing trap
3110  if (spellproto->SpellFamilyFlags & 0x00000000008LL)
3111  return DIMINISHING_FREEZE;
3112  // Intimidation
3113  else if (spellproto->Id == 24394)
3115  // Entrapment (own diminishing)
3116  else if (spellproto->SpellVisual == 7484 && spellproto->SpellIconID == 20)
3117  return DIMINISHING_ENTRAPMENT;
3118  break;
3119  }
3120  case SPELLFAMILY_PALADIN:
3121  {
3122  // Turn Evil shared diminishing with fear
3123  if (spellproto->Id == 10326)
3124  return DIMINISHING_FEAR;
3125  break;
3126  }
3127  default:
3128  {
3129  if (spellproto->Id == 12494) // frostbite
3130  return DIMINISHING_ROOT;
3131  break;
3132  }
3133  }
3134 
3135  // Lastly - Set diminishing depending on mechanic
3136  uint32 mechanic = spellproto->GetAllEffectsMechanicMask();
3137  if (mechanic & (1 << MECHANIC_CHARM))
3138  return DIMINISHING_MIND_CONTROL;
3139  if (mechanic & (1 << MECHANIC_SLEEP))
3140  return DIMINISHING_SLEEP;
3141  if (mechanic & ((1 << MECHANIC_SAPPED) | (1 << MECHANIC_POLYMORPH) | (1 << MECHANIC_SHACKLE)))
3142  return DIMINISHING_DISORIENT;
3143  if (mechanic & (1 << MECHANIC_KNOCKOUT))
3144  return DIMINISHING_DISORIENT;
3145  if (mechanic & (1 << MECHANIC_DISARM))
3146  return DIMINISHING_DISARM;
3147  if (mechanic & (1 << MECHANIC_FEAR))
3148  return DIMINISHING_FEAR;
3149  if (mechanic & (1 << MECHANIC_STUN))
3150  return triggered ? DIMINISHING_STUN : DIMINISHING_CONTROLLED_STUN;
3151  if (mechanic & (1 << MECHANIC_BANISH))
3152  return DIMINISHING_BANISH;
3153  if (mechanic & (1 << MECHANIC_ROOT))
3154  return triggered ? DIMINISHING_ROOT : DIMINISHING_CONTROLLED_ROOT;
3155  if (mechanic & (1 << MECHANIC_FREEZE))
3156  return DIMINISHING_FREEZE;
3157  if (mechanic & (1 << MECHANIC_HORROR))
3158  return DIMINISHING_HORROR;
3159 
3160  return DIMINISHING_NONE;
3161 }
bool IsPositiveSpell(uint32 spellId)
Definition: SpellMgr.cpp:773
ACE_UINT32 uint32
Definition: Define.h:71
DiminishingReturnsType GetDiminishingReturnsGroupType ( DiminishingGroup  group)

Definition at line 3188 of file SpellMgr.cpp.

References DIMINISHING_BANISH, DIMINISHING_BLIND_CYCLONE, DIMINISHING_CONTROLLED_ROOT, DIMINISHING_CONTROLLED_STUN, DIMINISHING_DISARM, DIMINISHING_DISORIENT, DIMINISHING_FEAR, DIMINISHING_FREEZE, DIMINISHING_HORROR, DIMINISHING_KIDNEYSHOT, DIMINISHING_MIND_CONTROL, DIMINISHING_ROOT, DIMINISHING_SILENCE, DIMINISHING_SLEEP, DIMINISHING_STUN, DIMINISHING_WARLOCK_FEAR, DRTYPE_ALL, DRTYPE_NONE, and DRTYPE_PLAYER.

Referenced by Unit::ApplyDiminishingToDuration(), Spell::DoSpellHitOnUnit(), and GetDispelMask().

3189 {
3190  switch (group)
3191  {
3194  case DIMINISHING_STUN:
3196  return DRTYPE_ALL;
3197  case DIMINISHING_SLEEP:
3199  case DIMINISHING_ROOT:
3200  case DIMINISHING_FEAR:
3202  case DIMINISHING_DISORIENT:
3203  case DIMINISHING_DISARM:
3204  case DIMINISHING_HORROR:
3205  case DIMINISHING_FREEZE:
3206  case DIMINISHING_BANISH:
3208  case DIMINISHING_SILENCE:
3209  return DRTYPE_PLAYER;
3210  default:
3211  break;
3212  }
3213 
3214  return DRTYPE_NONE;
3215 }
uint32 GetDispelMask ( DispelType  dispel)
inline
Mechanics GetEffectMechanic ( SpellEntry const *  spellInfo,
int32  effect 
)
inline

Definition at line 496 of file SpellMgr.h.

References SpellEntry::EffectMechanic, SpellEntry::Mechanic, and MECHANIC_NONE.

Referenced by Unit::CalculateSpellDuration(), Unit::GetMechanicResistChance(), and Unit::SpellDamageBonus().

497 {
498  if (spellInfo->EffectMechanic[effect])
499  return Mechanics(spellInfo->EffectMechanic[effect]);
500  if (spellInfo->Mechanic)
501  return Mechanics(spellInfo->Mechanic);
502  return MECHANIC_NONE;
503 }
Mechanics
SpellCastResult GetErrorAtShapeshiftedCast ( SpellEntry const *  spellInfo,
uint32  form 
)

Definition at line 842 of file SpellMgr.cpp.

References SpellEntry::Attributes, SpellEntry::AttributesEx2, SpellEntry::Effect, SpellShapeshiftEntry::flags1, GetTalentSpellCost(), SpellEntry::Id, sLog, SPELL_ATTR0_NOT_SHAPESHIFT, SPELL_ATTR2_NOT_NEED_SHAPESHIFT, SPELL_CAST_OK, SPELL_EFFECT_LEARN_SPELL, SPELL_FAILED_NOT_SHAPESHIFT, SPELL_FAILED_ONLY_SHAPESHIFT, sSpellShapeshiftStore, SpellEntry::Stances, and SpellEntry::StancesNot.

Referenced by Player::ApplyEquipSpell(), Spell::CheckCast(), and IsAutoRepeatRangedSpell().

843 {
844  // talents that learn spells can have stance requirements that need ignore
845  // (this requirement only for client-side stance show in talent description)
846  if (GetTalentSpellCost(spellInfo->Id) > 0 &&
847  (spellInfo->Effect[0] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[1] == SPELL_EFFECT_LEARN_SPELL || spellInfo->Effect[2] == SPELL_EFFECT_LEARN_SPELL))
848  return SPELL_CAST_OK;
849 
850  uint32 stanceMask = (form ? 1 << (form - 1) : 0);
851 
852  if (stanceMask & spellInfo->StancesNot) // can explicitly not be casted in this stance
854 
855  if (stanceMask & spellInfo->Stances) // can explicitly be casted in this stance
856  return SPELL_CAST_OK;
857 
858  bool actAsShifted = false;
859  if (form > 0)
860  {
861  SpellShapeshiftEntry const* shapeInfo = sSpellShapeshiftStore.LookupEntry(form);
862  if (!shapeInfo)
863  {
864  sLog.outError("GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
865  return SPELL_CAST_OK;
866  }
867  actAsShifted = !(shapeInfo->flags1 & 1); // shapeshift acts as normal form for spells
868  }
869 
870  if (actAsShifted)
871  {
872  if (spellInfo->Attributes & SPELL_ATTR0_NOT_SHAPESHIFT) // not while shapeshifted
874  else if (spellInfo->Stances != 0) // needs other shapeshift
876  }
877  else
878  {
879  // needs shapeshift
880  if (!(spellInfo->AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && spellInfo->Stances != 0)
882  }
883 
884  return SPELL_CAST_OK;
885 }
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 GetTalentSpellCost(uint32 spellId)
Definition: DBCStores.cpp:598
ACE_UINT32 uint32
Definition: Define.h:71
DBCStorage< SpellShapeshiftEntry > sSpellShapeshiftStore(SpellShapeshiftfmt)
uint32 GetSpellCastTime ( SpellEntry const *  spellInfo,
Spell const *  spell = NULL 
)

Definition at line 248 of file SpellMgr.cpp.

References SpellEntry::Attributes, SpellEntry::CastingTimeIndex, SpellCastTimesEntry::CastTime, Spell::GetCaster(), Object::GetFloatValue(), Unit::GetSpellModOwner(), SpellEntry::Id, Spell::IsAutoRepeat(), Spell::IsRangedSpell(), Unit::m_modAttackSpeedPct, RANGED_ATTACK, SPELL_ATTR0_ABILITY, SPELL_ATTR0_RANGED, SPELL_ATTR0_TRADESPELL, SPELLMOD_CASTING_TIME, sSpellCastTimesStore, and UNIT_MOD_CAST_SPEED.

Referenced by GameObject::CastSpell(), Unit::GetCastingTimeForBonus(), GetSpellRadiusForFriend(), Totem::InitStats(), Spell::prepare(), Unit::ProcDamageAndSpellFor(), Unit::SpellDamageBonus(), and Unit::SpellHealingBonus().

249 {
250  SpellCastTimesEntry const* spellCastTimeEntry = sSpellCastTimesStore.LookupEntry(spellInfo->CastingTimeIndex);
251 
252  // not all spells have cast time index and this is all is pasiive abilities
253  if (!spellCastTimeEntry)
254  return 0;
255 
256  int32 castTime = spellCastTimeEntry->CastTime;
257 
258  if (spell)
259  {
260  if (Player* modOwner = spell->GetCaster()->GetSpellModOwner())
261  modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_CASTING_TIME, castTime, spell);
262 
263  if (!(spellInfo->Attributes & (SPELL_ATTR0_ABILITY | SPELL_ATTR0_TRADESPELL)))
264  castTime = int32(castTime * spell->GetCaster()->GetFloatValue(UNIT_MOD_CAST_SPEED));
265  else
266  {
267  if (spell->IsRangedSpell() && !spell->IsAutoRepeat())
268  castTime = int32(castTime * spell->GetCaster()->m_modAttackSpeedPct[RANGED_ATTACK]);
269  }
270  }
271 
272  if (spellInfo->Attributes & SPELL_ATTR0_RANGED && (!spell || !spell->IsAutoRepeat()))
273  castTime += 500;
274 
275  return (castTime > 0) ? uint32(castTime) : 0;
276 }
DBCStorage< SpellCastTimesEntry > sSpellCastTimesStore(SpellCastTimefmt)
ACE_INT32 int32
Definition: Define.h:67
Player * GetSpellModOwner() const
Definition: Unit.cpp:11748
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Player.h:922
int32 GetSpellMaxDuration ( SpellEntry const *  spellInfo)

Definition at line 238 of file SpellMgr.cpp.

References SpellDurationEntry::Duration, SpellEntry::DurationIndex, and sSpellDurationStore.

Referenced by Unit::CalculateSpellDuration(), and GetSpellRecoveryTime().

239 {
240  if (!spellInfo)
241  return 0;
242  SpellDurationEntry const* du = sSpellDurationStore.LookupEntry(spellInfo->DurationIndex);
243  if (!du)
244  return 0;
245  return (du->Duration[2] == -1) ? -1 : abs(du->Duration[2]);
246 }
DBCStorage< SpellDurationEntry > sSpellDurationStore(SpellDurationfmt)
float GetSpellMaxRange ( SpellEntry const *  spellInfo)
inline

Definition at line 183 of file SpellMgr.h.

References GetSpellMaxRange(), SpellEntry::rangeIndex, and sSpellRangeStore.

184 {
185  return GetSpellMaxRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
186 }
DBCStorage< SpellRangeEntry > sSpellRangeStore(SpellRangefmt)
float GetSpellMaxRange(SpellRangeEntry const *range)
Definition: SpellMgr.h:143
float GetSpellMaxRange ( uint32  id)
inline

Definition at line 200 of file SpellMgr.h.

References GetSpellMaxRange(), and GetSpellStore().

201 {
202  SpellEntry const* spellInfo = GetSpellStore()->LookupEntry(id);
203  if (!spellInfo) return 0;
204  return GetSpellMaxRange(spellInfo);
205 }
DBCStorage< SpellEntry > const * GetSpellStore()
Definition: DBCStores.cpp:776
float GetSpellMaxRange(SpellRangeEntry const *range)
Definition: SpellMgr.h:143
uint32 GetSpellMechanicMask ( SpellEntry const *  spellInfo,
int32  effect 
)
inline

Definition at line 486 of file SpellMgr.h.

References SpellEntry::EffectMechanic, and SpellEntry::Mechanic.

Referenced by Spell::CheckCasterAuras(), Spell::EffectScriptEffect(), Aura::HandleAuraModDispelImmunity(), and Aura::HandleModMechanicImmunity().

487 {
488  uint32 mask = 0;
489  if (spellInfo->Mechanic)
490  mask |= 1 << spellInfo->Mechanic;
491  if (spellInfo->EffectMechanic[effect])
492  mask |= 1 << spellInfo->EffectMechanic[effect];
493  return mask;
494 }
ACE_UINT32 uint32
Definition: Define.h:71
float GetSpellMinRange ( SpellRangeEntry const *  range)
inline

Definition at line 139 of file SpellMgr.h.

References SpellRangeEntry::minRange.

Referenced by Spell::CheckRange(), Spell::EffectTransmitted(), GetSpellMinRange(), Creature::reachWithSpellAttack(), Creature::reachWithSpellCure(), and Spell::SetTargetMap().

140 {
141  return (range ? range->minRange : 0);
142 }
float GetSpellMinRange ( SpellEntry const *  spellInfo)
inline

Definition at line 188 of file SpellMgr.h.

References GetSpellMinRange(), SpellEntry::rangeIndex, and sSpellRangeStore.

189 {
190  return GetSpellMinRange(sSpellRangeStore.LookupEntry(spellInfo->rangeIndex));
191 }
float GetSpellMinRange(SpellRangeEntry const *range)
Definition: SpellMgr.h:139
DBCStorage< SpellRangeEntry > sSpellRangeStore(SpellRangefmt)
float GetSpellMinRange ( uint32  id)
inline

Definition at line 193 of file SpellMgr.h.

References GetSpellMinRange(), and GetSpellStore().

194 {
195  SpellEntry const* spellInfo = GetSpellStore()->LookupEntry(id);
196  if (!spellInfo) return 0;
197  return GetSpellMinRange(spellInfo);
198 }
DBCStorage< SpellEntry > const * GetSpellStore()
Definition: DBCStores.cpp:776
float GetSpellMinRange(SpellRangeEntry const *range)
Definition: SpellMgr.h:139
float GetSpellRadius ( SpellEntry const *  spellInfo,
uint32  effectIdx,
bool  positive 
)
inline

Definition at line 176 of file SpellMgr.h.

References SpellEntry::EffectRadiusIndex, GetSpellRadiusForFriend(), GetSpellRadiusForHostile(), and sSpellRadiusStore.

Referenced by AreaAura::AreaAura(), Spell::EffectAddFarsight(), Spell::EffectDummy(), Spell::EffectMomentMove(), Spell::EffectPersistentAA(), Spell::EffectScriptEffect(), Spell::EffectTeleUnitsFaceCaster(), Spell::EffectTransmitted(), Unit::HandleMendingAuraProc(), Spell::SetTargetMap(), Spell::SpellDamageSchoolDmg(), Spell::SummonClassPet(), Aura::Update(), and GameObject::Update().

177 {
178  return positive
179  ? GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(spellInfo->EffectRadiusIndex[effectIdx]))
180  : GetSpellRadiusForHostile(sSpellRadiusStore.LookupEntry(spellInfo->EffectRadiusIndex[effectIdx]));
181 }
float GetSpellRadiusForHostile(SpellRadiusEntry const *radius)
Definition: SpellMgr.h:130
float GetSpellRadiusForFriend(SpellRadiusEntry const *radius)
Definition: SpellMgr.h:134
DBCStorage< SpellRadiusEntry > sSpellRadiusStore(SpellRadiusfmt)
float GetSpellRadiusForFriend ( SpellRadiusEntry const *  radius)
inline

Definition at line 134 of file SpellMgr.h.

References GetSpellCastTime(), and SpellRadiusEntry::radiusFriend.

Referenced by GetSpellRadius().

135 {
136  return (radius ? radius->radiusFriend : 0);
137 }
float GetSpellRadiusForHostile ( SpellRadiusEntry const *  radius)
inline

Definition at line 130 of file SpellMgr.h.

References SpellRadiusEntry::radiusHostile.

Referenced by GetSpellRadius().

131 {
132  return (radius ? radius->radiusHostile : 0);
133 }
uint32 GetSpellRangeType ( SpellRangeEntry const *  range)
inline

Definition at line 147 of file SpellMgr.h.

References SpellRangeEntry::type.

Referenced by Spell::CheckRange().

148 {
149  return (range ? range->type : 0);
150 }
uint32 GetSpellRecoveryTime ( SpellEntry const *  spellInfo)
inline

Definition at line 151 of file SpellMgr.h.

References SpellEntry::CategoryRecoveryTime, GetSpellDuration(), GetSpellMaxDuration(), and SpellEntry::RecoveryTime.

Referenced by Creature::AddCreatureSpellCooldown(), Spell::CheckCast(), Spell::EffectDummy(), Player::SendCooldownEvent(), and PetAI::UpdateAI().

152 {
153  return spellInfo->RecoveryTime > spellInfo->CategoryRecoveryTime ? spellInfo->RecoveryTime : spellInfo->CategoryRecoveryTime;
154 }
SpellSpecific GetSpellSpecific ( uint32  spellId)

Definition at line 396 of file SpellMgr.cpp.

References SpellEntry::activeIconID, SpellEntry::Attributes, SpellEntry::AttributesEx3, AURA_INTERRUPT_FLAG_NOT_SEATED, SpellEntry::AuraInterruptFlags, SpellEntry::Dispel, DISPEL_CURSE, DISPEL_POISON, SpellEntry::Effect, SpellEntry::EffectApplyAuraName, GetSpellSchoolMask(), SpellEntry::Id, IsElementalShield(), IsSealSpell(), MAX_SPELL_EFFECTS, SPELL_AURA_MOD_CHARM, SPELL_AURA_MOD_CONFUSE, SPELL_AURA_MOD_POSSESS, SPELL_AURA_MOD_POSSESS_PET, SPELL_AURA_MOD_POWER_REGEN, SPELL_AURA_MOD_REGEN, SPELL_AURA_OBS_MOD_HEALTH, SPELL_AURA_TRACK_CREATURES, SPELL_AURA_TRACK_RESOURCES, SPELL_AURA_TRACK_STEALTHED, SPELL_EFFECT_APPLY_AREA_AURA_PARTY, SPELL_EFFECT_APPLY_AURA, SPELL_SCHOOL_MASK_NATURE, SPELL_SPECIFIC_ARMOR_REDUCE, SPELL_SPECIFIC_ASPECT, SPELL_SPECIFIC_AURA, SPELL_SPECIFIC_CHARM, SPELL_SPECIFIC_CURSE, SPELL_SPECIFIC_DRINK, SPELL_SPECIFIC_ELEMENTAL_SHIELD, SPELL_SPECIFIC_FOOD, SPELL_SPECIFIC_JUDGEMENT, SPELL_SPECIFIC_MAGE_ARMOR, SPELL_SPECIFIC_MAGE_POLYMORPH, SPELL_SPECIFIC_NORMAL, SPELL_SPECIFIC_SEAL, SPELL_SPECIFIC_STING, SPELL_SPECIFIC_TRACKER, SPELL_SPECIFIC_WARLOCK_ARMOR, SPELL_SPECIFIC_WARLOCK_CORRUPTION, SPELL_SPECIFIC_WARRIOR_ENRAGE, SPELLFAMILY_GENERIC, SPELLFAMILY_HUNTER, SPELLFAMILY_MAGE, SPELLFAMILY_PALADIN, SPELLFAMILY_ROGUE, SPELLFAMILY_SHAMAN, SPELLFAMILY_WARLOCK, SPELLFAMILY_WARRIOR, SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, SpellEntry::SpellIconID, SpellEntry::SpellVisual, and sSpellStore.

Referenced by SpellMgr::IsNoStackSpellDueToSpell(), Unit::IsPolymorphed(), IsSingleTargetSpell(), and IsSingleTargetSpells().

397 {
398  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
399  if (!spellInfo)
400  return SPELL_SPECIFIC_NORMAL;
401 
402  switch (spellInfo->SpellFamilyName)
403  {
404  case SPELLFAMILY_GENERIC:
405  {
406  // Food / Drinks (mostly)
408  {
409  for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
410  {
411  if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POWER_REGEN)
412  return SPELL_SPECIFIC_DRINK;
413 
414  if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_REGEN ||
416  return SPELL_SPECIFIC_FOOD;
417  }
418  }
419 
420  switch (spellInfo->Id)
421  {
422  case 12880: // warrior's Enrage rank 1
423  case 14201: // Enrage rank 2
424  case 14202: // Enrage rank 3
425  case 14203: // Enrage rank 4
426  case 14204: // Enrage rank 5
427  case 12292: // Death Wish
429  break;
430  default:
431  break;
432  }
433  break;
434  }
435  case SPELLFAMILY_MAGE:
436  {
437  // family flags 18(Molten), 25(Frost/Ice), 28(Mage)
438  if (spellInfo->SpellFamilyFlags & 0x12040000)
440 
441  if ((spellInfo->SpellFamilyFlags & 0x1000000) && spellInfo->EffectApplyAuraName[0] == SPELL_AURA_MOD_CONFUSE)
443 
444  break;
445  }
446  case SPELLFAMILY_WARRIOR:
447  {
448  // Sunder Armor (vs Expose Armor)
449  if (spellInfo->SpellFamilyFlags & 0x00000000004000LL)
451 
452  break;
453  }
454  case SPELLFAMILY_WARLOCK:
455  {
456  // only warlock curses have this
457  if (spellInfo->Dispel == DISPEL_CURSE)
458  return SPELL_SPECIFIC_CURSE;
459 
460  // family flag 37 (only part spells have family name)
461  if (spellInfo->SpellFamilyFlags & 0x2000000000LL)
463 
464  //seed of corruption and corruption
465  if (spellInfo->SpellFamilyFlags & 0x1000000002LL)
467  break;
468  }
469  case SPELLFAMILY_HUNTER:
470  {
471  // only hunter stings have this
472  if (spellInfo->Dispel == DISPEL_POISON)
473  return SPELL_SPECIFIC_STING;
474 
475  break;
476  }
477  case SPELLFAMILY_PALADIN:
478  {
479  if (IsSealSpell(spellInfo))
480  return SPELL_SPECIFIC_SEAL;
481 
482  if ((spellInfo->SpellFamilyFlags & 0x00000820180400LL) && (spellInfo->AttributesEx3 & 0x200))
484 
485  for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
486  {
487  // only paladin auras have this
488  if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AREA_AURA_PARTY)
489  return SPELL_SPECIFIC_AURA;
490  }
491  break;
492  }
493  case SPELLFAMILY_SHAMAN:
494  {
495  if (IsElementalShield(spellInfo))
497 
498  break;
499  }
500  case SPELLFAMILY_ROGUE:
501  {
502  // Expose Armor (vs Sunder Armor)
503  if (spellInfo->SpellFamilyFlags & 0x00000000080000LL)
505  break;
506  }
507  }
508 
509  // only warlock armor/skin have this (in additional to family cases)
510  if (spellInfo->SpellVisual == 130 && spellInfo->SpellIconID == 89)
512 
513  // only hunter aspects have this (but not all aspects in hunter family)
514  if (spellInfo->activeIconID == 122 && (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_NATURE) &&
515  (spellInfo->Attributes & 0x50000) != 0 && (spellInfo->Attributes & 0x9000010) == 0)
516  return SPELL_SPECIFIC_ASPECT;
517 
518  for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
519  {
520  if (spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA)
521  {
522  switch (spellInfo->EffectApplyAuraName[i])
523  {
527  return SPELL_SPECIFIC_CHARM;
531  return SPELL_SPECIFIC_TRACKER;
532  }
533  }
534  }
535 
536  return SPELL_SPECIFIC_NORMAL;
537 }
uint32 AuraInterruptFlags
Definition: DBCStructure.h:700
uint32 SpellVisual
Definition: DBCStructure.h:743
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
SpellSchoolMask GetSpellSchoolMask(SpellEntry const *spellInfo)
Definition: SpellMgr.h:481
uint32 Attributes
Definition: DBCStructure.h:679
uint32 Dispel
Definition: DBCStructure.h:677
uint32 AttributesEx3
Definition: DBCStructure.h:682
uint64 SpellFamilyFlags
Definition: DBCStructure.h:761
uint32 SpellIconID
Definition: DBCStructure.h:745
bool IsSealSpell(SpellEntry const *spellInfo)
Definition: SpellMgr.h:215
bool IsElementalShield(SpellEntry const *spellInfo)
Definition: SpellMgr.h:223
uint32 SpellFamilyName
Definition: DBCStructure.h:760
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
uint32 activeIconID
Definition: DBCStructure.h:746
bool IsAreaOfEffectSpell ( SpellEntry const *  spellInfo)
inline

Definition at line 404 of file SpellMgr.h.

References EFFECT_0, EFFECT_1, EFFECT_2, SpellEntry::EffectImplicitTargetA, SpellEntry::EffectImplicitTargetB, and IsAreaEffectTarget.

Referenced by Spell::CheckCast(), Unit::MagicSpellHitResult(), Unit::RemoveAura(), and Aura::Update().

405 {
406  if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[EFFECT_0]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[EFFECT_0]])
407  return true;
408  if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[EFFECT_1]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[EFFECT_1]])
409  return true;
410  if (IsAreaEffectTarget[spellInfo->EffectImplicitTargetA[EFFECT_2]] || IsAreaEffectTarget[spellInfo->EffectImplicitTargetB[EFFECT_2]])
411  return true;
412  return false;
413 }
bool IsAreaEffectTarget[TOTAL_SPELL_TARGETS]
Definition: SpellMgr.cpp:28
bool IsAuraAddedBySpell ( uint32  auraType,
uint32  spellId 
)

Definition at line 831 of file SpellMgr.cpp.

References SpellEntry::EffectApplyAuraName, MAX_SPELL_EFFECTS, and sSpellStore.

Referenced by IsBinarySpell().

832 {
833  SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId);
834  if (!spellproto) return false;
835 
836  for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
837  if (spellproto->EffectApplyAuraName[i] == auraType)
838  return true;
839  return false;
840 }
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
bool IsAutocastableSpell ( uint32  spellId)

Definition at line 291 of file SpellMgr.cpp.

References SpellEntry::Attributes, SpellEntry::AttributesEx, SPELL_ATTR0_PASSIVE, SPELL_ATTR1_UNAUTOCASTABLE_BY_PET, and sSpellStore.

Referenced by Pet::addSpell(), WorldSession::HandlePetSpellAutocastOpcode(), IsDeathOnlySpell(), Pet::LoadPetFromDB(), and Pet::ToggleAutocast().

292 {
293  SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
294  if (!spellInfo)
295  return false;
296  if (spellInfo->Attributes & SPELL_ATTR0_PASSIVE)
297  return false;
299  return false;
300  return true;
301 }
uint32 AttributesEx
Definition: DBCStructure.h:680
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 Attributes
Definition: DBCStructure.h:679
bool IsAutoRepeatRangedSpell ( SpellEntry const *  spellInfo)
inline
bool IsBinarySpell ( SpellEntry const *  spellInfo)
inline

Definition at line 327 of file SpellMgr.h.

References Spell::damage, SpellEntry::Effect, EFFECT_0, SpellEntry::EffectApplyAuraName, SpellEntry::EffectImplicitTargetA, SpellEntry::EffectImplicitTargetB, SpellEntry::EffectMechanic, IsAreaEffectTarget, IsAuraAddedBySpell(), IsSpellAllowedInLocation(), IsSpellEffectTriggerSpell(), MAX_SPELL_EFFECTS, SPELL_EFFECT_ENVIRONMENTAL_DAMAGE, SPELL_EFFECT_HEALTH_LEECH, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_EFFECT_WEAPON_DAMAGE, SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL, SPELL_EFFECT_WEAPON_PERCENT_DAMAGE, and TOTAL_SPELL_TARGETS.

Referenced by Unit::CalculateSpellDamageTaken(), and Unit::MagicSpellHitResult().

328 {
329  // Spell is considered binary if:
330  // * Its composed entirely out of non-damage and aura effects (Example: Mind Flay, Vampiric Embrace, DoTs, etc)
331  // * Has damage and non-damage effects with additional mechanics (Example: Death Coil, Frost Nova)
332  uint32 effectmask = 0; // A bitmask of effects: set bits are valid effects
333  uint32 nondmgmask = 0; // A bitmask of effects: set bits are non-damage effects
334  uint32 mechmask = 0; // A bitmask of effects: set bits are non-damage effects with additional mechanics
335  for (uint32 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
336  {
337  if (!spellInfo->Effect[i] || IsSpellEffectTriggerSpell(spellInfo, SpellEffIndex(i)))
338  continue;
339 
340  effectmask |= (1 << i);
341 
342  bool damage = false;
343  if (!spellInfo->EffectApplyAuraName[i])
344  {
345  // If its not an aura effect, check for damage effects
346  switch (spellInfo->Effect[i])
347  {
354  // SPELL_EFFECT_POWER_BURN: deals damage for power burned, but its either full damage or resist?
356  damage = true;
357  break;
358  }
359  }
360  if (!damage)
361  {
362  nondmgmask |= (1 << i);
363  if (spellInfo->EffectMechanic[i])
364  mechmask |= (1 << i);
365  }
366  }
367  // No non-damage involved at all: assumed all effects which should be rolled separately or no effects
368  if (!effectmask || !nondmgmask)
369  return false;
370  // All effects are non-damage
371  if (nondmgmask == effectmask)
372  return true;
373  // No non-damage effects with additional mechanics
374  if (!mechmask)
375  return false;
376  // Binary spells execution order detection
377  for (uint32 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
378  {
379  // If effect is present and not a non-damage effect
380  const uint32 effect = (1 << i);
381  if ((effectmask & effect) && !(nondmgmask & effect))
382  {
383  // Iterate over mechanics
384  for (uint32 e = EFFECT_0; e < MAX_SPELL_EFFECTS; ++e)
385  {
386  // If effect is extra mechanic on the same target as damage effect
387  if ((mechmask & (1 << e)) &&
388  spellInfo->EffectImplicitTargetA[i] == spellInfo->EffectImplicitTargetA[e] &&
389  spellInfo->EffectImplicitTargetB[i] == spellInfo->EffectImplicitTargetB[e])
390  {
391  return (e > i); // Post-2.3: checks the order of application
392  }
393  }
394  }
395  }
396  return false;
397 }
bool IsSpellEffectTriggerSpell(const SpellEntry *entry, SpellEffIndex eff_idx)
Definition: SpellMgr.h:229
SpellEffIndex
Definition: SharedDefines.h:24
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT32 uint32
Definition: Define.h:71
bool IsDeathOnlySpell ( SpellEntry const *  spellInfo)
inline

Definition at line 287 of file SpellMgr.h.

References SpellEntry::AttributesEx3, CalculatePowerCost(), CompareAuraRanks(), SpellEntry::Id, IsAutocastableSpell(), IsPassiveSpell(), and SPELL_ATTR3_CAST_ON_DEAD.

Referenced by Spell::CheckCast().

288 {
289  return spellInfo->AttributesEx3 & SPELL_ATTR3_CAST_ON_DEAD
290  || spellInfo->Id == 2584;
291 }
bool IsDeathPersistentSpell ( SpellEntry const *  spellInfo)
inline

Definition at line 299 of file SpellMgr.h.

References SpellEntry::AttributesEx3, SpellEntry::Id, and SPELL_ATTR3_DEATH_PERSISTENT.

Referenced by Aura::Aura().

300 {
301  switch (spellInfo->Id)
302  {
303  case 40214: // Dragonmaw Illusion
304  case 35480:
305  case 35481:
306  case 35482: // Human Illusion
307  case 35483:
308  case 39824: // Human Illusion
309  return true;
310  }
311 
312  return spellInfo->AttributesEx3 & SPELL_ATTR3_DEATH_PERSISTENT;
313 }
bool IsDiminishingReturnsGroupDurationLimited ( DiminishingGroup  group)

Definition at line 3163 of file SpellMgr.cpp.

References DIMINISHING_BANISH, DIMINISHING_BLIND_CYCLONE, DIMINISHING_CONTROLLED_ROOT, DIMINISHING_CONTROLLED_STUN, DIMINISHING_DISORIENT, DIMINISHING_FEAR, DIMINISHING_FREEZE, DIMINISHING_KIDNEYSHOT, DIMINISHING_LIMITONLY, DIMINISHING_MIND_CONTROL, DIMINISHING_ROOT, DIMINISHING_SLEEP, DIMINISHING_STUN, and DIMINISHING_WARLOCK_FEAR.

Referenced by Unit::ApplyDiminishingToDuration(), and GetDispelMask().

bool IsDispel ( SpellEntry const *  spellInfo)
inline

Definition at line 442 of file SpellMgr.h.

References IsSpellHaveEffect(), SPELL_EFFECT_DISPEL, and SPELL_EFFECT_DISPEL_MECHANIC.

Referenced by Spell::CheckCast(), and IsDispelSpell().

443 {
444  //spellsteal is also dispel
445  return IsSpellHaveEffect(spellInfo, SPELL_EFFECT_DISPEL) ||
447 }
bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
Definition: SpellMgr.h:207
bool IsDispelSpell ( SpellEntry const *  spellInfo)
inline

Definition at line 448 of file SpellMgr.h.

References SpellEntry::Effect, IsDispel(), and SPELL_EFFECT_STEAL_BENEFICIAL_BUFF.

Referenced by Unit::MagicSpellHitResult().

449 {
450  //spellsteal is also dispel
451  if (spellInfo->Effect[0] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF ||
452  spellInfo->Effect[1] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF ||
453  spellInfo->Effect[2] == SPELL_EFFECT_STEAL_BENEFICIAL_BUFF
454  || IsDispel(spellInfo))
455  return true;
456  return false;
457 }
bool IsDispel(SpellEntry const *spellInfo)
Definition: SpellMgr.h:442
bool IsElementalShield ( SpellEntry const *  spellInfo)
inline

Definition at line 223 of file SpellMgr.h.

References SpellEntry::Id, and SpellEntry::SpellFamilyFlags.

Referenced by GetSpellSpecific().

224 {
225  // family flags 10 (Lightning), 42 (Earth), 37 (Water), proc shield from T2 8 pieces bonus
226  return (spellInfo->SpellFamilyFlags & 0x42000000400LL) || spellInfo->Id == 23552;
227 }
bool IsFarDestTargetEffect ( uint32  effect)
inline

Definition at line 427 of file SpellMgr.h.

References SPELL_EFFECT_TELEPORT_UNITS.

428 {
429  return (effect == SPELL_EFFECT_TELEPORT_UNITS);
430 }
bool IsFarUnitTargetEffect ( uint32  effect)
inline

Definition at line 415 of file SpellMgr.h.

References SPELL_EFFECT_RESURRECT_NEW, and SPELL_EFFECT_SUMMON_PLAYER.

Referenced by Spell::DoAllEffectOnTarget().

416 {
417  switch (effect)
418  {
421  return true;
422  }
423 
424  return false;
425 }
bool IsPassiveSpell ( SpellEntry const *  spellInfo)

Definition at line 286 of file SpellMgr.cpp.

References SpellEntry::Attributes, and SPELL_ATTR0_PASSIVE.

287 {
288  return (spellInfo->Attributes & SPELL_ATTR0_PASSIVE) != 0;
289 }
bool IsPositiveEffect ( uint32  spellId,
uint32  effIndex 
)

Definition at line 561 of file SpellMgr.cpp.

References SpellEntry::Attributes, SpellEntry::Effect, SpellEntry::EffectApplyAuraName, SpellEntry::EffectBaseDice, SpellEntry::EffectBasePoints, SpellEntry::EffectImplicitTargetA, SpellEntry::EffectImplicitTargetB, SpellEntry::EffectMiscValue, SpellEntry::EffectTriggerSpell, SpellEntry::Id, IsPositiveEffect(), IsPositiveTarget(), MAX_SPELL_EFFECTS, SpellEntry::Mechanic, MECHANIC_BANDAGE, MECHANIC_IMMUNE_SHIELD, MECHANIC_INVULNERABILITY, MECHANIC_MOUNT, MECHANIC_SHIELD, SPELL_ATTR0_NEGATIVE_1, SPELL_AURA_ADD_FLAT_MODIFIER, SPELL_AURA_ADD_PCT_MODIFIER, SPELL_AURA_ADD_TARGET_TRIGGER, SPELL_AURA_GHOST, SPELL_AURA_MECHANIC_IMMUNITY, SPELL_AURA_MOD_DAMAGE_DONE, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, SPELL_AURA_MOD_DAMAGE_TAKEN, SPELL_AURA_MOD_DECREASE_SPEED, SPELL_AURA_MOD_DODGE_PERCENT, SPELL_AURA_MOD_HEALING_DONE, SPELL_AURA_MOD_HEALING_PCT, SPELL_AURA_MOD_PACIFY_SILENCE, SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_SILENCE, SPELL_AURA_MOD_SKILL, SPELL_AURA_MOD_SPELL_CRIT_CHANCE, SPELL_AURA_MOD_STALKED, SPELL_AURA_MOD_STAT, SPELL_AURA_MOD_STUN, SPELL_AURA_PERIODIC_DAMAGE, SPELL_AURA_PERIODIC_DAMAGE_PERCENT, SPELL_AURA_PERIODIC_LEECH, SPELL_AURA_PERIODIC_TRIGGER_SPELL, SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE, SPELL_AURA_PROC_TRIGGER_SPELL, SPELL_EFFECT_APPLY_AREA_AURA_ENEMY, SPELL_EFFECT_APPLY_AREA_AURA_FRIEND, SPELL_EFFECT_APPLY_AURA, SPELL_EFFECT_ENERGIZE_PCT, SPELL_EFFECT_HEAL, SPELL_EFFECT_HEAL_PCT, SPELL_EFFECT_LEARN_SPELL, SPELL_EFFECT_SKILL_STEP, SPELLFAMILY_GENERIC, SPELLFAMILY_MAGE, SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, SPELLMOD_COST, sSpellStore, and TARGET_UNIT_CASTER.

Referenced by Pet::_LoadAuras(), Player::_LoadAuras(), Aura::Aura(), Spell::CheckCast(), IsNonCombatSpell(), IsPositiveEffect(), IsPositiveSpell(), SpellMgr::SelectAuraRankForPlayerLevel(), and Spell::SetTargetMap().

562 {
563  SpellEntry const* spellproto = sSpellStore.LookupEntry(spellId);
564  if (!spellproto)
565  return false;
566 
567  // not found a single positive spell with this attribute
568  if (spellproto->Attributes & SPELL_ATTR0_NEGATIVE_1)
569  return false;
570 
571  switch (spellproto->SpellFamilyName)
572  {
573  case SPELLFAMILY_GENERIC:
574  switch (spellproto->Id)
575  {
576  case 6716: // Test of Faith
577  case 23333: // Warsong Flag
578  case 23335: // Silverwing Flag
579  case 34976: // Netherstorm Flag
580  return true;
581  case 1852: // Silenced (GM)
582  case 46392: // Focused Assault
583  case 46393: // Brutal Assault
584  case 43437: // Paralyzed
585  case 28441: // AB Effect 000
586  case 37675: // Chaos Blast
587  case 41519: // Mark of Stormrage
588  case 34877: // Custodian of Time
589  case 34700: // Allergic Reaction
590  case 31719: // Suspension
591  case 43501: // Siphon Soul (Hexlord Spell)
592  case 30457: // Complete vulnerability
593  case 30529: // Recently In Game - Chess Event
594  case 37465: // Rain of Fire
595  case 45661: // Encapsulate (Felmyst - Sunwell Plateau)
596  case 45662:
597  case 45665:
598  return false;
599  default:
600  break;
601  }
602  break;
603  case SPELLFAMILY_MAGE:
604  {
605  // Amplify Magic, Dampen Magic
606  if (spellproto->SpellFamilyFlags == 0x00002000)
607  return true;
608 
609  switch (spellproto->Id)
610  {
611  case 31579: // Arcane Empowerment Rank1 talent aura with one positive and one negative (check not needed in wotlk)
612  case 31582: // Arcane Empowerment Rank2
613  case 31583: // Arcane Empowerment Rank3
614  return true;
615  default:
616  break;
617  }
618  }
619  break;
620  default:
621  break;
622  }
623 
624  switch (spellproto->Mechanic)
625  {
627  return true;
628  default:
629  break;
630  }
631 
632  switch (spellproto->Effect[effIndex])
633  {
634  // always positive effects (check before target checks that provided non-positive result in some case for positive effects)
635  case SPELL_EFFECT_HEAL:
640  return true;
642  return false;
643 
644  // non-positive aura use
647  {
648  switch (spellproto->EffectApplyAuraName[effIndex])
649  {
650  case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative)
651  case SPELL_AURA_MOD_STAT:
657  if (spellproto->EffectBasePoints[effIndex] + int32(spellproto->EffectBaseDice[effIndex]) < 0)
658  return false;
659  break;
660  case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative)
661  if (spellproto->EffectBasePoints[effIndex] + int32(spellproto->EffectBaseDice[effIndex]) > 0)
662  return false;
663  break;
665  if (spellproto->EffectBasePoints[effIndex] + int32(spellproto->EffectBaseDice[effIndex]) > 0)
666  return true; // some expected positive spells have SPELL_ATTR1_NEGATIVE
667  break;
669  return true;
672  if (spellId != spellproto->EffectTriggerSpell[effIndex])
673  {
674  uint32 spellTriggeredId = spellproto->EffectTriggerSpell[effIndex];
675  SpellEntry const* spellTriggeredProto = sSpellStore.LookupEntry(spellTriggeredId);
676 
677  if (spellTriggeredProto)
678  {
679  // non-positive targets of main spell return early
680  for (int i = 0; i < MAX_SPELL_EFFECTS; ++i)
681  {
682  // if non-positive trigger cast targeted to positive target this main cast is non-positive
683  // this will place this spell auras as debuffs
684  if (!IsPositiveTarget(spellTriggeredProto->EffectImplicitTargetA[i], spellTriggeredProto->EffectImplicitTargetB[i]) && !IsPositiveEffect(spellTriggeredId, i))
685  return false;
686  }
687  }
688  }
689  break;
691  // many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example)
692  break;
693  case SPELL_AURA_MOD_STUN: //have positive and negative spells, we can't sort its correctly at this moment.
694  if (effIndex == 0 && spellproto->Effect[1] == 0 && spellproto->Effect[2] == 0)
695  return false; // but all single stun aura spells is negative
696  break;
698  if (spellproto->Id == 24740) // Wisp Costume
699  return true;
700  return false;
701  case SPELL_AURA_MOD_ROOT:
703  case SPELL_AURA_GHOST:
707  return false;
708  case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also.
709  // part of negative spell if casted at self (prevent cancel)
710  if (spellproto->EffectImplicitTargetA[effIndex] == TARGET_UNIT_CASTER)
711  return false;
712  break;
713  case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also
714  // part of positive spell if casted at self
715  if (spellproto->EffectImplicitTargetA[effIndex] != TARGET_UNIT_CASTER)
716  return false;
717  // but not this if this first effect (didn't find better check)
718  if (spellproto->Attributes & SPELL_ATTR0_NEGATIVE_1 && effIndex == 0)
719  return false;
720  break;
722  {
723  // non-positive immunities
724  switch (spellproto->EffectMiscValue[effIndex])
725  {
726  case MECHANIC_BANDAGE:
727  case MECHANIC_SHIELD:
728  case MECHANIC_MOUNT:
730  return false;
731  default:
732  break;
733  }
734  break;
735  }
736  case SPELL_AURA_ADD_FLAT_MODIFIER: // mods
738  {
739  // non-positive mods
740  switch (spellproto->EffectMiscValue[effIndex])
741  {
742  case SPELLMOD_COST: // dependent from bas point sign (negative -> positive)
743  if (spellproto->EffectBasePoints[effIndex] + int32(spellproto->EffectBaseDice[effIndex]) > 0)
744  {
745  if (spellproto->Id == 12042) // Arcane Power is a positive spell
746  return true;
747 
748  return false;
749  }
750  break;
751  default:
752  break;
753  }
754  break;
755  }
756  default:
757  break;
758  }
759  break;
760  }
761  default:
762  break;
763  }
764 
765  // non-positive targets
766  if (!IsPositiveTarget(spellproto->EffectImplicitTargetA[effIndex], spellproto->EffectImplicitTargetB[effIndex]))
767  return false;
768 
769  // ok, positive
770  return true;
771 }
uint32 EffectTriggerSpell[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:741
int32 EffectBaseDice[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:726
ACE_INT32 int32
Definition: Define.h:67
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:729
DBCStorage< SpellEntry > sSpellStore(SpellEntryfmt)
uint32 EffectApplyAuraName[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:734
uint32 Attributes
Definition: DBCStructure.h:679
bool IsPositiveEffect(uint32 spellId, uint32 effIndex)
Definition: SpellMgr.cpp:561
uint32 EffectImplicitTargetB[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:732
uint64 SpellFamilyFlags
Definition: DBCStructure.h:761
uint32 EffectImplicitTargetA[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:731
int32 EffectMiscValue[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:739
uint32 SpellFamilyName
Definition: DBCStructure.h:760
uint32 Mechanic
Definition: DBCStructure.h:678
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
bool IsPositiveTarget(uint32 targetA, uint32 targetB)
Definition: SpellMgr.cpp:539
ACE_UINT32 uint32
Definition: Define.h:71
bool IsPositiveSpell ( uint32  spellId)
bool IsPositiveTarget ( uint32  targetA,
uint32  targetB 
)
bool IsPrimaryProfessionSkill ( uint32  skill)
inline

Definition at line 813 of file SpellMgr.h.

References SkillLineEntry::categoryId, SKILL_CATEGORY_PROFESSION, and sSkillLineStore.

Referenced by Player::GetTrainerSpellState(), SpellMgr::IsPrimaryProfessionSpell(), and IsProfessionSkill().

814 {
815  SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill);
816  if (!pSkill)
817  return false;
818 
819  if (pSkill->categoryId != SKILL_CATEGORY_PROFESSION)
820  return false;
821 
822  return true;
823 }
DBCStorage< SkillLineEntry > sSkillLineStore(SkillLinefmt)
bool IsProfessionSkill ( uint32  skill)
inline
bool IsSealSpell ( SpellEntry const *  spellInfo)
inline

Definition at line 215 of file SpellMgr.h.

References SpellEntry::EffectImplicitTargetA, SPELLFAMILY_PALADIN, SpellEntry::SpellFamilyFlags, SpellEntry::SpellFamilyName, and TARGET_UNIT_CASTER.

Referenced by Aura::_AddAura(), Aura::_RemoveAura(), Spell::EffectScriptEffect(), and GetSpellSpecific().

216 {
217  //Collection of all the seal family flags. No other paladin spell has any of those.
218  return spellInfo->SpellFamilyName == SPELLFAMILY_PALADIN &&
219  (spellInfo->SpellFamilyFlags & 0x4000A000200LL) &&
220  spellInfo->EffectImplicitTargetA[0] == TARGET_UNIT_CASTER;
221 }
bool IsSingleTargetSpell ( SpellEntry const *  spellInfo)

Definition at line 783 of file SpellMgr.cpp.

References SpellEntry::AttributesEx5, GetSpellSpecific(), SpellEntry::Id, SPELL_ATTR5_SINGLE_TARGET_SPELL, and SPELL_SPECIFIC_JUDGEMENT.

Referenced by Pet::_LoadAuras(), Player::_LoadAuras(), Pet::_SaveAuras(), Player::_SaveAuras(), Aura::Aura(), IsNonCombatSpell(), and Unit::RemoveNotOwnSingleTargetAuras().

784 {
785  // all other single target spells have if it has AttributesEx5
786  if (spellInfo->AttributesEx5 & SPELL_ATTR5_SINGLE_TARGET_SPELL)
787  return true;
788 
789  // TODO - need found Judgements rule
790  switch (GetSpellSpecific(spellInfo->Id))
791  {
793  return true;
794  default:
795  break;
796  }
797 
798  // single target triggered spell.
799  // Not real client side single target spell, but it' not triggered until prev. aura expired.
800  // This is allow store it in single target spells list for caster for spell proc checking
801  if (spellInfo->Id == 38324) // Regeneration (triggered by 38299 (HoTs on Heals))
802  return true;
803 
804  return false;
805 }
SpellSpecific GetSpellSpecific(uint32 spellId)
Definition: SpellMgr.cpp:396
bool IsSingleTargetSpells ( SpellEntry const *  spellInfo1,
SpellEntry const *  spellInfo2 
)

Definition at line 807 of file SpellMgr.cpp.

References GetSpellSpecific(), SpellEntry::Id, SPELL_SPECIFIC_JUDGEMENT, SPELL_SPECIFIC_MAGE_POLYMORPH, SpellEntry::SpellFamilyName, and SpellEntry::SpellIconID.

Referenced by Unit::AddAura(), and IsNonCombatSpell().

808 {
809  // TODO - need better check
810  // Equal icon and spellfamily
811  if (spellInfo1->SpellFamilyName == spellInfo2->SpellFamilyName &&
812  spellInfo1->SpellIconID == spellInfo2->SpellIconID)
813  return true;
814 
815  // TODO - need found Judgements rule
816  SpellSpecific spec1 = GetSpellSpecific(spellInfo1->Id);
817  // spell with single target specific types
818  switch (spec1)
819  {
822  if (GetSpellSpecific(spellInfo2->Id) == spec1)
823  return true;
824  default:
825  break;
826  }
827 
828  return false;
829 }
SpellSpecific
Definition: SpellMgr.h:95
SpellSpecific GetSpellSpecific(uint32 spellId)
Definition: SpellMgr.cpp:396
bool IsSpellAbleToCrit ( const SpellEntry entry)
inline

Definition at line 265 of file SpellMgr.h.

References SpellEntry::Effect, EFFECT_0, SpellEntry::HasAttribute(), IsSpellEffectAbleToCrit(), MAX_SPELL_EFFECTS, and SPELL_ATTR2_CANT_CRIT.

Referenced by Unit::isSpellCrit().

266 {
267  if (!entry || entry->HasAttribute(SPELL_ATTR2_CANT_CRIT))
268  return false;
269 
270  for (uint32 i = EFFECT_0; i < MAX_SPELL_EFFECTS; ++i)
271  {
272  if (entry->Effect[i] && IsSpellEffectAbleToCrit(entry, SpellEffIndex(i)))
273  return true;
274  }
275  return false;
276 }
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
bool HasAttribute(SpellAttributes attribute) const
Definition: DBCStructure.h:774
bool IsSpellEffectAbleToCrit(const SpellEntry *entry, SpellEffIndex index)
Definition: SpellMgr.h:245
SpellEffIndex
Definition: SharedDefines.h:24
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:670
ACE_UINT32 uint32
Definition: Define.h:71
bool IsSpellAllowedInLocation ( SpellEntry const *  spellInfo,
uint32  map_id,
uint32  zone_id,
uint32  area_id 
)

Definition at line 2900 of file SpellMgr.cpp.

References MapEntry::addon, SpellEntry::AreaId, GetVirtualMapForMapAndZone(), SpellEntry::HasAttribute(), SpellEntry::Id, MapEntry::IsBattleground(), MapEntry::IsContinent(), MapEntry::IsRaid(), MapEntry::multimap_id, sMapStore, SPELL_ATTR4_CAST_ONLY_IN_OUTLAND, SPELL_ATTR6_NOT_IN_RAID_INSTANCE, and SPELL_FAILED_REQUIRES_AREA.

Referenced by Spell::CheckCast(), IsBinarySpell(), and Player::UpdateAreaDependentAuras().

2901 {
2902  // normal case
2903  if (spellInfo->AreaId && spellInfo->AreaId != zone_id && spellInfo->AreaId != area_id)
2904  return false;
2905 
2906  // continent limitation (virtual continent)
2907  if (spellInfo->HasAttribute(SPELL_ATTR4_CAST_ONLY_IN_OUTLAND))
2908  {
2909  uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
2910  MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
2911  if (!mapEntry || mapEntry->addon < 1 || !mapEntry->IsContinent())
2913  }
2914 
2915  // raid instance limitation
2916  if (spellInfo->HasAttribute(SPELL_ATTR6_NOT_IN_RAID_INSTANCE))
2917  {
2918  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2919  if (!mapEntry || mapEntry->IsRaid())
2921  }
2922 
2923  // special cases zone check (maps checked by multimap common id)
2924  switch (spellInfo->Id)
2925  {
2926  case 23333: // Warsong Flag
2927  case 23335: // Silverwing Flag
2928  case 46392: // Focused Assault
2929  case 46393: // Brutal Assault
2930  {
2931  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2932  if (!mapEntry)
2933  return false;
2934 
2935  if (!mapEntry->IsBattleground())
2936  return false;
2937 
2938  if (zone_id == 3277)
2939  return true;
2940 
2941  return false;
2942  }
2943  case 34976: // Netherstorm Flag
2944  {
2945  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2946  if (!mapEntry)
2947  return false;
2948 
2949  if (!mapEntry->IsBattleground())
2950  return false;
2951 
2952  if (zone_id == 3820)
2953  return true;
2954 
2955  return false;
2956  }
2957  case 32724: // Gold Team (Alliance)
2958  case 32725: // Green Team (Alliance)
2959  case 32727: // Arena Preparation
2960  case 35774: // Gold Team (Horde)
2961  case 35775: // Green Team (Horde)
2962  {
2963  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2964  if (!mapEntry)
2965  return false;
2966 
2967  //the follow code doesn't work.
2968  //if (!mapEntry->IsBattleArena())
2969  // return false;
2970 
2971  //this is the working code, HACK
2972  if (zone_id == 3702 || zone_id == 3968 || zone_id == 3698)
2973  return true;
2974 
2975  return false;
2976  }
2977  case 41618: // Bottled Nethergon Energy
2978  case 41620: // Bottled Nethergon Vapor
2979  {
2980  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2981  if (!mapEntry)
2982  return false;
2983 
2984  return mapEntry->multimap_id == 206;
2985  }
2986  case 41617: // Cenarion Mana Salve
2987  case 41619: // Cenarion Healing Salve
2988  {
2989  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
2990  if (!mapEntry)
2991  return false;
2992 
2993  return mapEntry->multimap_id == 207;
2994  }
2995  case 40216: // Dragonmaw Illusion
2996  case 42016: // Dragonmaw Illusion
2997  return area_id == 3759 || area_id == 3966 || area_id == 3939;
2998  case 2584: // Waiting to Resurrect
2999  case 22011: // Spirit Heal Channel
3000  case 22012: // Spirit Heal
3001  case 24171: // Resurrection Impact Visual
3002  case 42792: // Recently Dropped Flag
3003  case 43681: // Inactive
3004  case 44535: // Spirit Heal (mana)
3005  case 44521: // Preparation
3006  {
3007  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
3008  if (!mapEntry)
3009  return false;
3010 
3011  if (!mapEntry->IsBattleground())
3012  return false;
3013  }
3014  }
3015 
3016  return true;
3017 }
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
Definition: DBCStores.cpp:652
bool IsContinent() const
Definition: DBCStructure.h:583
uint32 addon
Definition: DBCStructure.h:542
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
uint32 multimap_id
Definition: DBCStructure.h:528
bool IsBattleground() const
Definition: DBCStructure.h:562
bool IsRaid() const
Definition: DBCStructure.h:558
ACE_UINT32 uint32
Definition: Define.h:71
bool isSpellBreakStealth ( SpellEntry const *  spellInfo)
inline

Definition at line 459 of file SpellMgr.h.

References SpellEntry::AttributesEx, and SPELL_ATTR1_NOT_BREAK_STEALTH.

Referenced by Spell::prepare().

460 {
461  return !(spellInfo->AttributesEx & SPELL_ATTR1_NOT_BREAK_STEALTH);
462 }
bool IsSpellEffectAbleToCrit ( const SpellEntry entry,
SpellEffIndex  index 
)
inline

Definition at line 245 of file SpellMgr.h.

References SpellEntry::DmgClass, SpellEntry::Effect, SpellEntry::HasAttribute(), SPELL_ATTR2_CANT_CRIT, SPELL_EFFECT_ENERGIZE, SPELL_EFFECT_HEAL, SPELL_EFFECT_NORMALIZED_WEAPON_DMG, SPELL_EFFECT_SCHOOL_DAMAGE, SPELL_EFFECT_WEAPON_DAMAGE, SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL, SPELL_EFFECT_WEAPON_PERCENT_DAMAGE, and SpellEntry::SpellFamilyName.

Referenced by IsSpellAbleToCrit().

246 {
247  if (!entry || entry->HasAttribute(SPELL_ATTR2_CANT_CRIT))
248  return false;
249 
250  switch (entry->Effect[index])
251  {
253  case SPELL_EFFECT_HEAL:
258  return true;
259  case SPELL_EFFECT_ENERGIZE: // Mana Potion and similar spells, Lay on hands
260  return (entry->SpellFamilyName && entry->DmgClass);
261  }
262  return false;
263 }
uint32 DmgClass
Definition: DBCStructure.h:763
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
bool HasAttribute(SpellAttributes attribute) const
Definition: DBCStructure.h:774
uint32 SpellFamilyName
Definition: DBCStructure.h:760
bool IsSpellEffectTriggerSpell ( const SpellEntry entry,
SpellEffIndex  eff_idx 
)
inline

Definition at line 229 of file SpellMgr.h.

References SpellEntry::Effect, SPELL_EFFECT_TRIGGER_MISSILE, SPELL_EFFECT_TRIGGER_SPELL, SPELL_EFFECT_TRIGGER_SPELL_2, and SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE.

Referenced by IsBinarySpell().

230 {
231  if (!entry)
232  return false;
233 
234  switch (entry->Effect[eff_idx])
235  {
240  return true;
241  }
242  return false;
243 }
uint32 Effect[MAX_SPELL_EFFECTS]
Definition: DBCStructure.h:724
bool IsSpellHaveEffect ( SpellEntry const *  spellInfo,
SpellEffects  effect 
)
inline

Definition at line 207 of file SpellMgr.h.

References SpellEntry::Effect.

Referenced by Player::AddSpell(), Player::CastItemCombatSpell(), Spell::CheckRange(), Spell::finish(), IsDispel(), and Spell::SetTargetMap().

208 {
209  for (int i = 0; i < 3; ++i)
210  if (spellInfo->Effect[i] == effect)
211  return true;
212  return false;
213 }
bool IsSpellIgnoringLOS ( SpellEntry const *  spellInfo)
inline

Definition at line 158 of file SpellMgr.h.

References SpellEntry::AttributesEx2, VMAP::VMapFactory::checkSpellForLoS(), DISABLE_TYPE_SPELL, SpellEntry::Id, sDisableMgr, SPELL_ATTR2_IGNORE_LOS, SPELL_DISABLE_LOS, TARGET_FLAG_DEST_LOCATION, TARGET_FLAG_SOURCE_LOCATION, and SpellEntry::Targets.

Referenced by Spell::CheckCast(), and Spell::CheckTarget().

159 {
160  if (spellInfo->AttributesEx2 & SPELL_ATTR2_IGNORE_LOS)
161  return true;
162 
163  if (!VMAP::VMapFactory::checkSpellForLoS(spellInfo->Id))
164  return true;
165 
166  if (sDisableMgr.IsDisabledFor(DISABLE_TYPE_SPELL, spellInfo->Id, NULL, SPELL_DISABLE_LOS))
167  return true;
168 
169  // Spells with area destinations also belong here
170  if (spellInfo->Targets & (TARGET_FLAG_SOURCE_LOCATION | TARGET_FLAG_DEST_LOCATION))
171  return true;
172 
173  return false;
174 }
#define sDisableMgr
Definition: DisableMgr.h:73
static bool checkSpellForLoS(unsigned int pSpellId)
Definition: VMapFactory.cpp:94
bool IsSpellRemoveAllMovementAndControlLossEffects ( SpellEntry const *  spellProto)
inline

Definition at line 278 of file SpellMgr.h.

References SpellEntry::AttributesEx, EFFECT_0, EFFECT_1, EFFECT_2, SpellEntry::EffectApplyAuraName, SpellEntry::EffectMiscValue, SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY, and SPELL_AURA_MECHANIC_IMMUNITY.

Referenced by Spell::CheckCasterAuras(), and Aura::HandleModMechanicImmunity().

279 {
280  return spellProto->EffectApplyAuraName[EFFECT_0] == SPELL_AURA_MECHANIC_IMMUNITY &&
281  spellProto->EffectMiscValue[EFFECT_0] == 1 &&
282  spellProto->EffectApplyAuraName[EFFECT_1] == 0 &&
283  spellProto->EffectApplyAuraName[EFFECT_2] == 0 &&
284  (spellProto->AttributesEx & SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY);
285 }
bool NeedsComboPoints ( SpellEntry const *  spellInfo)
inline

Variable Documentation