TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SpellInfo Class Reference

#include <SpellInfo.h>

Classes

struct  CostData
 
struct  ScalingInfo
 

Public Member Functions

SpellTargetRestrictionsEntry
const
GetSpellTargetRestrictions () const
 
SpellAuraOptionsEntry constGetSpellAuraOptions () const
 
SpellAuraRestrictionsEntry constGetSpellAuraRestrictions () const
 
SpellCastingRequirementsEntry
const
GetSpellCastingRequirements () const
 
SpellCategoriesEntry constGetSpellCategories () const
 
SpellClassOptionsEntry constGetSpellClassOptions () const
 
SpellCooldownsEntry constGetSpellCooldowns () const
 
SpellEquippedItemsEntry constGetSpellEquippedItems () const
 
SpellInterruptsEntry constGetSpellInterrupts () const
 
SpellLevelsEntry constGetSpellLevels () const
 
SpellReagentsEntry constGetSpellReagents () const
 
SpellScalingEntry constGetSpellScaling () const
 
SpellShapeshiftEntry constGetSpellShapeshift () const
 
SpellTotemsEntry constGetSpellTotems () const
 
SpellMiscEntry constGetSpellMisc () const
 
 SpellInfo (SpellEntry const *spellEntry, SpellEffectEntryMap const &effectsMap, SpellVisualMap &&visuals)
 
 ~SpellInfo ()
 
uint32 GetCategory () const
 
bool HasEffect (uint32 difficulty, SpellEffectName effect) const
 
bool HasEffect (SpellEffectName effect) const
 
bool HasAura (uint32 difficulty, AuraType aura) const
 
bool HasAreaAuraEffect (uint32 difficulty) const
 
bool HasAreaAuraEffect () const
 
bool HasAttribute (SpellAttr0 attribute) const
 
bool HasAttribute (SpellAttr1 attribute) const
 
bool HasAttribute (SpellAttr2 attribute) const
 
bool HasAttribute (SpellAttr3 attribute) const
 
bool HasAttribute (SpellAttr4 attribute) const
 
bool HasAttribute (SpellAttr5 attribute) const
 
bool HasAttribute (SpellAttr6 attribute) const
 
bool HasAttribute (SpellAttr7 attribute) const
 
bool HasAttribute (SpellAttr8 attribute) const
 
bool HasAttribute (SpellAttr9 attribute) const
 
bool HasAttribute (SpellAttr10 attribute) const
 
bool HasAttribute (SpellAttr11 attribute) const
 
bool HasAttribute (SpellAttr12 attribute) const
 
bool HasAttribute (SpellAttr13 attribute) const
 
bool HasAttribute (SpellCustomAttributes customAttribute) const
 
bool IsExplicitDiscovery () const
 
bool IsLootCrafting () const
 
bool IsQuestTame () const
 
bool IsProfessionOrRiding (uint32 difficulty=DIFFICULTY_NONE) const
 
bool IsProfession (uint32 difficulty=DIFFICULTY_NONE) const
 
bool IsPrimaryProfession (uint32 difficulty=DIFFICULTY_NONE) const
 
bool IsPrimaryProfessionFirstRank (uint32 difficulty=DIFFICULTY_NONE) const
 
bool IsAbilityLearnedWithProfession () const
 
bool IsAbilityOfSkillType (uint32 skillType) const
 
bool IsAffectingArea (uint32 difficulty) const
 
bool IsTargetingArea (uint32 difficulty) const
 
bool NeedsExplicitUnitTarget () const
 
bool NeedsToBeTriggeredByCaster (SpellInfo const *triggeringSpell, uint32 difficulty) const
 
bool IsPassive () const
 
bool IsAutocastable () const
 
bool IsStackableWithRanks () const
 
bool IsPassiveStackableWithRanks (uint32 difficulty) const
 
bool IsMultiSlotAura () const
 
bool IsStackableOnOneSlotWithDifferentCasters () const
 
bool IsCooldownStartedOnEvent () const
 
bool IsDeathPersistent () const
 
bool IsRequiringDeadTarget () const
 
bool IsAllowingDeadTarget () const
 
bool CanBeUsedInCombat () const
 
bool IsPositive () const
 
bool IsPositiveEffect (uint8 effIndex) const
 
bool IsChanneled () const
 
bool NeedsComboPoints () const
 
bool IsBreakingStealth () const
 
bool IsRangedWeaponSpell () const
 
bool IsAutoRepeatRangedSpell () const
 
bool IsAffectedBySpellMods () const
 
bool IsAffectedBySpellMod (SpellModifier const *mod) const
 
bool CanPierceImmuneAura (SpellInfo const *aura) const
 
bool CanDispelAura (SpellInfo const *aura) const
 
bool IsSingleTarget () const
 
bool IsAuraExclusiveBySpecificWith (SpellInfo const *spellInfo) const
 
bool IsAuraExclusiveBySpecificPerCasterWith (SpellInfo const *spellInfo) const
 
SpellCastResult CheckShapeshift (uint32 form) const
 
SpellCastResult CheckLocation (uint32 map_id, uint32 zone_id, uint32 area_id, Player const *player=NULL) const
 
SpellCastResult CheckTarget (Unit const *caster, WorldObject const *target, bool implicit=true) const
 
SpellCastResult CheckExplicitTarget (Unit const *caster, WorldObject const *target, Item const *itemTarget=NULL) const
 
SpellCastResult CheckVehicle (Unit const *caster) const
 
bool CheckTargetCreatureType (Unit const *target) const
 
SpellSchoolMask GetSchoolMask () const
 
uint32 GetAllEffectsMechanicMask () const
 
uint32 GetEffectMechanicMask (uint32 effIndex) const
 
uint32 GetSpellMechanicMaskByEffectMask (uint32 effectMask) const
 
Mechanics GetEffectMechanic (uint32 effIndex, uint32 difficulty) const
 
uint32 GetDispelMask () const
 
uint32 GetExplicitTargetMask () const
 
AuraStateType GetAuraState (uint32 difficulty) const
 
SpellSpecificType GetSpellSpecific () const
 
float GetMinRange (bool positive=false) const
 
float GetMaxRange (bool positive=false, Unit *caster=NULL, Spell *spell=NULL) const
 
int32 GetDuration () const
 
int32 GetMaxDuration () const
 
uint32 GetMaxTicks (uint32 difficulty) const
 
uint32 CalcCastTime (uint8 level=0, Spell *spell=NULL) const
 
uint32 GetRecoveryTime () const
 
std::vector< CostDataCalcPowerCost (Unit const *caster, SpellSchoolMask schoolMask) const
 
bool IsRanked () const
 
uint8 GetRank () const
 
SpellInfo constGetFirstRankSpell () const
 
SpellInfo constGetLastRankSpell () const
 
SpellInfo constGetNextRankSpell () const
 
SpellInfo constGetPrevRankSpell () const
 
SpellInfo constGetAuraRankForLevel (uint8 level) const
 
bool IsRankOf (SpellInfo const *spellInfo) const
 
bool IsDifferentRankOf (SpellInfo const *spellInfo) const
 
bool IsHighRankOf (SpellInfo const *spellInfo) const
 
uint32 GetSpellXSpellVisualId (Difficulty difficulty) const
 
uint32 GetSpellVisual (Difficulty difficulty, Player *forPlayer=nullptr) const
 
void _InitializeExplicitTargetMask ()
 
bool _IsPositiveEffect (uint32 effIndex, bool deep) const
 
bool _IsPositiveSpell () const
 
void _UnloadImplicitTargetConditionLists ()
 
void _UnloadSpellEffects ()
 
SpellEffectInfoVector GetEffectsForDifficulty (uint32 difficulty) const
 
SpellEffectInfo constGetEffect (uint32 difficulty, uint32 index) const
 
SpellEffectInfo constGetEffect (uint32 index) const
 
SpellEffectInfo constGetEffect (WorldObject const *obj, uint32 index) const
 

Static Public Member Functions

static uint32 GetDispelMask (DispelType type)
 
static bool _IsPositiveTarget (uint32 targetA, uint32 targetB)
 

Public Attributes

uint32 Id
 
SpellCategoryEntry constCategoryEntry
 
uint32 Dispel
 
uint32 Mechanic
 
uint32 Attributes
 
uint32 AttributesEx
 
uint32 AttributesEx2
 
uint32 AttributesEx3
 
uint32 AttributesEx4
 
uint32 AttributesEx5
 
uint32 AttributesEx6
 
uint32 AttributesEx7
 
uint32 AttributesEx8
 
uint32 AttributesEx9
 
uint32 AttributesEx10
 
uint32 AttributesEx11
 
uint32 AttributesEx12
 
uint32 AttributesEx13
 
uint32 AttributesCu
 
uint64 Stances
 
uint64 StancesNot
 
uint32 Targets
 
uint32 TargetCreatureType
 
uint32 RequiresSpellFocus
 
uint32 FacingCasterFlags
 
uint32 CasterAuraState
 
uint32 TargetAuraState
 
uint32 ExcludeCasterAuraState
 
uint32 ExcludeTargetAuraState
 
uint32 CasterAuraSpell
 
uint32 TargetAuraSpell
 
uint32 ExcludeCasterAuraSpell
 
uint32 ExcludeTargetAuraSpell
 
SpellCastTimesEntry constCastTimeEntry
 
uint32 RecoveryTime
 
uint32 CategoryRecoveryTime
 
uint32 StartRecoveryCategory
 
uint32 StartRecoveryTime
 
uint32 InterruptFlags
 
uint32 AuraInterruptFlags
 
uint32 ChannelInterruptFlags
 
uint32 ProcFlags
 
uint32 ProcChance
 
uint32 ProcCharges
 
uint32 MaxLevel
 
uint32 BaseLevel
 
uint32 SpellLevel
 
SpellDurationEntry constDurationEntry
 
std::vector< SpellPowerEntry
const * > 
PowerCosts
 
uint32 RuneCostID
 
SpellRangeEntry constRangeEntry
 
float Speed
 
uint32 StackAmount
 
uint32 Totem [2]
 
int32 Reagent [MAX_SPELL_REAGENTS]
 
uint32 ReagentCount [MAX_SPELL_REAGENTS]
 
int32 EquippedItemClass
 
int32 EquippedItemSubClassMask
 
int32 EquippedItemInventoryTypeMask
 
uint32 TotemCategory [2]
 
uint32 SpellVisual [2]
 
uint32 SpellIconID
 
uint32 ActiveIconID
 
char * SpellName
 
char * Rank
 
uint32 MaxTargetLevel
 
uint32 MaxAffectedTargets
 
uint32 SpellFamilyName
 
flag128 SpellFamilyFlags
 
uint32 DmgClass
 
uint32 PreventionType
 
int32 RequiredAreasID
 
uint32 SchoolMask
 
SpellCategoryEntry constChargeCategoryEntry
 
uint32 SpellDifficultyId
 
uint32 SpellScalingId
 
uint32 SpellAuraOptionsId
 
uint32 SpellAuraRestrictionsId
 
uint32 SpellCastingRequirementsId
 
uint32 SpellCategoriesId
 
uint32 SpellClassOptionsId
 
uint32 SpellCooldownsId
 
uint32 SpellEquippedItemsId
 
uint32 SpellInterruptsId
 
uint32 SpellLevelsId
 
uint32 SpellReagentsId
 
uint32 SpellShapeshiftId
 
uint32 SpellTargetRestrictionsId
 
uint32 SpellTotemsId
 
uint32 SpellMiscId
 
struct SpellInfo::ScalingInfo Scaling
 
uint32 ExplicitTargetMask
 
SpellChainNode constChainEntry
 
SpellEffectInfoMap _effects
 
SpellVisualMap _visuals
 
bool _hasPowerDifficultyData
 

Constructor & Destructor Documentation

SpellInfo::SpellInfo ( SpellEntry const spellEntry,
SpellEffectEntryMap const effectsMap,
SpellVisualMap &&  visuals 
)
978  : _hasPowerDifficultyData(false)
979 {
980  Id = spellEntry->ID;
981 
982  // SpellDifficultyEntry
983  for (SpellEffectEntryMap::value_type const& itr : effectsMap)
984  {
985  SpellEffectEntryVector const& effects = itr.second;
986  _effects[itr.first].resize(effects.size());
987 
988  for (size_t i = 0; i < effects.size(); ++i)
989  {
990  if (SpellEffectEntry const* effect = effects[i])
991  _effects[itr.first][effect->EffectIndex] = new SpellEffectInfo(spellEntry, this, effect->EffectIndex, effect);
992  }
993  }
994 
995  SpellName = spellEntry->Name_lang;
996  Rank = nullptr;
997  RuneCostID = spellEntry->RuneCostID;
998  SpellDifficultyId = 0;
999  SpellScalingId = spellEntry->ScalingID;
1000  SpellAuraOptionsId = spellEntry->AuraOptionsID;
1001  SpellAuraRestrictionsId = spellEntry->AuraRestrictionsID;
1002  SpellCastingRequirementsId = spellEntry->CastingRequirementsID;
1003  SpellCategoriesId = spellEntry->CategoriesID;
1004  SpellClassOptionsId = spellEntry->ClassOptionsID;
1005  SpellCooldownsId = spellEntry->CooldownsID;
1006  SpellEquippedItemsId = spellEntry->EquippedItemsID;
1007  SpellInterruptsId = spellEntry->InterruptsID;
1008  SpellLevelsId = spellEntry->LevelsID;
1009  SpellReagentsId = spellEntry->ReagentsID;
1010  SpellShapeshiftId = spellEntry->ShapeshiftID;
1011  SpellTargetRestrictionsId = spellEntry->TargetRestrictionsID;
1012  SpellTotemsId = spellEntry->TotemsID;
1013  SpellMiscId = spellEntry->MiscID;
1014 
1015  // SpellMiscEntry
1016  SpellMiscEntry const* _misc = GetSpellMisc();
1017  Attributes = _misc ? _misc->Attributes : 0;
1018  AttributesEx = _misc ? _misc->AttributesEx : 0;
1019  AttributesEx2 = _misc ? _misc->AttributesExB : 0;
1020  AttributesEx3 = _misc ? _misc->AttributesExC : 0;
1021  AttributesEx4 = _misc ? _misc->AttributesExD : 0;
1022  AttributesEx5 = _misc ? _misc->AttributesExE : 0;
1023  AttributesEx6 = _misc ? _misc->AttributesExF : 0;
1024  AttributesEx7 = _misc ? _misc->AttributesExG : 0;
1025  AttributesEx8 = _misc ? _misc->AttributesExH : 0;
1026  AttributesEx9 = _misc ? _misc->AttributesExI : 0;
1027  AttributesEx10 = _misc ? _misc->AttributesExJ : 0;
1028  AttributesEx11 = _misc ? _misc->AttributesExK : 0;
1029  AttributesEx12 = _misc ? _misc->AttributesExL : 0;
1030  AttributesEx13 = _misc ? _misc->AttributesExM : 0;
1031  CastTimeEntry = _misc ? (_misc->CastingTimeIndex ? sSpellCastTimesStore.LookupEntry(_misc->CastingTimeIndex) : NULL) : NULL;
1032  DurationEntry = _misc ? (_misc->DurationIndex ? sSpellDurationStore.LookupEntry(_misc->DurationIndex) : NULL) : NULL;
1033  RangeEntry = _misc ? (_misc->RangeIndex ? sSpellRangeStore.LookupEntry(_misc->RangeIndex) : NULL) : NULL;
1034  Speed = _misc ? _misc->Speed : 0;
1035  SchoolMask = _misc ? _misc->SchoolMask : 0;
1036  AttributesCu = 0;
1037  SpellIconID = _misc ? _misc->SpellIconID : 0;
1038  ActiveIconID = _misc ? _misc->ActiveIconID : 0;
1039 
1040  _visuals = std::move(visuals);
1041 
1042  // SpellScalingEntry
1043  SpellScalingEntry const* _scaling = GetSpellScaling();
1044  Scaling.CastTimeMin = _scaling ? _scaling->CastTimeMin : 0;
1045  Scaling.CastTimeMax = _scaling ?_scaling->CastTimeMax : 0;
1046  Scaling.CastTimeMaxLevel = _scaling ? _scaling->CastTimeMaxLevel : 0;
1047  Scaling.Class = _scaling ? _scaling->ScalingClass : 0;
1048  Scaling.NerfFactor = _scaling ? _scaling->NerfFactor : 0;
1049  Scaling.NerfMaxLevel = _scaling ? _scaling->NerfMaxLevel : 0;
1050  Scaling.MaxScalingLevel = _scaling ? _scaling->MaxScalingLevel : 0;
1051  Scaling.ScalesFromItemLevel = _scaling ? _scaling->ScalesFromItemLevel : 0;
1052 
1053  // SpellAuraOptionsEntry
1054  SpellAuraOptionsEntry const* _options = GetSpellAuraOptions();
1055  ProcFlags = _options ? _options->ProcTypeMask : 0;
1056  ProcChance = _options ? _options->ProcChance : 0;
1057  ProcCharges = _options ? _options->ProcCharges : 0;
1058  StackAmount = _options ? _options->CumulativeAura : 0;
1059 
1060  // SpellAuraRestrictionsEntry
1062  CasterAuraState = _aura ? _aura->CasterAuraState : 0;
1063  TargetAuraState = _aura ? _aura->TargetAuraState : 0;
1064  ExcludeCasterAuraState = _aura ? _aura->ExcludeCasterAuraState : 0;
1065  ExcludeTargetAuraState = _aura ? _aura->ExcludeTargetAuraState : 0;
1066  CasterAuraSpell = _aura ? _aura->CasterAuraSpell : 0;
1067  TargetAuraSpell = _aura ? _aura->TargetAuraSpell : 0;
1068  ExcludeCasterAuraSpell = _aura ? _aura->ExcludeCasterAuraSpell : 0;
1069  ExcludeTargetAuraSpell = _aura ? _aura->ExcludeTargetAuraSpell : 0;
1070 
1071  // SpellCastingRequirementsEntry
1073  RequiresSpellFocus = _castreq ? _castreq->RequiresSpellFocus : 0;
1074  FacingCasterFlags = _castreq ? _castreq->FacingCasterFlags : 0;
1075  RequiredAreasID = _castreq ? _castreq->RequiredAreasID : -1;
1076 
1077  // SpellCategoriesEntry
1078  SpellCategoriesEntry const* _categorie = GetSpellCategories();
1079  CategoryEntry = _categorie ? sSpellCategoryStore.LookupEntry(_categorie->Category) : NULL;
1080  Dispel = _categorie ? _categorie->DispelType : 0;
1081  Mechanic = _categorie ? _categorie->Mechanic : 0;
1082  StartRecoveryCategory = _categorie ? _categorie->StartRecoveryCategory : 0;
1083  DmgClass = _categorie ? _categorie->DefenseType : 0;
1084  PreventionType = _categorie ? _categorie->PreventionType : 0;
1085  ChargeCategoryEntry = _categorie ? sSpellCategoryStore.LookupEntry(_categorie->ChargeCategory) : 0;
1086 
1087  // SpellClassOptionsEntry
1088  SpellClassOptionsEntry const* _class = GetSpellClassOptions();
1089  SpellFamilyName = _class ? _class->SpellClassSet : 0;
1090  SpellFamilyFlags = _class ? _class->SpellClassMask : flag128();
1091 
1092  // SpellCooldownsEntry
1093  SpellCooldownsEntry const* _cooldowns = GetSpellCooldowns();
1094  RecoveryTime = _cooldowns ? _cooldowns->RecoveryTime : 0;
1095  CategoryRecoveryTime = _cooldowns ? _cooldowns->CategoryRecoveryTime : 0;
1096  StartRecoveryTime = _cooldowns ? _cooldowns->StartRecoveryTime : 0;
1097 
1098  // SpellEquippedItemsEntry
1099  SpellEquippedItemsEntry const* _equipped = GetSpellEquippedItems();
1100  EquippedItemClass = _equipped ? _equipped->EquippedItemClass : -1;
1101  EquippedItemSubClassMask = _equipped ?_equipped->EquippedItemSubClassMask : -1;
1102  EquippedItemInventoryTypeMask = _equipped ? _equipped->EquippedItemInventoryTypeMask : -1;
1103 
1104  // SpellInterruptsEntry
1105  SpellInterruptsEntry const* _interrupt = GetSpellInterrupts();
1106  InterruptFlags = _interrupt ? _interrupt->InterruptFlags : 0;
1107  // TODO: 6.x these flags have 2 parts
1108  AuraInterruptFlags = _interrupt ? _interrupt->AuraInterruptFlags[0] : 0;
1109  ChannelInterruptFlags = _interrupt ? _interrupt->ChannelInterruptFlags[0] : 0;
1110 
1111  // SpellLevelsEntry
1112  SpellLevelsEntry const* _levels = GetSpellLevels();
1113  MaxLevel = _levels ? _levels->MaxLevel : 0;
1114  BaseLevel = _levels ? _levels->BaseLevel : 0;
1115  SpellLevel = _levels ? _levels->SpellLevel : 0;
1116 
1117  // SpellPowerEntry
1119 
1120  // SpellReagentsEntry
1121  SpellReagentsEntry const* _reagents = GetSpellReagents();
1122  for (uint8 i = 0; i < MAX_SPELL_REAGENTS; ++i)
1123  Reagent[i] = _reagents ? _reagents->Reagent[i] : 0;
1124  for (uint8 i = 0; i < MAX_SPELL_REAGENTS; ++i)
1125  ReagentCount[i] = _reagents ? _reagents->ReagentCount[i] : 0;
1126 
1127  // SpellShapeshiftEntry
1128  SpellShapeshiftEntry const* _shapeshift = GetSpellShapeshift();
1129  Stances = _shapeshift ? MAKE_PAIR64(_shapeshift->ShapeshiftMask[0], _shapeshift->ShapeshiftMask[1]) : 0;
1130  StancesNot = _shapeshift ? MAKE_PAIR64(_shapeshift->ShapeshiftExclude[0], _shapeshift->ShapeshiftExclude[1]) : 0;
1131 
1132  // SpellTargetRestrictionsEntry
1134  Targets = _target ? _target->Targets : 0;
1135  TargetCreatureType = _target ? _target->TargetCreatureType : 0;
1136  MaxAffectedTargets = _target ? _target->MaxAffectedTargets : 0;
1137  MaxTargetLevel = _target ? _target->MaxTargetLevel : 0;
1138 
1139  // SpellTotemsEntry
1140  SpellTotemsEntry const* _totem = GetSpellTotems();
1141  for (uint8 i = 0; i < 2; ++i)
1142  TotemCategory[i] = _totem ? _totem->RequiredTotemCategoryID[i] : 0;
1143  for (uint8 i = 0; i < 2; ++i)
1144  Totem[i] = _totem ? _totem->Totem[i] : 0;
1145 
1146  ChainEntry = NULL;
1147  ExplicitTargetMask = 0;
1148 }
SpellTotemsEntry const * GetSpellTotems() const
Definition: SpellInfo.cpp:3245
uint32 SpellCategoriesId
Definition: SpellInfo.h:408
Definition: DB2Structure.h:1306
int32 EquippedItemClass
Definition: DBCStructure.h:1120
uint32 AttributesExL
Definition: DB2Structure.h:1226
Targets
Definition: SharedDefines.h:1873
Definition: DBCEnums.h:404
SpellLevelsEntry const * GetSpellLevels() const
Definition: SpellInfo.cpp:3225
uint32 CasterAuraSpell
Definition: DB2Structure.h:1153
uint32 Totem[MAX_SPELL_TOTEMS]
Definition: DB2Structure.h:1310
uint32 NerfMaxLevel
Definition: DBCStructure.h:1207
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: DBCStructure.h:1176
uint32 ReagentCount[MAX_SPELL_REAGENTS]
Definition: SpellInfo.h:384
uint32 Id
Definition: SpellInfo.h:329
int32 EquippedItemClass
Definition: SpellInfo.h:385
uint32 AttributesEx11
Definition: SpellInfo.h:344
Definition: DBCStructure.h:1115
uint32 BaseLevel
Definition: DBCStructure.h:1153
uint32 ExcludeTargetAuraSpell
Definition: DB2Structure.h:1156
uint32 AttributesEx12
Definition: SpellInfo.h:345
uint32 StartRecoveryTime
Definition: DBCStructure.h:1133
uint32 AttributesExI
Definition: DB2Structure.h:1223
uint32 CastTimeMaxLevel
Definition: SpellInfo.h:424
flag128 SpellClassMask
Definition: DB2Structure.h:1182
uint32 MaxScalingLevel
Definition: DBCStructure.h:1208
int32 Class
Definition: SpellInfo.h:425
uint32 SpellClassSet
Definition: DB2Structure.h:1183
struct SpellInfo::ScalingInfo Scaling
uint32 PreventionType
Definition: DBCStructure.h:1092
SpellCooldownsEntry const * GetSpellCooldowns() const
Definition: SpellInfo.cpp:3280
uint32 TargetAuraState
Definition: SpellInfo.h:355
uint32 AttributesExE
Definition: DB2Structure.h:1219
uint32 DmgClass
Definition: SpellInfo.h:398
Definition: DB2Structure.h:1159
uint32 MaxLevel
Definition: SpellInfo.h:373
uint32 SpellLevel
Definition: SpellInfo.h:375
SpellCastingRequirementsEntry const * GetSpellCastingRequirements() const
Definition: SpellInfo.cpp:3265
uint32 AttributesEx
Definition: SpellInfo.h:334
uint32 SpellAuraOptionsId
Definition: SpellInfo.h:405
uint32 ProcCharges
Definition: SpellInfo.h:372
SpellCategoryEntry const * ChargeCategoryEntry
Definition: SpellInfo.h:402
uint32 TargetAuraSpell
Definition: DB2Structure.h:1154
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:386
uint32 AttributesEx8
Definition: SpellInfo.h:341
Definition: DBCStructure.h:1148
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
uint32 ScalesFromItemLevel
Definition: DBCStructure.h:1209
uint32 AttributesEx10
Definition: SpellInfo.h:343
flag128 SpellFamilyFlags
Definition: SpellInfo.h:397
uint32 ExcludeCasterAuraSpell
Definition: SpellInfo.h:360
uint32 SchoolMask
Definition: SpellInfo.h:401
uint32 ActiveIconID
Definition: SpellInfo.h:391
uint32 Dispel
Definition: SpellInfo.h:331
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:361
uint32 RequiresSpellFocus
Definition: SpellInfo.h:352
uint32 StartRecoveryCategory
Definition: SpellInfo.h:365
uint32 MaxTargetLevel
Definition: DBCStructure.h:1193
uint32 TargetCreatureType
Definition: DBCStructure.h:1194
uint32 StartRecoveryCategory
Definition: DBCStructure.h:1093
int32 EquippedItemInventoryTypeMask
Definition: DBCStructure.h:1121
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 SpellReagentsId
Definition: SpellInfo.h:414
uint32 AuraInterruptFlags
Definition: SpellInfo.h:368
Definition: DBCStructure.h:1126
uint32 Mechanic
Definition: SpellInfo.h:332
Definition: DBCStructure.h:995
uint32 Attributes
Definition: SpellInfo.h:333
float NerfFactor
Definition: SpellInfo.h:426
uint32 MaxTargetLevel
Definition: SpellInfo.h:394
uint32 SchoolMask
Definition: DB2Structure.h:1234
Definition: DB2Structure.h:1287
uint32 AttributesExG
Definition: DB2Structure.h:1221
Definition: DBCStructure.h:1137
uint64 MAKE_PAIR64(uint32 l, uint32 h)
Definition: ObjectDefines.h:34
int32 EquippedItemInventoryTypeMask
Definition: SpellInfo.h:387
TotemCategory
Definition: SharedDefines.h:4156
uint32 CasterAuraState
Definition: DB2Structure.h:1149
uint32 AttributesEx3
Definition: SpellInfo.h:336
uint32 AttributesEx
Definition: DB2Structure.h:1215
uint64 StancesNot
Definition: SpellInfo.h:349
SpellAuraRestrictionsEntry const * GetSpellAuraRestrictions() const
Definition: SpellInfo.cpp:3260
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:362
uint32 ChargeCategory
Definition: DBCStructure.h:1094
uint32 SpellLevel
Definition: DBCStructure.h:1155
uint32 SpellMiscId
Definition: SpellInfo.h:418
SpellCategoriesEntry const * GetSpellCategories() const
Definition: SpellInfo.cpp:3270
DB2Storage< SpellCastTimesEntry > sSpellCastTimesStore("SpellCastTimes.db2", SpellCastTimesFormat, HOTFIX_SEL_SPELL_CAST_TIMES)
uint32 FacingCasterFlags
Definition: DB2Structure.h:1162
Definition: Totem.h:38
uint32 NerfMaxLevel
Definition: SpellInfo.h:427
uint32 MaxLevel
Definition: DBCStructure.h:1154
uint32 AttributesEx7
Definition: SpellInfo.h:340
uint32 ScalesFromItemLevel
Definition: SpellInfo.h:429
int32 CastTimeMin
Definition: DBCStructure.h:1202
uint32 SpellAuraRestrictionsId
Definition: SpellInfo.h:406
uint32 AttributesEx9
Definition: SpellInfo.h:342
uint32 DurationIndex
Definition: DB2Structure.h:1229
uint32 ExcludeTargetAuraState
Definition: DB2Structure.h:1152
uint32 AttributesExJ
Definition: DB2Structure.h:1224
Definition: DBCStructure.h:1083
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:379
uint32 RecoveryTime
Definition: SpellInfo.h:363
uint32 ProcCharges
Definition: DBCStructure.h:1047
DBCStorage< SpellCategoryEntry > sSpellCategoryStore(SpellCategoryfmt)
uint32 SpellScalingId
Definition: SpellInfo.h:404
uint32 AttributesEx2
Definition: SpellInfo.h:335
uint32 ExcludeCasterAuraState
Definition: SpellInfo.h:356
uint32 SpellCastingRequirementsId
Definition: SpellInfo.h:407
char * Rank
Definition: SpellInfo.h:393
uint32 SpellFamilyName
Definition: SpellInfo.h:396
int32 RequiredAreasID
Definition: SpellInfo.h:400
uint32 SpellDifficultyId
Definition: SpellInfo.h:403
uint32 ProcChance
Definition: SpellInfo.h:371
SpellScalingEntry const * GetSpellScaling() const
Definition: SpellInfo.cpp:3235
uint32 MaxAffectedTargets
Definition: SpellInfo.h:395
uint32 SpellClassOptionsId
Definition: SpellInfo.h:409
uint32 RequiredAreasID
Definition: DB2Structure.h:1165
uint32 ExplicitTargetMask
Definition: SpellInfo.h:432
uint32 Targets
Definition: DBCStructure.h:1195
uint32 CastingTimeIndex
Definition: DB2Structure.h:1228
int32 EquippedItemSubClassMask
Definition: DBCStructure.h:1122
Definition: Util.h:362
uint32 InterruptFlags
Definition: DBCStructure.h:1144
uint32 ChannelInterruptFlags[2]
Definition: DBCStructure.h:1143
uint64 Stances
Definition: SpellInfo.h:348
int32 CastTimeMin
Definition: SpellInfo.h:422
float Speed
Definition: DB2Structure.h:1231
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:376
Definition: SpellInfo.h:238
Definition: DB2Structure.h:1211
char * SpellName
Definition: SpellInfo.h:392
uint32 AttributesExF
Definition: DB2Structure.h:1220
uint32 SpellShapeshiftId
Definition: SpellInfo.h:415
uint32 SpellEquippedItemsId
Definition: SpellInfo.h:411
uint32 Category
Definition: DBCStructure.h:1088
uint32 Mechanic
Definition: DBCStructure.h:1091
uint32 AttributesEx13
Definition: SpellInfo.h:346
uint32 ExcludeCasterAuraSpell
Definition: DB2Structure.h:1155
uint32 SpellTotemsId
Definition: SpellInfo.h:417
uint32 RecoveryTime
Definition: DBCStructure.h:1132
uint32 MaxAffectedTargets
Definition: DBCStructure.h:1192
uint32 AttributesCu
Definition: SpellInfo.h:347
uint32 PreventionType
Definition: SpellInfo.h:399
SpellClassOptionsEntry const * GetSpellClassOptions() const
Definition: SpellInfo.cpp:3275
uint32 AttributesExM
Definition: DB2Structure.h:1227
Definition: DBCStructure.h:1040
std::vector< SpellPowerEntry const * > PowerCosts
Definition: SpellInfo.h:377
int32 ScalingClass
Definition: DBCStructure.h:1205
int32 Reagent[MAX_SPELL_REAGENTS]
Definition: SpellInfo.h:383
float Speed
Definition: SpellInfo.h:380
uint32 SpellInterruptsId
Definition: SpellInfo.h:412
uint32 CasterAuraState
Definition: SpellInfo.h:354
bool _hasPowerDifficultyData
Definition: SpellInfo.h:592
uint32 AttributesExH
Definition: DB2Structure.h:1222
uint32 AttributesEx5
Definition: SpellInfo.h:338
uint32 RequiredTotemCategoryID[MAX_SPELL_TOTEMS]
Definition: DB2Structure.h:1309
int32 CastTimeMax
Definition: SpellInfo.h:423
std::vector< SpellEffectEntry const * > SpellEffectEntryVector
Definition: SpellInfo.h:318
SpellEquippedItemsEntry const * GetSpellEquippedItems() const
Definition: SpellInfo.cpp:3215
uint32 ProcTypeMask
Definition: DBCStructure.h:1048
uint32 RequiresSpellFocus
Definition: DB2Structure.h:1167
uint32 DispelType
Definition: DBCStructure.h:1090
uint32 CumulativeAura
Definition: DBCStructure.h:1045
SpellShapeshiftEntry const * GetSpellShapeshift() const
Definition: SpellInfo.cpp:3240
uint32 CategoryRecoveryTime
Definition: DBCStructure.h:1131
uint32 SpellIconID
Definition: DB2Structure.h:1232
uint32 AuraInterruptFlags[2]
Definition: DBCStructure.h:1142
uint32 ChannelInterruptFlags
Definition: SpellInfo.h:369
float NerfFactor
Definition: DBCStructure.h:1206
uint32 RangeIndex
Definition: DB2Structure.h:1230
SpellAuraOptionsEntry const * GetSpellAuraOptions() const
Definition: SpellInfo.cpp:3255
uint32 SpellLevelsId
Definition: SpellInfo.h:413
DB2Storage< SpellDurationEntry > sSpellDurationStore("SpellDuration.db2", SpellDurationFormat, HOTFIX_SEL_SPELL_DURATION)
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:357
Definition: DBCStructure.h:1199
uint32 BaseLevel
Definition: SpellInfo.h:374
uint32 ProcChance
Definition: DBCStructure.h:1046
Definition: DBCStructure.h:1185
uint32 TargetAuraState
Definition: DB2Structure.h:1150
uint32 SpellIconID
Definition: SpellInfo.h:390
uint32 CasterAuraSpell
Definition: SpellInfo.h:358
uint32 MaxScalingLevel
Definition: SpellInfo.h:428
DB2Storage< SpellRangeEntry > sSpellRangeStore("SpellRange.db2", SpellRangeFormat, HOTFIX_SEL_SPELL_RANGE)
uint32 DefenseType
Definition: DBCStructure.h:1089
uint8_t uint8
Definition: Define.h:152
uint32 AttributesEx6
Definition: SpellInfo.h:339
uint32 FacingCasterFlags
Definition: SpellInfo.h:353
uint32 ActiveIconID
Definition: DB2Structure.h:1233
uint32 AttributesExB
Definition: DB2Structure.h:1216
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:433
uint32 Attributes
Definition: DB2Structure.h:1214
ProcFlags
Definition: SpellMgr.h:107
#define MAX_SPELL_REAGENTS
Definition: DB2Structure.h:1285
uint32 StackAmount
Definition: SpellInfo.h:381
uint32 CastTimeMaxLevel
Definition: DBCStructure.h:1204
Definition: DB2Structure.h:1178
SpellMiscEntry const * GetSpellMisc() const
Definition: SpellInfo.cpp:3250
SpellTargetRestrictionsEntry const * GetSpellTargetRestrictions() const
Definition: SpellInfo.cpp:3210
uint32 TargetCreatureType
Definition: SpellInfo.h:351
uint32 CategoryRecoveryTime
Definition: SpellInfo.h:364
uint32 RuneCostID
Definition: SpellInfo.h:378
uint32 StartRecoveryTime
Definition: SpellInfo.h:366
uint32 ReagentCount[MAX_SPELL_REAGENTS]
Definition: DB2Structure.h:1291
uint32 AttributesExD
Definition: DB2Structure.h:1218
uint32 AttributesExK
Definition: DB2Structure.h:1225
SpellInterruptsEntry const * GetSpellInterrupts() const
Definition: SpellInfo.cpp:3220
uint32 InterruptFlags
Definition: SpellInfo.h:367
uint32 ExcludeCasterAuraState
Definition: DB2Structure.h:1151
uint32 AttributesExC
Definition: DB2Structure.h:1217
SpellReagentsEntry const * GetSpellReagents() const
Definition: SpellInfo.cpp:3230
uint32 TargetAuraSpell
Definition: SpellInfo.h:359
SpellCategoryEntry const * CategoryEntry
Definition: SpellInfo.h:330
int32 CastTimeMax
Definition: DBCStructure.h:1203
int32 Reagent[MAX_SPELL_REAGENTS]
Definition: DB2Structure.h:1290
uint32 AttributesEx4
Definition: SpellInfo.h:337
uint32 SpellCooldownsId
Definition: SpellInfo.h:410
SpellVisualMap _visuals
Definition: SpellInfo.h:591
uint32 SpellTargetRestrictionsId
Definition: SpellInfo.h:416
Definition: DB2Structure.h:1146

+ Here is the call graph for this function:

SpellInfo::~SpellInfo ( )
1151 {
1154 }
void _UnloadImplicitTargetConditionLists()
Definition: SpellInfo.cpp:3285
void _UnloadSpellEffects()
Definition: SpellInfo.cpp:1156

+ Here is the call graph for this function:

Member Function Documentation

void SpellInfo::_InitializeExplicitTargetMask ( )
2874 {
2875  bool srcSet = false;
2876  bool dstSet = false;
2877  uint32 targetMask = Targets;
2878  // prepare target mask using effect target entries
2879  for (SpellEffectInfoMap::const_iterator itr = _effects.begin(); itr != _effects.end(); ++itr)
2880  {
2881  for (SpellEffectInfo const* effect : itr->second)
2882  {
2883  if (!effect || !effect->IsEffect())
2884  continue;
2885 
2886  targetMask |= effect->TargetA.GetExplicitTargetMask(srcSet, dstSet);
2887  targetMask |= effect->TargetB.GetExplicitTargetMask(srcSet, dstSet);
2888 
2889  // add explicit target flags based on spell effects which have EFFECT_IMPLICIT_TARGET_EXPLICIT and no valid target provided
2891  continue;
2892 
2893  // extend explicit target mask only if valid targets for effect could not be provided by target types
2894  uint32 effectTargetMask = effect->GetMissingTargetMask(srcSet, dstSet, targetMask);
2895 
2896  // don't add explicit object/dest flags when spell has no max range
2897  if (GetMaxRange(true) == 0.0f && GetMaxRange(false) == 0.0f)
2899 
2900  targetMask |= effectTargetMask;
2901  }
2902  }
2903 
2904  ExplicitTargetMask = targetMask;
2905 }
float GetMaxRange(bool positive=false, Unit *caster=NULL, Spell *spell=NULL) const
Definition: SpellInfo.cpp:2475
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
uint32 GetMissingTargetMask(bool srcSet=false, bool destSet=false, uint32 mask=0) const
Definition: SpellInfo.cpp:686
Definition: SpellInfo.h:148
SpellImplicitTargetInfo TargetA
Definition: SpellInfo.h:257
SpellEffectImplicitTargetTypes GetImplicitTargetType() const
Definition: SpellInfo.cpp:710
uint32 GetExplicitTargetMask(bool &srcSet, bool &dstSet) const
Definition: SpellInfo.cpp:126
uint32 ExplicitTargetMask
Definition: SpellInfo.h:432
Definition: SpellInfo.h:78
Definition: SpellInfo.h:238
uint32 Targets
Definition: SpellInfo.h:350
uint32_t uint32
Definition: Define.h:150
Definition: SpellInfo.h:54
Definition: SpellInfo.h:59
SpellImplicitTargetInfo TargetB
Definition: SpellInfo.h:258
Definition: SpellInfo.h:75
bool IsEffect() const
Definition: SpellInfo.cpp:399

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SpellInfo::_IsPositiveEffect ( uint32  effIndex,
bool  deep 
) const
2908 {
2909  // not found a single positive spell with this attribute
2911  return false;
2912 
2913  switch (SpellFamilyName)
2914  {
2915  case SPELLFAMILY_GENERIC:
2916  switch (Id)
2917  {
2918  case 29214: // Wrath of the Plaguebringer
2919  case 34700: // Allergic Reaction
2920  case 54836: // Wrath of the Plaguebringer
2921  return false;
2922  case 30877: // Tag Murloc
2923  case 61716: // Rabbit Costume
2924  case 61734: // Noblegarden Bunny
2925  case 62344: // Fists of Stone
2926  case 61819: // Manabonked! (item)
2927  case 61834: // Manabonked! (minigob)
2928  case 73523: // Rigor Mortis
2929  return true;
2930  default:
2931  break;
2932  }
2933  break;
2934  case SPELLFAMILY_MAGE:
2935  // Ignite
2936  if (SpellIconID == 45)
2937  return true;
2938  break;
2939  case SPELLFAMILY_PRIEST:
2940  switch (Id)
2941  {
2942  case 64844: // Divine Hymn
2943  case 64904: // Hymn of Hope
2944  case 47585: // Dispersion
2945  return true;
2946  default:
2947  break;
2948  }
2949  break;
2950  case SPELLFAMILY_ROGUE:
2951  switch (Id)
2952  {
2953  // Envenom must be considered as a positive effect even though it deals damage
2954  case 32645: // Envenom
2955  return true;
2956  default:
2957  break;
2958  }
2959  break;
2960  default:
2961  break;
2962  }
2963 
2964  switch (Mechanic)
2965  {
2967  return true;
2968  default:
2969  break;
2970  }
2971 
2972  // Special case: effects which determine positivity of whole spell
2973  for (SpellEffectInfoMap::const_iterator itr = _effects.begin(); itr != _effects.end(); ++itr)
2974  {
2975  for (SpellEffectInfo const* effect : itr->second)
2976  {
2977  if (effect && effect->IsAura() && effect->ApplyAuraName == SPELL_AURA_MOD_STEALTH)
2978  return true;
2979  }
2980  }
2981 
2982  for (SpellEffectInfoMap::const_iterator itr = _effects.begin(); itr != _effects.end(); ++itr)
2983  {
2984  for (SpellEffectInfo const* effect : itr->second)
2985  {
2986  if (!effect || effect->EffectIndex != effIndex)
2987  continue;
2988 
2989  switch (effect->Effect)
2990  {
2991  case SPELL_EFFECT_DUMMY:
2992  // some explicitly required dummy effect sets
2993  switch (Id)
2994  {
2995  case 28441:
2996  return false; // AB Effect 000
2997  default:
2998  break;
2999  }
3000  break;
3001  // always positive effects (check before target checks that provided non-positive result in some case for positive effects)
3002  case SPELL_EFFECT_HEAL:
3005  case SPELL_EFFECT_HEAL_PCT:
3007  return true;
3009  return false;
3010 
3011  // non-positive aura use
3014  {
3015  switch (effect->ApplyAuraName)
3016  {
3017  case SPELL_AURA_MOD_DAMAGE_DONE: // dependent from bas point sign (negative -> negative)
3018  case SPELL_AURA_MOD_STAT:
3019  case SPELL_AURA_MOD_SKILL:
3025  if (effect->CalcValue() < 0)
3026  return false;
3027  break;
3028  case SPELL_AURA_MOD_DAMAGE_TAKEN: // dependent from bas point sign (positive -> negative)
3029  if (effect->CalcValue() > 0)
3030  return false;
3031  break;
3034  if (effect->CalcValue() > 0)
3035  return true; // some expected positive spells have SPELL_ATTR1_NEGATIVE
3036  break;
3038  return true;
3041  if (!deep)
3042  {
3043  if (SpellInfo const* spellTriggeredProto = sSpellMgr->GetSpellInfo(effect->TriggerSpell))
3044  {
3045  // negative targets of main spell return early
3046  for (SpellEffectInfoMap::const_iterator it = spellTriggeredProto->_effects.begin(); it != spellTriggeredProto->_effects.end(); ++it)
3047  {
3048  for (SpellEffectInfo const* eff : itr->second)
3049  {
3050  if (!eff || !eff->Effect)
3051  continue;
3052  // if non-positive trigger cast targeted to positive target this main cast is non-positive
3053  // this will place this spell auras as debuffs
3054  if (_IsPositiveTarget(eff->TargetA.GetTarget(), eff->TargetB.GetTarget()) && !spellTriggeredProto->_IsPositiveEffect(eff->EffectIndex, true))
3055  return false;
3056  }
3057  }
3058  }
3059  }
3061  // many positive auras have negative triggered spells at damage for example and this not make it negative (it can be canceled for example)
3062  break;
3063  case SPELL_AURA_MOD_STUN: //have positive and negative spells, we can't sort its correctly at this moment.
3064  {
3065  bool more = false;
3066  for (SpellEffectInfoMap::const_iterator i = _effects.begin(); i != _effects.end(); ++i)
3067  {
3068  for (SpellEffectInfo const* eff : i->second)
3069  {
3070  if (eff && eff->EffectIndex != 0)
3071  {
3072  more = true;
3073  break;
3074  }
3075  }
3076  }
3077  if (effIndex == 0 && !more)
3078  return false; // but all single stun aura spells is negative
3079  break;
3080  }
3082  if (Id == 24740) // Wisp Costume
3083  return true;
3084  return false;
3085  case SPELL_AURA_MOD_ROOT:
3087  case SPELL_AURA_GHOST:
3092  return false;
3093  case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also.
3094  // part of negative spell if cast at self (prevent cancel)
3095  if (effect->TargetA.GetTarget() == TARGET_UNIT_CASTER)
3096  return false;
3097  break;
3098  case SPELL_AURA_MOD_DECREASE_SPEED: // used in positive spells also
3099  // part of positive spell if cast at self
3100  if (effect->TargetA.GetTarget() != TARGET_UNIT_CASTER)
3101  return false;
3102  // but not this if this first effect (didn't find better check)
3103  if (Attributes & SPELL_ATTR0_NEGATIVE_1 && effIndex == 0)
3104  return false;
3105  break;
3107  {
3108  // non-positive immunities
3109  switch (effect->MiscValue)
3110  {
3111  case MECHANIC_BANDAGE:
3112  case MECHANIC_SHIELD:
3113  case MECHANIC_MOUNT:
3115  return false;
3116  default:
3117  break;
3118  }
3119  break;
3120  }
3121  case SPELL_AURA_ADD_FLAT_MODIFIER: // mods
3123  {
3124  // non-positive mods
3125  switch (effect->MiscValue)
3126  {
3127  case SPELLMOD_COST: // dependent from bas point sign (negative -> positive)
3128  if (effect->CalcValue() > 0)
3129  {
3130  if (!deep)
3131  {
3132  bool negative = true;
3133  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3134  {
3135  if (i != effIndex)
3136  if (_IsPositiveEffect(i, true))
3137  {
3138  negative = false;
3139  break;
3140  }
3141  }
3142  if (negative)
3143  return false;
3144  }
3145  }
3146  break;
3147  default:
3148  break;
3149  }
3150  break;
3151  }
3152  default:
3153  break;
3154  }
3155  break;
3156  }
3157  default:
3158  break;
3159  }
3160 
3161  // non-positive targets
3162  if (!_IsPositiveTarget(effect->TargetA.GetTarget(), effect->TargetB.GetTarget()))
3163  return false;
3164 
3165  // negative spell if triggered spell is negative
3166  if (!deep && !effect->ApplyAuraName && effect->TriggerSpell)
3167  {
3168  if (SpellInfo const* spellTriggeredProto = sSpellMgr->GetSpellInfo(effect->TriggerSpell))
3169  if (!spellTriggeredProto->_IsPositiveSpell())
3170  return false;
3171  }
3172  }
3173  }
3174  // ok, positive
3175  return true;
3176 }
Definition: SpellAuraDefines.h:63
int32 MiscValue
Definition: SpellInfo.h:253
uint32 Id
Definition: SpellInfo.h:329
Definition: SpellAuraDefines.h:74
Definition: SpellAuraDefines.h:287
Definition: SharedDefines.h:1819
Definition: SpellAuraDefines.h:155
Definition: SpellAuraDefines.h:72
static bool _IsPositiveTarget(uint32 targetA, uint32 targetB)
Definition: SpellInfo.cpp:3188
Definition: SpellInfo.h:326
Definition: SpellAuraDefines.h:128
Definition: SpellAuraDefines.h:76
uint32 ApplyAuraName
Definition: SpellInfo.h:244
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
uint32 Mechanic
Definition: SpellInfo.h:332
uint32 Attributes
Definition: SpellInfo.h:333
Definition: SpellAuraDefines.h:168
Definition: SharedDefines.h:1139
Definition: SharedDefines.h:1016
Definition: SpellAuraDefines.h:86
Definition: SharedDefines.h:1046
uint32 EffectIndex
Definition: SpellInfo.h:242
Definition: SharedDefines.h:1138
SpellImplicitTargetInfo TargetA
Definition: SpellInfo.h:257
Definition: SpellAuraDefines.h:169
uint32 TriggerSpell
Definition: SpellInfo.h:263
Definition: SpellAuraDefines.h:139
Definition: SharedDefines.h:4626
Definition: SpellAuraDefines.h:83
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Targets GetTarget() const
Definition: SpellInfo.cpp:121
Definition: SharedDefines.h:4629
Definition: Unit.h:100
Definition: SpellAuraDefines.h:117
Definition: SharedDefines.h:4631
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
Definition: SpellAuraDefines.h:87
Definition: SharedDefines.h:1020
bool IsAura() const
Definition: SpellInfo.cpp:409
Definition: SharedDefines.h:1811
Definition: SpellAuraDefines.h:195
Definition: SpellAuraDefines.h:73
Definition: SpellAuraDefines.h:137
Definition: SharedDefines.h:1809
Definition: SharedDefines.h:1054
Definition: SpellAuraDefines.h:109
Definition: SpellAuraDefines.h:90
int32 CalcValue(Unit const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:455
Definition: SpellAuraDefines.h:89
Definition: SharedDefines.h:1013
Definition: SpellAuraDefines.h:102
Definition: SharedDefines.h:4623
bool _IsPositiveEffect(uint32 effIndex, bool deep) const
Definition: SpellInfo.cpp:2907
Definition: SpellAuraDefines.h:167
Definition: SharedDefines.h:1806
SpellImplicitTargetInfo TargetB
Definition: SpellInfo.h:258
uint32 SpellIconID
Definition: SpellInfo.h:390
Definition: SharedDefines.h:1146
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
Definition: SpellAuraDefines.h:93
Definition: SharedDefines.h:1815
Definition: SharedDefines.h:382
Definition: SharedDefines.h:1875
Definition: SpellAuraDefines.h:113
Definition: SpellAuraDefines.h:350
uint32 Effect
Definition: SpellInfo.h:243
Definition: SpellAuraDefines.h:178
Definition: SpellAuraDefines.h:149
Definition: SpellAuraDefines.h:460
Definition: SpellAuraDefines.h:374
Definition: SpellAuraDefines.h:120
Definition: SharedDefines.h:1147

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SpellInfo::_IsPositiveSpell ( ) const
3179 {
3180  // spells with at least one negative effect are considered negative
3181  // some self-applied spells have negative effects but in self casting case negative check ignored.
3182  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
3183  if (!_IsPositiveEffect(i, true))
3184  return false;
3185  return true;
3186 }
bool _IsPositiveEffect(uint32 effIndex, bool deep) const
Definition: SpellInfo.cpp:2907
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SpellInfo::_IsPositiveTarget ( uint32  targetA,
uint32  targetB 
)
static
3189 {
3190  // non-positive targets
3191  switch (targetA)
3192  {
3201  return false;
3202  default:
3203  break;
3204  }
3205  if (targetB)
3206  return _IsPositiveTarget(targetB, 0);
3207  return true;
3208 }
static bool _IsPositiveTarget(uint32 targetA, uint32 targetB)
Definition: SpellInfo.cpp:3188
Definition: SharedDefines.h:1897
Definition: SharedDefines.h:1885
Definition: SharedDefines.h:1973
Definition: SharedDefines.h:1886
Definition: SharedDefines.h:1922
Definition: SharedDefines.h:1880
Definition: SharedDefines.h:1893
Definition: SharedDefines.h:1876

+ Here is the caller graph for this function:

void SpellInfo::_UnloadImplicitTargetConditionLists ( )
3286 {
3287  // find the same instances of ConditionList and delete them.
3288  for (uint32 d = 0; d < MAX_DIFFICULTY; ++d)
3289  {
3290  for (uint32 i = 0; i < _effects.size(); ++i)
3291  {
3292  if (SpellEffectInfo const* effect = GetEffect(d, i))
3293  {
3294  ConditionContainer* cur = effect->ImplicitTargetConditions;
3295  if (!cur)
3296  continue;
3297  for (uint8 j = i; j < _effects.size(); ++j)
3298  {
3299  if (SpellEffectInfo const* eff = GetEffect(d, j))
3300  {
3301  if (eff->ImplicitTargetConditions == cur)
3302  const_cast<SpellEffectInfo*>(eff)->ImplicitTargetConditions = NULL;
3303  }
3304  }
3305  delete cur;
3306  }
3307  }
3308  }
3309 }
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
Definition: DBCEnums.h:426
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348
uint8_t uint8
Definition: Define.h:152
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:239

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void SpellInfo::_UnloadSpellEffects ( )
1157 {
1158  for (SpellEffectInfoMap::value_type& i : _effects)
1159  for (size_t j = 0; j < i.second.size(); ++j)
1160  delete i.second[j];
1161  _effects.clear();
1162 }
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590

+ Here is the caller graph for this function:

uint32 SpellInfo::CalcCastTime ( uint8  level = 0,
Spell spell = NULL 
) const
2505 {
2506  int32 castTime = 0;
2507  if (!level && spell)
2508  level = spell->GetCaster()->getLevel();
2509 
2510  // not all spells have cast time index and this is all is pasiive abilities
2511  if (level && Scaling.CastTimeMax > 0)
2512  {
2513  castTime = Scaling.CastTimeMax;
2514  if (Scaling.CastTimeMaxLevel > level)
2515  castTime = Scaling.CastTimeMin + int32(level - 1) * (Scaling.CastTimeMax - Scaling.CastTimeMin) / (Scaling.CastTimeMaxLevel - 1);
2516  }
2517  else if (CastTimeEntry)
2518  castTime = CastTimeEntry->CastTime;
2519 
2520  if (!castTime)
2521  return 0;
2522 
2523  if (spell)
2524  spell->GetCaster()->ModSpellCastTime(this, castTime, spell);
2525 
2527  castTime += 500;
2528 
2529  return (castTime > 0) ? uint32(castTime) : 0;
2530 }
uint32 CastTimeMaxLevel
Definition: SpellInfo.h:424
struct SpellInfo::ScalingInfo Scaling
void ModSpellCastTime(SpellInfo const *spellProto, int32 &castTime, Spell *spell=NULL)
Definition: Unit.cpp:11049
Unit * GetCaster() const
Definition: Spell.h:612
bool IsAutoRepeatRangedSpell() const
Definition: SpellInfo.cpp:1535
uint32 Attributes
Definition: SpellInfo.h:333
SpellCastTimesEntry const * CastTimeEntry
Definition: SpellInfo.h:362
uint8 getLevel() const
Definition: Unit.h:1408
uint32 AttributesEx9
Definition: SpellInfo.h:342
int32 CastTimeMin
Definition: SpellInfo.h:422
int32_t int32
Definition: Define.h:146
int32 CastTime
Definition: DB2Structure.h:1173
int32 CastTimeMax
Definition: SpellInfo.h:423
int32_t int32
Definition: g3dmath.h:167
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:357
Definition: SharedDefines.h:688

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< SpellInfo::CostData > SpellInfo::CalcPowerCost ( Unit const caster,
SpellSchoolMask  schoolMask 
) const
2565 {
2566  std::vector<CostData> costs;
2567  auto collector = [this, caster, schoolMask, &costs](std::vector<SpellPowerEntry const*> const& powers)
2568  {
2569  costs.reserve(powers.size());
2570  int32 healthCost = 0;
2571 
2572 
2573  for (SpellPowerEntry const* power : powers)
2574  {
2575  if (power->RequiredAura && !caster->HasAura(power->RequiredAura))
2576  continue;
2577 
2578  // Spell drain all exist power on cast (Only paladin lay of Hands)
2580  {
2581  // If power type - health drain all
2582  if (power->PowerType == POWER_HEALTH)
2583  {
2584  healthCost = caster->GetHealth();
2585  continue;
2586  }
2587  // Else drain all power
2588  if (power->PowerType < MAX_POWERS)
2589  {
2590  CostData cost;
2591  cost.Power = Powers(power->PowerType);
2592  cost.Amount = caster->GetPower(cost.Power);
2593  costs.push_back(cost);
2594  continue;
2595  }
2596 
2597  TC_LOG_ERROR("spells", "SpellInfo::CalcPowerCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
2598  continue;
2599  }
2600 
2601  // Base powerCost
2602  int32 powerCost = power->ManaCost;
2603  // PCT cost from total amount
2604  if (power->ManaCostPercentage)
2605  {
2606  switch (power->PowerType)
2607  {
2608  // health as power used
2609  case POWER_HEALTH:
2610  powerCost += int32(CalculatePct(caster->GetMaxHealth(), power->ManaCostPercentage));
2611  break;
2612  case POWER_MANA:
2613  powerCost += int32(CalculatePct(caster->GetCreateMana(), power->ManaCostPercentage));
2614  break;
2615  case POWER_RAGE:
2616  case POWER_FOCUS:
2617  case POWER_ENERGY:
2618  powerCost += int32(CalculatePct(caster->GetMaxPower(Powers(power->PowerType)), power->ManaCostPercentage));
2619  break;
2620  case POWER_RUNES:
2621  case POWER_RUNIC_POWER:
2622  TC_LOG_DEBUG("spells", "CalculateManaCost: Not implemented yet!");
2623  break;
2624  default:
2625  TC_LOG_ERROR("spells", "CalculateManaCost: Unknown power type '%d' in spell %d", power->PowerType, Id);
2626  continue;
2627  }
2628  }
2629 
2630  if (power->HealthCostPercentage)
2631  healthCost += int32(CalculatePct(caster->GetMaxHealth(), power->HealthCostPercentage));
2632 
2633  // Flat mod from caster auras by spell school and power type
2634  Unit::AuraEffectList const& auras = caster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL);
2635  for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
2636  {
2637  if (!((*i)->GetMiscValue() & schoolMask))
2638  continue;
2639 
2640  if (!((*i)->GetMiscValueB() & (1 << power->PowerType)))
2641  continue;
2642 
2643  powerCost += (*i)->GetAmount();
2644  }
2645 
2646  // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost)
2648  {
2649  uint32 speed = 0;
2650  if (SpellShapeshiftFormEntry const* ss = sSpellShapeshiftFormStore.LookupEntry(caster->GetShapeshiftForm()))
2651  speed = ss->CombatRoundTime;
2652  else
2653  {
2656  slot = OFF_ATTACK;
2657 
2658  speed = caster->GetAttackTime(slot);
2659  }
2660 
2661  powerCost += speed / 100;
2662  }
2663 
2664  // Apply cost mod by spell
2665  if (Player* modOwner = caster->GetSpellModOwner())
2666  {
2667  if (power->PowerIndex == 0)
2668  modOwner->ApplySpellMod(Id, SPELLMOD_COST, powerCost);
2669  else if (power->PowerIndex == 1)
2670  modOwner->ApplySpellMod(Id, SPELLMOD_SPELL_COST2, powerCost);
2671  }
2672 
2673  if (!caster->IsControlledByPlayer() && G3D::fuzzyEq(power->ManaCostPercentage, 0.0f) && SpellLevel)
2674  {
2676  {
2677  GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.EvaluateTable(SpellLevel - 1, 0);
2678  GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.EvaluateTable(caster->getLevel() - 1, 0);
2679  if (spellScaler && casterScaler)
2680  powerCost *= casterScaler->ratio / spellScaler->ratio;
2681  }
2682  }
2683 
2684  // PCT mod from user auras by spell school and power type
2685  Unit::AuraEffectList const& aurasPct = caster->GetAuraEffectsByType(SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT);
2686  for (Unit::AuraEffectList::const_iterator i = aurasPct.begin(); i != aurasPct.end(); ++i)
2687  {
2688  if (!((*i)->GetMiscValue() & schoolMask))
2689  continue;
2690 
2691  if (!((*i)->GetMiscValueB() & (1 << power->PowerType)))
2692  continue;
2693 
2694  powerCost += CalculatePct(powerCost, (*i)->GetAmount());
2695  }
2696 
2697  if (power->PowerType == POWER_HEALTH)
2698  {
2699  healthCost += powerCost;
2700  continue;
2701  }
2702 
2703  bool found = false;
2704  for (CostData& cost : costs)
2705  {
2706  if (cost.Power == Powers(power->PowerType))
2707  {
2708  cost.Amount += powerCost;
2709  found = true;
2710  }
2711  }
2712 
2713  if (!found)
2714  {
2715  CostData cost;
2716  cost.Power = Powers(power->PowerType);
2717  cost.Amount = powerCost;
2718  costs.push_back(cost);
2719  }
2720  }
2721 
2722  if (healthCost > 0)
2723  {
2724  CostData cost;
2725  cost.Power = POWER_HEALTH;
2726  cost.Amount = healthCost;
2727  costs.push_back(cost);
2728  }
2729  };
2730 
2731  if (!_hasPowerDifficultyData) // optimization - use static data for 99.5% cases (4753 of 4772 in build 6.1.0.19702)
2732  collector(PowerCosts);
2733  else
2734  collector(sDB2Manager.GetSpellPowers(Id, caster->GetMap()->GetDifficultyID()));
2735 
2736  // POWER_RUNES is handled by SpellRuneCost.db2, and cost.Amount is always 0 (see Spell::TakeRunePower)
2737  costs.erase(std::remove_if(costs.begin(), costs.end(), [](CostData const& cost) { return cost.Power != POWER_RUNES && cost.Amount <= 0; }), costs.end());
2738  return costs;
2739 }
Definition: Unit.h:120
float ratio
Definition: DBCStructure.h:554
#define sDB2Manager
Definition: DB2Stores.h:224
uint32 Id
Definition: SpellInfo.h:329
Definition: SharedDefines.h:488
uint32 SpellLevel
Definition: SpellInfo.h:375
uint32 AttributesEx
Definition: SpellInfo.h:334
Definition: SpellAuraDefines.h:132
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
Definition: SharedDefines.h:254
Definition: SharedDefines.h:249
Definition: SharedDefines.h:375
uint32 Attributes
Definition: SpellInfo.h:333
Definition: SpellAuraDefines.h:133
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
Definition: SharedDefines.h:393
uint32 AttributesEx3
Definition: SpellInfo.h:336
Definition: SharedDefines.h:253
Definition: SharedDefines.h:250
Definition: DB2Structure.h:1238
Definition: DBCStructure.h:552
Powers
Definition: SharedDefines.h:246
Definition: Unit.h:618
Definition: Unit.h:100
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:510
GameTable< GtNPCManaCostScalerEntry > sGtNPCManaCostScalerStore(GtNPCManaCostScalerfmt)
Definition: DBCStructure.h:1160
T CalculatePct(T base, U pct)
Definition: Util.h:92
std::vector< SpellPowerEntry const * > PowerCosts
Definition: SpellInfo.h:377
bool _hasPowerDifficultyData
Definition: SpellInfo.h:592
Definition: SharedDefines.h:251
int32_t int32
Definition: g3dmath.h:167
Definition: SharedDefines.h:265
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormfmt)
WeaponAttackType
Definition: Unit.h:615
bool fuzzyEq(double a, double b)
Definition: g3dmath.h:857
uint32 AttributesEx4
Definition: SpellInfo.h:337
Definition: Unit.h:617
Definition: SharedDefines.h:248
Definition: SharedDefines.h:267

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SpellInfo::CanBeUsedInCombat ( ) const
1491 {
1493 }
uint32 Attributes
Definition: SpellInfo.h:333
Definition: SharedDefines.h:384

+ Here is the caller graph for this function:

bool SpellInfo::CanDispelAura ( SpellInfo const aura) const
1576 {
1577  // These spells (like Mass Dispel) can dispell all auras, except death persistent ones (like Dungeon and Battleground Deserter)
1578  if (Attributes & SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY && !aura->IsDeathPersistent())
1579  return true;
1580 
1581  // These auras (Cyclone for example) are not dispelable
1582  if (aura->HasAttribute(SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE))
1583  return false;
1584 
1585  // Divine Shield etc can dispel auras if they don't ignore school immunity
1586  if (HasAttribute(SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY) && !aura->IsDeathPersistent())
1587  return true;
1588 
1589  // These auras (like Divine Shield) can't be dispelled
1590  if (aura->HasAttribute(SPELL_ATTR0_UNAFFECTED_BY_INVULNERABILITY))
1591  return false;
1592 
1593  return true;
1594 }
uint32 Attributes
Definition: SpellInfo.h:333
Definition: SharedDefines.h:407
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
Definition: SharedDefines.h:385
Definition: SharedDefines.h:408

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SpellInfo::CanPierceImmuneAura ( SpellInfo const aura) const
1563 {
1564  // these spells pierce all avalible spells (Resurrection Sickness for example)
1566  return true;
1567 
1568  // these spells (Cyclone for example) can pierce all... // ...but not these (Divine shield, Ice block, Cyclone and Banish for example)
1569  if ((AttributesEx & SPELL_ATTR1_UNAFFECTED_BY_SCHOOL_IMMUNE) && !(aura && (aura->Mechanic == MECHANIC_IMMUNE_SHIELD || aura->Mechanic == MECHANIC_INVULNERABILITY || aura->Mechanic == MECHANIC_BANISH)))
1570  return true;
1571 
1572  return false;
1573 }
Definition: SharedDefines.h:1819
Definition: SharedDefines.h:1808
uint32 AttributesEx
Definition: SpellInfo.h:334
uint32 Attributes
Definition: SpellInfo.h:333
Definition: SharedDefines.h:1815
Definition: SharedDefines.h:385
Definition: SharedDefines.h:408

+ Here is the caller graph for this function:

SpellCastResult SpellInfo::CheckExplicitTarget ( Unit const caster,
WorldObject const target,
Item const itemTarget = NULL 
) const
2027 {
2028  uint32 neededTargets = GetExplicitTargetMask();
2029  if (!target)
2030  {
2032  if (!(neededTargets & TARGET_FLAG_GAMEOBJECT_ITEM) || !itemTarget)
2033  return SPELL_FAILED_BAD_TARGETS;
2034  return SPELL_CAST_OK;
2035  }
2036 
2037  if (Unit const* unitTarget = target->ToUnit())
2038  {
2040  {
2041  if (neededTargets & TARGET_FLAG_UNIT_ENEMY)
2042  if (caster->_IsValidAttackTarget(unitTarget, this))
2043  return SPELL_CAST_OK;
2044  if (neededTargets & TARGET_FLAG_UNIT_ALLY
2045  || (neededTargets & TARGET_FLAG_UNIT_PARTY && caster->IsInPartyWith(unitTarget))
2046  || (neededTargets & TARGET_FLAG_UNIT_RAID && caster->IsInRaidWith(unitTarget)))
2047  if (caster->_IsValidAssistTarget(unitTarget, this))
2048  return SPELL_CAST_OK;
2049  if (neededTargets & TARGET_FLAG_UNIT_MINIPET)
2050  if (unitTarget->GetGUID() == caster->GetCritterGUID())
2051  return SPELL_CAST_OK;
2052  if (neededTargets & TARGET_FLAG_UNIT_PASSENGER)
2053  if (unitTarget->IsOnVehicle(caster))
2054  return SPELL_CAST_OK;
2055  return SPELL_FAILED_BAD_TARGETS;
2056  }
2057  }
2058  return SPELL_CAST_OK;
2059 }
Definition: SpellInfo.h:64
Definition: SpellInfo.h:77
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2216
Definition: SpellInfo.h:68
Definition: SpellInfo.h:56
Definition: SharedDefines.h:1280
Definition: SpellInfo.h:50
Definition: SpellInfo.h:51
Definition: SpellInfo.h:55
Definition: SpellInfo.h:78
uint32_t uint32
Definition: Define.h:150
Definition: SpellInfo.h:62
Definition: SpellInfo.h:75
Definition: Unit.h:1305
Definition: SharedDefines.h:1538
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellCastResult SpellInfo::CheckLocation ( uint32  map_id,
uint32  zone_id,
uint32  area_id,
Player const player = NULL 
) const
1725 {
1726  // normal case
1727  if (RequiredAreasID > 0)
1728  {
1729  bool found = false;
1730  std::vector<uint32> areaGroupMembers = sDB2Manager.GetAreasForGroup(RequiredAreasID);
1731  for (uint32 areaId : areaGroupMembers)
1732  {
1733  if (areaId == zone_id || areaId == area_id)
1734  {
1735  found = true;
1736  break;
1737  }
1738  }
1739 
1740  if (!found)
1742  }
1743 
1744  // continent limitation (virtual continent)
1746  {
1747  uint32 v_map = GetVirtualMapForMapAndZone(map_id, zone_id);
1748  MapEntry const* mapEntry = sMapStore.LookupEntry(v_map);
1749  if (!mapEntry || mapEntry->ExpansionID < 1 || !mapEntry->IsContinent())
1751  }
1752 
1753  // raid instance limitation
1755  {
1756  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1757  if (!mapEntry || mapEntry->IsRaid())
1759  }
1760 
1761  // DB base check (if non empty then must fit at least single for allow)
1762  SpellAreaMapBounds saBounds = sSpellMgr->GetSpellAreaMapBounds(Id);
1763  if (saBounds.first != saBounds.second)
1764  {
1765  for (SpellAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1766  {
1767  if (itr->second.IsFitToRequirements(player, zone_id, area_id))
1768  return SPELL_CAST_OK;
1769  }
1771  }
1772 
1773  // bg spell checks
1774  switch (Id)
1775  {
1776  case 23333: // Warsong Flag
1777  case 23335: // Silverwing Flag
1778  return map_id == 489 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
1779  case 34976: // Netherstorm Flag
1780  return map_id == 566 && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
1781  case 2584: // Waiting to Resurrect
1782  case 22011: // Spirit Heal Channel
1783  case 22012: // Spirit Heal
1784  case 24171: // Resurrection Impact Visual
1785  case 42792: // Recently Dropped Flag
1786  case 43681: // Inactive
1787  case 44535: // Spirit Heal (mana)
1788  {
1789  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1790  if (!mapEntry)
1792 
1793  return zone_id == 4197 || (mapEntry->IsBattleground() && player && player->InBattleground()) ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
1794  }
1795  case 44521: // Preparation
1796  {
1797  if (!player)
1799 
1800  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1801  if (!mapEntry)
1803 
1804  if (!mapEntry->IsBattleground())
1806 
1807  Battleground* bg = player->GetBattleground();
1809  }
1810  case 32724: // Gold Team (Alliance)
1811  case 32725: // Green Team (Alliance)
1812  case 35774: // Gold Team (Horde)
1813  case 35775: // Green Team (Horde)
1814  {
1815  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1816  if (!mapEntry)
1818 
1819  return mapEntry->IsBattleArena() && player && player->InBattleground() ? SPELL_CAST_OK : SPELL_FAILED_REQUIRES_AREA;
1820  }
1821  case 32727: // Arena Preparation
1822  {
1823  if (!player)
1825 
1826  MapEntry const* mapEntry = sMapStore.LookupEntry(map_id);
1827  if (!mapEntry)
1829 
1830  if (!mapEntry->IsBattleArena())
1832 
1833  Battleground* bg = player->GetBattleground();
1835  }
1836  }
1837 
1838  // aura limitations
1839  if (player)
1840  {
1841  for (SpellEffectInfo const* effect : GetEffectsForDifficulty(player->GetMap()->GetDifficultyID()))
1842  {
1843  if (!effect || !effect->IsAura())
1844  continue;
1845 
1846  switch (effect->ApplyAuraName)
1847  {
1848  case SPELL_AURA_FLY:
1849  {
1850  SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(Id);
1851  for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
1852  {
1853  if (skillIter->second->SkillLine == SKILL_MOUNTS)
1854  if (!player->CanFlyInZone(map_id, zone_id))
1856  }
1857  break;
1858  }
1859  case SPELL_AURA_MOUNTED:
1860  {
1861  uint32 mountType = effect->MiscValueB;
1862  if (MountEntry const* mountEntry = sDB2Manager.GetMount(Id))
1863  mountType = mountEntry->MountTypeId;
1864  if (mountType && !player->GetMountCapability(mountType))
1865  return SPELL_FAILED_NOT_HERE;
1866  break;
1867  }
1868  }
1869  }
1870  }
1871 
1872  return SPELL_CAST_OK;
1873 }
#define sDB2Manager
Definition: DB2Stores.h:224
uint32 Id
Definition: SpellInfo.h:329
bool IsBattleArena() const
Definition: DBCStructure.h:862
Definition: SharedDefines.h:583
uint32 GetVirtualMapForMapAndZone(uint32 mapid, uint32 zoneId)
Definition: DBCStores.cpp:599
Definition: SharedDefines.h:1471
BattlegroundStatus GetStatus() const
Definition: Battleground.h:266
Definition: SharedDefines.h:1325
bool IsContinent() const
Definition: DBCStructure.h:876
Definition: DBCStructure.h:830
Definition: SpellAuraDefines.h:261
Definition: SharedDefines.h:4024
Definition: System.cpp:71
uint32 ExpansionID
Definition: DBCStructure.h:847
std::pair< SkillLineAbilityMap::const_iterator, SkillLineAbilityMap::const_iterator > SkillLineAbilityMapBounds
Definition: SpellMgr.h:549
Definition: Battleground.h:158
bool IsBattleground() const
Definition: DBCStructure.h:861
int32 RequiredAreasID
Definition: SpellInfo.h:400
std::pair< SpellAreaMap::const_iterator, SpellAreaMap::const_iterator > SpellAreaMapBounds
Definition: SpellMgr.h:501
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:526
Definition: SharedDefines.h:1346
bool IsRaid() const
Definition: DBCStructure.h:860
DBCStorage< MapEntry > sMapStore(Mapfmt)
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
uint32 AttributesEx6
Definition: SpellInfo.h:339
Definition: Battleground.h:235
Definition: SharedDefines.h:1387
Definition: SharedDefines.h:1538
Definition: DB2Structure.h:913
uint32 AttributesEx4
Definition: SpellInfo.h:337
Definition: SpellAuraDefines.h:138

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellCastResult SpellInfo::CheckShapeshift ( uint32  form) const
Todo:
Find a way to disable use of these spells clientside
1666 {
1667  // talents that learn spells can have stance requirements that need ignore
1668  // (this requirement only for client-side stance show in talent description)
1669  /* TODO: 6.x fix this in proper way (probably spell flags/attributes?)
1670  if (GetTalentSpellCost(Id) > 0 &&
1671  (Effects[0].Effect == SPELL_EFFECT_LEARN_SPELL || Effects[1].Effect == SPELL_EFFECT_LEARN_SPELL || Effects[2].Effect == SPELL_EFFECT_LEARN_SPELL))
1672  return SPELL_CAST_OK;*/
1673 
1674  //if (HasAttribute(SPELL_ATTR13_ACTIVATES_REQUIRED_SHAPESHIFT))
1675  // return SPELL_CAST_OK;
1676 
1677  uint64 stanceMask = (form ? UI64LIT(1) << (form - 1) : 0);
1678 
1679  if (stanceMask & StancesNot) // can explicitly not be cast in this stance
1681 
1682  if (stanceMask & Stances) // can explicitly be cast in this stance
1683  return SPELL_CAST_OK;
1684 
1685  bool actAsShifted = false;
1686  SpellShapeshiftFormEntry const* shapeInfo = NULL;
1687  if (form > 0)
1688  {
1689  shapeInfo = sSpellShapeshiftFormStore.LookupEntry(form);
1690  if (!shapeInfo)
1691  {
1692  TC_LOG_ERROR("spells", "GetErrorAtShapeshiftedCast: unknown shapeshift %u", form);
1693  return SPELL_CAST_OK;
1694  }
1695  actAsShifted = !(shapeInfo->Flags & 1); // shapeshift acts as normal form for spells
1696  }
1697 
1698  if (actAsShifted)
1699  {
1700  if (Attributes & SPELL_ATTR0_NOT_SHAPESHIFT) // not while shapeshifted
1702  else if (Stances != 0) // needs other shapeshift
1704  }
1705  else
1706  {
1707  // needs shapeshift
1708  if (!(AttributesEx2 & SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && Stances != 0)
1710  }
1711 
1712  // Check if stance disables cast of not-stance spells
1713  // Example: cannot cast any other spells in zombie or ghoul form
1715  if (shapeInfo && shapeInfo->Flags & 0x400)
1716  {
1717  if (!(stanceMask & Stances))
1719  }
1720 
1721  return SPELL_CAST_OK;
1722 }
#define UI64LIT(N)
Definition: Define.h:138
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 Attributes
Definition: SpellInfo.h:333
uint64 StancesNot
Definition: SpellInfo.h:349
uint32 AttributesEx2
Definition: SpellInfo.h:335
uint64 Stances
Definition: SpellInfo.h:348
uint64_t uint64
Definition: Define.h:149
Definition: SharedDefines.h:1380
Definition: DBCStructure.h:1160
Definition: SharedDefines.h:372
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormfmt)
Definition: SharedDefines.h:1354
Definition: SharedDefines.h:1538
uint32 Flags
Definition: DBCStructure.h:1165
Definition: SharedDefines.h:447

+ Here is the caller graph for this function:

SpellCastResult SpellInfo::CheckTarget ( Unit const caster,
WorldObject const target,
bool  implicit = true 
) const
1876 {
1877  if (AttributesEx & SPELL_ATTR1_CANT_TARGET_SELF && caster == target)
1878  return SPELL_FAILED_BAD_TARGETS;
1879 
1880  // check visibility - ignore stealth for implicit (area) targets
1881  if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->CanSeeOrDetect(target, implicit))
1882  return SPELL_FAILED_BAD_TARGETS;
1883 
1884  Unit const* unitTarget = target->ToUnit();
1885 
1886  // creature/player specific target checks
1887  if (unitTarget)
1888  {
1890  {
1891  if (unitTarget->IsInCombat())
1893  // player with active pet counts as a player in combat
1894  else if (Player const* player = unitTarget->ToPlayer())
1895  if (Pet* pet = player->GetPet())
1896  if (pet->GetVictim() && !pet->HasUnitState(UNIT_STATE_CONTROLLED))
1898  }
1899 
1900  // only spells with SPELL_ATTR3_ONLY_TARGET_GHOSTS can target ghosts
1902  {
1903  if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_GHOSTS)
1905  else
1906  return SPELL_FAILED_BAD_TARGETS;
1907  }
1908 
1909  if (caster != unitTarget)
1910  {
1911  if (caster->GetTypeId() == TYPEID_PLAYER)
1912  {
1913  // Do not allow these spells to target creatures not tapped by us (Banish, Polymorph, many quest spells)
1915  if (Creature const* targetCreature = unitTarget->ToCreature())
1916  if (targetCreature->hasLootRecipient() && !targetCreature->isTappedBy(caster->ToPlayer()))
1918 
1920  {
1921  if (unitTarget->GetTypeId() == TYPEID_PLAYER)
1922  return SPELL_FAILED_BAD_TARGETS;
1923  else if ((unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) == 0)
1925  }
1926 
1927  // Not allow disarm unarmed player
1928  if (Mechanic == MECHANIC_DISARM)
1929  {
1930  if (unitTarget->GetTypeId() == TYPEID_PLAYER)
1931  {
1932  Player const* player = unitTarget->ToPlayer();
1933  if (!player->GetWeaponForAttack(BASE_ATTACK) || !player->IsUseEquipedWeapon(true))
1935  }
1936  else if (!unitTarget->GetVirtualItemId(0))
1938  }
1939  }
1940  }
1941  }
1942  // corpse specific target checks
1943  else if (Corpse const* corpseTarget = target->ToCorpse())
1944  {
1945  // cannot target bare bones
1946  if (corpseTarget->GetType() == CORPSE_BONES)
1947  return SPELL_FAILED_BAD_TARGETS;
1948  // we have to use owner for some checks (aura preventing resurrection for example)
1949  if (Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()))
1950  unitTarget = owner;
1951  // we're not interested in corpses without owner
1952  else
1953  return SPELL_FAILED_BAD_TARGETS;
1954  }
1955  // other types of objects - always valid
1956  else return SPELL_CAST_OK;
1957 
1958  // corpseOwner and unit specific target checks
1959  if (AttributesEx3 & SPELL_ATTR3_ONLY_TARGET_PLAYERS && !unitTarget->ToPlayer())
1961 
1962  if (!IsAllowingDeadTarget() && !unitTarget->IsAlive())
1964 
1965  // check this flag only for implicit targets (chain and area), allow to explicitly target units for spells like Shield of Righteousness
1966  if (implicit && AttributesEx6 & SPELL_ATTR6_CANT_TARGET_CROWD_CONTROLLED && !unitTarget->CanFreeMove())
1967  return SPELL_FAILED_BAD_TARGETS;
1968 
1969  // checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets
1970  //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE))
1971  // return SPELL_FAILED_BAD_TARGETS;
1972 
1973  //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS)
1974 
1975  if (!CheckTargetCreatureType(unitTarget))
1976  {
1977  if (target->GetTypeId() == TYPEID_PLAYER)
1979  else
1980  return SPELL_FAILED_BAD_TARGETS;
1981  }
1982 
1983  // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells
1984  if (unitTarget != caster && (caster->IsControlledByPlayer() || !IsPositive()) && unitTarget->GetTypeId() == TYPEID_PLAYER)
1985  {
1986  if (!unitTarget->ToPlayer()->IsVisible())
1988 
1989  if (unitTarget->ToPlayer()->IsGameMaster())
1991  }
1992 
1993  // not allow casting on flying player
1995  return SPELL_FAILED_BAD_TARGETS;
1996 
1997  /* TARGET_UNIT_MASTER gets blocked here for passengers, because the whole idea of this check is to
1998  not allow passengers to be implicitly hit by spells, however this target type should be an exception,
1999  if this is left it kills spells that award kill credit from vehicle to master (few spells),
2000  the use of these 2 covers passenger target check, logically, if vehicle cast this to master it should always hit
2001  him, because it would be it's passenger, there's no such case where this gets to fail legitimacy, this problem
2002  cannot be solved from within the check in other way since target type cannot be called for the spell currently
2003  Spell examples: [ID - 52864 Devour Water, ID - 52862 Devour Wind, ID - 49370 Wyrmrest Defender: Destabilize Azure Dragonshrine Effect] */
2004  if (!caster->IsVehicle() && !(caster->GetCharmerOrOwner() == target))
2005  {
2006  if (TargetAuraState && !unitTarget->HasAuraState(AuraStateType(TargetAuraState), this, caster))
2008 
2009  if (ExcludeTargetAuraState && unitTarget->HasAuraState(AuraStateType(ExcludeTargetAuraState), this, caster))
2011  }
2012 
2013  if (TargetAuraSpell && !unitTarget->HasAura(TargetAuraSpell))
2015 
2018 
2020  if (HasEffect(caster->GetMap()->GetDifficultyID(), SPELL_EFFECT_SELF_RESURRECT) || HasEffect(caster->GetMap()->GetDifficultyID(), SPELL_EFFECT_RESURRECT) || HasEffect(caster->GetMap()->GetDifficultyID(), SPELL_EFFECT_RESURRECT_NEW))
2022 
2023  return SPELL_CAST_OK;
2024 }
uint32 GetCreatureTypeMask() const
Definition: Unit.cpp:11263
Definition: SharedDefines.h:472
uint32 const CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD
Definition: SharedDefines.h:3572
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
Definition: SharedDefines.h:1395
Definition: Corpse.h:49
Definition: SpellAuraDefines.h:155
uint32 TargetAuraState
Definition: SpellInfo.h:355
Definition: SharedDefines.h:1411
uint32 AttributesEx
Definition: SpellInfo.h:334
Definition: SharedDefines.h:1287
Definition: SharedDefines.h:1104
bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto=NULL, Unit const *Caster=NULL) const
Definition: Unit.cpp:7491
AuraStateType
Definition: SharedDefines.h:1754
bool IsInCombat() const
Definition: Unit.h:1584
uint32 ExcludeTargetAuraSpell
Definition: SpellInfo.h:361
uint32 Mechanic
Definition: SpellInfo.h:332
bool CanFreeMove() const
Definition: Unit.cpp:11517
Definition: Creature.h:467
Definition: SharedDefines.h:1396
Definition: SharedDefines.h:411
uint32 AttributesEx3
Definition: SpellInfo.h:336
Definition: SharedDefines.h:1028
Player * ToPlayer()
Definition: Object.h:191
bool IsAllowingDeadTarget() const
Definition: SpellInfo.cpp:1485
bool CheckTargetCreatureType(Unit const *target) const
Definition: SpellInfo.cpp:2111
Definition: SharedDefines.h:1793
TypeID GetTypeId() const
Definition: Object.h:113
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
Definition: ObjectAccessor.cpp:209
Definition: SharedDefines.h:1431
Definition: SharedDefines.h:1280
Definition: SharedDefines.h:434
uint32 AttributesEx2
Definition: SpellInfo.h:335
bool IsPositive() const
Definition: SpellInfo.cpp:1495
Definition: SharedDefines.h:1123
bool IsAlive() const
Definition: Unit.h:1692
uint32 GetVirtualItemId(uint32 slot) const
Definition: Unit.cpp:16419
Corpse * ToCorpse()
Definition: Object.h:203
bool HasEffect(uint32 difficulty, SpellEffectName effect) const
Definition: SpellInfo.cpp:1169
Definition: Unit.h:587
Definition: SharedDefines.h:585
uint32 AttributesCu
Definition: SpellInfo.h:347
Definition: Unit.h:558
Definition: SharedDefines.h:476
Definition: ObjectGuid.h:33
Definition: SpellInfo.h:193
Creature * ToCreature()
Definition: Object.h:194
uint32 ExcludeTargetAuraState
Definition: SpellInfo.h:357
Definition: SharedDefines.h:580
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1395
uint32 AttributesEx6
Definition: SpellInfo.h:339
Definition: SharedDefines.h:1447
Definition: SharedDefines.h:1397
Definition: SharedDefines.h:1409
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4247
Definition: SharedDefines.h:400
Definition: SharedDefines.h:1493
Definition: Unit.h:1305
Definition: SpellInfo.h:200
Definition: SharedDefines.h:1538
Definition: SharedDefines.h:1404
uint32 TargetAuraSpell
Definition: SpellInfo.h:359
Unit * ToUnit()
Definition: Object.h:197
Definition: Pet.h:46
Definition: Unit.h:617
Definition: SpellAuraDefines.h:374
Definition: SharedDefines.h:1410
Definition: Corpse.h:29

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool SpellInfo::CheckTargetCreatureType ( Unit const target) const
2112 {
2113  // Curse of Doom & Exorcism: not find another way to fix spell target check :/
2114  if (SpellFamilyName == SPELLFAMILY_WARLOCK && GetCategory() == 1179)
2115  {
2116  // not allow cast at player
2117  if (target->GetTypeId() == TYPEID_PLAYER)
2118  return false;
2119  else
2120  return true;
2121  }
2122 
2123  // if target is magnet (i.e Grounding Totem) the check is skipped
2124  if (target->IsMagnet())
2125  return true;
2126 
2127  uint32 creatureType = target->GetCreatureTypeMask();
2128  return !TargetCreatureType || !creatureType || (creatureType & TargetCreatureType);
2129 }
uint32 GetCategory() const
Definition: SpellInfo.cpp:1164
Definition: SharedDefines.h:4628
uint32 SpellFamilyName
Definition: SpellInfo.h:396
uint32_t uint32
Definition: Define.h:150
Definition: ObjectGuid.h:33
uint32 TargetCreatureType
Definition: SpellInfo.h:351

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellCastResult SpellInfo::CheckVehicle ( Unit const caster) const
2062 {
2063  // All creatures should be able to cast as passengers freely, restriction and attribute are only for players
2064  if (caster->GetTypeId() != TYPEID_PLAYER)
2065  return SPELL_CAST_OK;
2066 
2067  Vehicle* vehicle = caster->GetVehicle();
2068  if (vehicle)
2069  {
2070  uint16 checkMask = 0;
2071  for (SpellEffectInfo const* effect : GetEffectsForDifficulty(caster->GetMap()->GetDifficultyID()))
2072  {
2073  if (effect && effect->ApplyAuraName == SPELL_AURA_MOD_SHAPESHIFT)
2074  {
2075  SpellShapeshiftFormEntry const* shapeShiftFromEntry = sSpellShapeshiftFormStore.LookupEntry(effect->MiscValue);
2076  if (shapeShiftFromEntry && (shapeShiftFromEntry->Flags & 1) == 0) // unk flag
2077  checkMask |= VEHICLE_SEAT_FLAG_UNCONTROLLED;
2078  break;
2079  }
2080  }
2081 
2082  if (HasAura(caster->GetMap()->GetDifficultyID(), SPELL_AURA_MOUNTED))
2084 
2085  if (!checkMask)
2086  checkMask = VEHICLE_SEAT_FLAG_CAN_ATTACK;
2087 
2088  VehicleSeatEntry const* vehicleSeat = vehicle->GetSeatForPassenger(caster);
2090  && (vehicleSeat->Flags & checkMask) != checkMask)
2092 
2093  // Can only summon uncontrolled minions/guardians when on controlled vehicle
2095  {
2096  for (SpellEffectInfo const* effect : GetEffectsForDifficulty(caster->GetMap()->GetDifficultyID()))
2097  {
2098  if (!effect || effect->Effect != SPELL_EFFECT_SUMMON)
2099  continue;
2100 
2101  SummonPropertiesEntry const* props = sSummonPropertiesStore.LookupEntry(effect->MiscValueB);
2102  if (props && props->Category != SUMMON_CATEGORY_WILD)
2104  }
2105  }
2106  }
2107 
2108  return SPELL_CAST_OK;
2109 }
Definition: DBCStructure.h:1305
Definition: Vehicle.h:32
Definition: SharedDefines.h:1477
DBCStorage< SummonPropertiesEntry > sSummonPropertiesStore(SummonPropertiesfmt)
Definition: SharedDefines.h:380
Definition: DBCEnums.h:721
Definition: DBCEnums.h:720
Definition: SharedDefines.h:1038
uint32 Attributes
Definition: SpellInfo.h:333
Definition: DBCEnums.h:737
Definition: DBCEnums.h:719
bool HasAura(uint32 difficulty, AuraType aura) const
Definition: SpellInfo.cpp:1193
VehicleSeatEntry const * GetSeatForPassenger(Unit const *passenger) const
Returns information on the seat of specified passenger, represented by the format in VehicleSeat...
Definition: Vehicle.cpp:598
Definition: SharedDefines.h:584
Definition: DBCEnums.h:718
Definition: SpellInfo.h:238
uint16_t uint16
Definition: Define.h:151
Definition: SharedDefines.h:4384
Definition: DBCStructure.h:1160
Definition: ObjectGuid.h:33
uint32 Category
Definition: DBCStructure.h:1245
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
Definition: SpellAuraDefines.h:96
uint32 AttributesEx6
Definition: SpellInfo.h:339
DBCStorage< SpellShapeshiftFormEntry > sSpellShapeshiftFormStore(SpellShapeshiftFormfmt)
uint32 Flags
Definition: DBCStructure.h:1308
Definition: SharedDefines.h:1538
Definition: SpellAuraDefines.h:138
uint32 Flags
Definition: DBCStructure.h:1165
Definition: DBCStructure.h:1242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 SpellInfo::GetAllEffectsMechanicMask ( ) const
2137 {
2138  uint32 mask = 0;
2139  if (Mechanic)
2140  mask |= 1 << Mechanic;
2141  for (SpellEffectInfoMap::const_iterator itr = _effects.begin(); itr != _effects.end(); ++itr)
2142  {
2143  for (SpellEffectInfo const* effect : itr->second)
2144  {
2145  if (effect && effect->IsEffect() && effect->Mechanic)
2146  mask |= 1 << effect->Mechanic;
2147  }
2148  }
2149  return mask;
2150 }
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
uint32 Mechanic
Definition: SpellInfo.h:332
Mechanics Mechanic
Definition: SpellInfo.h:255
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
bool IsEffect() const
Definition: SpellInfo.cpp:399

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellInfo const * SpellInfo::GetAuraRankForLevel ( uint8  level) const
2779 {
2780  // ignore passive spells
2781  if (IsPassive())
2782  return this;
2783 
2784  bool needRankSelection = false;
2786  {
2787  if (effect && IsPositiveEffect(effect->Effect) &&
2788  (effect->Effect == SPELL_EFFECT_APPLY_AURA ||
2789  effect->Effect == SPELL_EFFECT_APPLY_AREA_AURA_PARTY ||
2790  effect->Effect == SPELL_EFFECT_APPLY_AREA_AURA_RAID) &&
2791  !effect->Scaling.Coefficient)
2792  {
2793  needRankSelection = true;
2794  break;
2795  }
2796  }
2797 
2798  // not required
2799  if (!needRankSelection)
2800  return this;
2801 
2802  for (SpellInfo const* nextSpellInfo = this; nextSpellInfo != NULL; nextSpellInfo = nextSpellInfo->GetPrevRankSpell())
2803  {
2804  // if found appropriate level
2805  if (uint32(level + 10) >= nextSpellInfo->SpellLevel)
2806  return nextSpellInfo;
2807 
2808  // one rank less then
2809  }
2810 
2811  // not found
2812  return NULL;
2813 }
Definition: DBCEnums.h:404
bool IsPassive() const
Definition: SpellInfo.cpp:1403
Definition: SpellInfo.h:326
bool IsPositiveEffect(uint8 effIndex) const
Definition: SpellInfo.cpp:1500
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SharedDefines.h:1016
Definition: SharedDefines.h:1075
Definition: SpellInfo.h:238
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:1045

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

AuraStateType SpellInfo::GetAuraState ( uint32  difficulty) const
2222 {
2223  // Seals
2225  return AURA_STATE_JUDGEMENT;
2226 
2227  // Conflagrate aura state on Immolate and Shadowflame
2229  // Immolate
2230  ((SpellFamilyFlags[0] & 4) ||
2231  // Shadowflame
2232  (SpellFamilyFlags[2] & 2)))
2233  return AURA_STATE_CONFLAGRATE;
2234 
2235  // Faerie Fire (druid versions)
2236  if (SpellFamilyName == SPELLFAMILY_DRUID && SpellFamilyFlags[0] & 0x400)
2237  return AURA_STATE_FAERIE_FIRE;
2238 
2239  // Sting (hunter's pet ability)
2240  if (GetCategory() == 1133)
2241  return AURA_STATE_FAERIE_FIRE;
2242 
2243  // Victorious
2244  if (SpellFamilyName == SPELLFAMILY_WARRIOR && SpellFamilyFlags[1] & 0x00040000)
2246 
2247  // Swiftmend state on Regrowth & Rejuvenation
2249  return AURA_STATE_SWIFTMEND;
2250 
2251  // Deadly poison aura state
2252  if (SpellFamilyName == SPELLFAMILY_ROGUE && SpellFamilyFlags[0] & 0x10000)
2253  return AURA_STATE_DEADLY_POISON;
2254 
2255  // Enrage aura state
2256  if (Dispel == DISPEL_ENRAGE)
2257  return AURA_STATE_ENRAGE;
2258 
2259  // Bleeding aura state
2261  return AURA_STATE_BLEEDING;
2262 
2264  for (SpellEffectInfo const* effect : GetEffectsForDifficulty(difficulty))
2265  if (effect && effect->IsAura() && (effect->ApplyAuraName == SPELL_AURA_MOD_STUN
2266  || effect->ApplyAuraName == SPELL_AURA_MOD_ROOT))
2267  return AURA_STATE_FROZEN;
2268 
2269  switch (Id)
2270  {
2271  case 71465: // Divine Surge
2272  case 50241: // Evasive Charges
2273  return AURA_STATE_UNKNOWN22;
2274  default:
2275  break;
2276  }
2277 
2278  return AURA_STATE_NONE;
2279 }
Definition: SharedDefines.h:1762
uint32 Id
Definition: SpellInfo.h:329
Definition: SharedDefines.h:1772
uint32 GetCategory() const
Definition: SpellInfo.cpp:1164
Definition: SpellAuraDefines.h:72
Definition: SharedDefines.h:1847
flag128 SpellFamilyFlags
Definition: SpellInfo.h:397
uint32 Dispel
Definition: SpellInfo.h:331
Definition: SharedDefines.h:1768
Definition: SpellAuraDefines.h:86
Definition: SharedDefines.h:4628
Definition: SharedDefines.h:1773
Definition: SharedDefines.h:1761
Definition: SharedDefines.h:292
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: SpellInfo.h:156
Definition: SharedDefines.h:1776
Definition: SharedDefines.h:4631
Definition: SpellInfo.h:238
Definition: SharedDefines.h:1805
Definition: SharedDefines.h:4630
Definition: SharedDefines.h:1775
Definition: SharedDefines.h:1770
Definition: SharedDefines.h:1774
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2131
Definition: SharedDefines.h:4627
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
SpellSpecificType GetSpellSpecific() const
Definition: SpellInfo.cpp:2281
Definition: SharedDefines.h:1757
Definition: SharedDefines.h:1780
uint32 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2136

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 SpellInfo::GetCategory ( ) const
1165 {
1166  return CategoryEntry ? CategoryEntry->ID : 0;
1167 }
uint32 ID
Definition: DBCStructure.h:1099
SpellCategoryEntry const * CategoryEntry
Definition: SpellInfo.h:330

+ Here is the caller graph for this function:

uint32 SpellInfo::GetDispelMask ( ) const
2203 {
2204  return GetDispelMask(DispelType(Dispel));
2205 }
uint32 Dispel
Definition: SpellInfo.h:331
DispelType
Definition: SharedDefines.h:1836
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2202

+ Here is the caller graph for this function:

uint32 SpellInfo::GetDispelMask ( DispelType  type)
static
2208 {
2209  // If dispel all
2210  if (type == DISPEL_ALL)
2211  return DISPEL_ALL_MASK;
2212  else
2213  return uint32(1 << type);
2214 }
#define DISPEL_ALL_MASK
Definition: SharedDefines.h:1852
uint32_t uint32
Definition: g3dmath.h:168
Definition: SharedDefines.h:1845
int32 SpellInfo::GetDuration ( ) const
2491 {
2492  if (!DurationEntry)
2493  return 0;
2494  return (DurationEntry->Duration[0] == -1) ? -1 : abs(DurationEntry->Duration[0]);
2495 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:376
int32 Duration[3]
Definition: DB2Structure.h:1189

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellEffectInfo const * SpellInfo::GetEffect ( uint32  difficulty,
uint32  index 
) const
3349 {
3350  DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty);
3351  while (difficultyEntry)
3352  {
3353  SpellEffectInfoMap::const_iterator itr = _effects.find(difficulty);
3354  if (itr != _effects.end())
3355  if (itr->second.size() > index && itr->second[index])
3356  return itr->second[index];
3357 
3358  difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID);
3359  }
3360 
3361  SpellEffectInfoMap::const_iterator itr = _effects.find(DIFFICULTY_NONE);
3362  if (itr != _effects.end())
3363  if (itr->second.size() > index)
3364  return itr->second[index];
3365 
3366  return nullptr;
3367 }
Definition: DBCEnums.h:404
uint32 FallbackDifficultyID
Definition: DBCStructure.h:341
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
DBCStorage< DifficultyEntry > sDifficultyStore(DifficultyFmt)
Definition: DBCStructure.h:338
SpellEffectInfo const* SpellInfo::GetEffect ( uint32  index) const
inline
587 { return GetEffect(DIFFICULTY_NONE, index); }
Definition: DBCEnums.h:404
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellEffectInfo const* SpellInfo::GetEffect ( WorldObject const obj,
uint32  index 
) const
inline
588 { return GetEffect(obj->GetMap()->GetDifficultyID(), index); }
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Mechanics SpellInfo::GetEffectMechanic ( uint32  effIndex,
uint32  difficulty 
) const
2185 {
2186  SpellEffectInfo const* effect = GetEffect(difficulty, effIndex);
2187  if (effect && effect->IsEffect() && effect->Mechanic)
2188  return Mechanics(effect->Mechanic);
2189  if (Mechanic)
2190  return Mechanics(Mechanic);
2191  return MECHANIC_NONE;
2192 }
uint32 Mechanic
Definition: SpellInfo.h:332
Mechanics Mechanic
Definition: SpellInfo.h:255
Definition: SpellInfo.h:238
SpellEffectInfo const * GetEffect(uint32 difficulty, uint32 index) const
Definition: SpellInfo.cpp:3348
Mechanics
Definition: SharedDefines.h:1788
bool IsEffect() const
Definition: SpellInfo.cpp:399
Definition: SharedDefines.h:1790

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 SpellInfo::GetEffectMechanicMask ( uint32  effIndex) const
2153 {
2154  uint32 mask = 0;
2155  if (Mechanic)
2156  mask |= 1 << Mechanic;
2157  for (SpellEffectInfoMap::const_iterator itr = _effects.begin(); itr != _effects.end(); ++itr)
2158  {
2159  for (SpellEffectInfo const* effect : itr->second)
2160  {
2161  if (effect && effect->EffectIndex == effIndex && effect->IsEffect() && effect->Mechanic)
2162  mask |= 1 << effect->Mechanic;
2163  }
2164  }
2165  return mask;
2166 }
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
uint32 Mechanic
Definition: SpellInfo.h:332
uint32 EffectIndex
Definition: SpellInfo.h:242
Mechanics Mechanic
Definition: SpellInfo.h:255
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
bool IsEffect() const
Definition: SpellInfo.cpp:399

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

SpellEffectInfoVector SpellInfo::GetEffectsForDifficulty ( uint32  difficulty) const
3312 {
3313  SpellEffectInfoVector effList;
3314 
3315  // DIFFICULTY_NONE effects are the default effects, always active if current difficulty's effects don't overwrite
3316  SpellEffectInfoMap::const_iterator itr = _effects.find(DIFFICULTY_NONE);
3317  if (itr != _effects.end())
3318  effList = itr->second;
3319 
3320  // downscale difficulty if original was not found
3321  // DIFFICULTY_NONE is already in our list
3322  DifficultyEntry const* difficultyEntry = sDifficultyStore.LookupEntry(difficulty);
3323  while (difficultyEntry)
3324  {
3325  SpellEffectInfoMap::const_iterator effectItr = _effects.find(difficulty);
3326  if (effectItr != _effects.end())
3327  {
3328  for (SpellEffectInfo const* effect : effectItr->second)
3329  {
3330  // overwrite any existing effect from DIFFICULTY_NONE
3331  if (effect)
3332  {
3333  if (effect->EffectIndex >= effList.size())
3334  effList.resize(effect->EffectIndex + 1);
3335 
3336  if (!effList[effect->EffectIndex])
3337  effList[effect->EffectIndex] = effect;
3338  }
3339  }
3340  }
3341 
3342  difficultyEntry = sDifficultyStore.LookupEntry(difficultyEntry->FallbackDifficultyID);
3343  }
3344 
3345  return effList;
3346 }
Definition: DBCEnums.h:404
SpellEffectInfoMap _effects
Definition: SpellInfo.h:590
uint32 EffectIndex
Definition: SpellInfo.h:242
std::vector< SpellEffectInfo const * > SpellEffectInfoVector
Definition: SpellInfo.h:315
Definition: SpellInfo.h:238
DBCStorage< DifficultyEntry > sDifficultyStore(DifficultyFmt)
Definition: DBCStructure.h:338
uint32 SpellInfo::GetExplicitTargetMask ( ) const
2217 {
2218  return ExplicitTargetMask;
2219 }
uint32 ExplicitTargetMask
Definition: SpellInfo.h:432

+ Here is the caller graph for this function:

SpellInfo const * SpellInfo::GetFirstRankSpell ( ) const
2754 {
2755  if (!ChainEntry)
2756  return this;
2757  return ChainEntry->first;
2758 }
SpellInfo const * first
Definition: SpellMgr.h:511
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:433

+ Here is the caller graph for this function:

SpellInfo const * SpellInfo::GetLastRankSpell ( ) const
2760 {
2761  if (!ChainEntry)
2762  return NULL;
2763  return ChainEntry->last;
2764 }
arena_t NULL
Definition: jemalloc_internal.h:624
SpellInfo const * last
Definition: SpellMgr.h:512
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:433
int32 SpellInfo::GetMaxDuration ( ) const
2498 {
2499  if (!DurationEntry)
2500  return 0;
2501  return (DurationEntry->Duration[2] == -1) ? -1 : abs(DurationEntry->Duration[2]);
2502 }
G3D::Matrix abs(const G3D::Matrix &M)
Definition: Matrix.h:632
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:376
int32 Duration[3]
Definition: DB2Structure.h:1189

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float SpellInfo::GetMaxRange ( bool  positive = false,
Unit caster = NULL,
Spell spell = NULL 
) const
2476 {
2477  if (!RangeEntry)
2478  return 0.0f;
2479  float range;
2480  if (positive)
2481  range = RangeEntry->MaxRangeFriend;
2482  else
2483  range = RangeEntry->MaxRangeHostile;
2484  if (caster)
2485  if (Player* modOwner = caster->GetSpellModOwner())
2486  modOwner->ApplySpellMod(Id, SPELLMOD_RANGE, range, spell);
2487  return range;
2488 }
uint32 Id
Definition: SpellInfo.h:329
Definition: Unit.h:91
float MaxRangeFriend
Definition: DB2Structure.h:1279
float MaxRangeHostile
Definition: DB2Structure.h:1278
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:379
Player * GetSpellModOwner() const
Definition: Unit.cpp:12691

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 SpellInfo::GetMaxTicks ( uint32  difficulty) const
2533 {
2534  int32 DotDuration = GetDuration();
2535  if (DotDuration == 0)
2536  return 1;
2537 
2538  // 200% limit
2539  if (DotDuration > 30000)
2540  DotDuration = 30000;
2541 
2542  for (SpellEffectInfo const* effect : GetEffectsForDifficulty(difficulty))
2543  {
2544  if (effect && effect->Effect == SPELL_EFFECT_APPLY_AURA)
2545  switch (effect->ApplyAuraName)
2546  {
2550  if (effect->ApplyAuraPeriod != 0)
2551  return DotDuration / effect->ApplyAuraPeriod;
2552  break;
2553  }
2554  }
2555 
2556  return 6;
2557 }
Definition: SpellAuraDefines.h:68
Definition: SpellAuraDefines.h:63
Definition: SharedDefines.h:1016
int32 GetDuration() const
Definition: SpellInfo.cpp:2490
Definition: SpellInfo.h:238
int32_t int32
Definition: Define.h:146
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
Definition: SpellAuraDefines.h:113

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float SpellInfo::GetMinRange ( bool  positive = false) const
2467 {
2468  if (!RangeEntry)
2469  return 0.0f;
2470  if (positive)
2471  return RangeEntry->MinRangeFriend;
2472  return RangeEntry->MinRangeHostile;
2473 }
float MinRangeFriend
Definition: DB2Structure.h:1277
SpellRangeEntry const * RangeEntry
Definition: SpellInfo.h:379
float MinRangeHostile
Definition: DB2Structure.h:1276

+ Here is the caller graph for this function:

SpellInfo const * SpellInfo::GetNextRankSpell ( ) const
2766 {
2767  if (!ChainEntry)
2768  return NULL;
2769  return ChainEntry->next;
2770 }
arena_t NULL
Definition: jemalloc_internal.h:624
SpellInfo const * next
Definition: SpellMgr.h:510
SpellChainNode const * ChainEntry
Definition: SpellInfo.h:433

+ Here is the caller graph for this function:

SpellInfo const * SpellInfo::GetPrevRankSpell ( ) const
2772 {
2773  if (!ChainEntry)
2774  return NULL;
2775  return ChainEntry->prev;
2776 }