TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Aura Class Referenceabstract

#include <SpellAuras.h>

Public Types

typedef std::map< ObjectGuid,
AuraApplication * > 
ApplicationMap
 

Public Member Functions

 Aura (SpellInfo const *spellproto, WorldObject *owner, Unit *caster, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
 
void _InitEffects (uint32 effMask, Unit *caster, int32 *baseAmount)
 
virtual ~Aura ()
 
SpellInfo constGetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCastItemGUID () const
 
int32 GetCastItemLevel () const
 
ObjectGuid GetCasterGUID () const
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
AuraObjectType GetType () const
 
virtual void _ApplyForTarget (Unit *target, Unit *caster, AuraApplication *auraApp)
 
virtual void _UnapplyForTarget (Unit *target, Unit *caster, AuraApplication *auraApp)
 
void _Remove (AuraRemoveMode removeMode)
 
virtual void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
 
virtual void FillTargetMap (std::map< Unit *, uint32 > &targets, Unit *caster)=0
 
void UpdateTargetMap (Unit *caster, bool apply=true)
 
void _RegisterForTargets ()
 
void ApplyForTargets ()
 
void _ApplyEffectForTargets (uint8 effIndex)
 
void UpdateOwner (uint32 diff, WorldObject *owner)
 
void Update (uint32 diff, Unit *caster)
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
int32 CalcMaxDuration (Unit *caster) const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration (bool withMods=false)
 
void RefreshTimers ()
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges (Unit *caster) const
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void ModChargesDelayed (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void DropChargeDelayed (uint32 delay, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
void RefreshSpellMods ()
 
uint8 GetCasterLevel () const
 
bool HasMoreThanOneEffectForType (AuraType auraType) const
 
bool IsArea () const
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool IsRemovedOnShapeLost (Unit *target) const
 
bool CanBeSaved () const
 
bool IsRemoved () const
 
bool CanBeSentToClient () const
 
bool IsSingleTarget () const
 
bool IsSingleTargetWith (Aura const *aura) const
 
void SetIsSingleTarget (bool val)
 
void UnregisterSingleTarget ()
 
int32 CalcDispelChance (Unit *auraTarget, bool offensive) const
 
AuraKey GenerateKey (uint32 &recalculateMask) const
 Fills a helper structure containing aura primary key for character_aura, character_aura_effect, pet_aura, pet_aura_effect tables. More...
 
void SetLoadedState (int32 maxDuration, int32 duration, int32 charges, uint8 stackAmount, uint32 recalculateMask, int32 *amount)
 
bool HasEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
AuraEffectGetEffect (uint32 index) const
 
uint32 GetEffectMask () const
 
void RecalculateAmountOfEffects ()
 
void HandleAllEffects (AuraApplication *aurApp, uint8 mode, bool apply)
 
ApplicationMap constGetApplicationMap ()
 
void GetApplicationList (Unit::AuraApplicationList &applicationList) const
 
const AuraApplicationGetApplicationOfTarget (ObjectGuid guid) const
 
AuraApplicationGetApplicationOfTarget (ObjectGuid guid)
 
bool IsAppliedOnTarget (ObjectGuid guid) const
 
void SetNeedClientUpdateForTargets () const
 
void HandleAuraSpecificMods (AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
 
void HandleAuraSpecificPeriodics (AuraApplication const *aurApp, Unit *caster)
 
bool CanBeAppliedOn (Unit *target)
 
bool CheckAreaTarget (Unit *target)
 
bool CanStackWith (Aura const *existingAura) const
 
bool IsProcOnCooldown () const
 
void AddProcCooldown (uint32 msec)
 
bool IsUsingCharges () const
 
void SetUsingCharges (bool val)
 
void PrepareProcToTrigger (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
bool IsProcTriggeredOnEvent (AuraApplication *aurApp, ProcEventInfo &eventInfo) const
 
float CalcProcChance (SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
 
void TriggerProcOnEvent (AuraApplication *aurApp, ProcEventInfo &eventInfo)
 
void LoadScripts ()
 
bool CallScriptCheckAreaTargetHandlers (Unit *target)
 
void CallScriptDispel (DispelInfo *dispelInfo)
 
void CallScriptAfterDispel (DispelInfo *dispelInfo)
 
bool CallScriptEffectApplyHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
bool CallScriptEffectRemoveHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
void CallScriptAfterEffectApplyHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
void CallScriptAfterEffectRemoveHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, AuraEffectHandleModes mode)
 
bool CallScriptEffectPeriodicHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp)
 
void CallScriptEffectUpdatePeriodicHandlers (AuraEffect *aurEff)
 
void CallScriptEffectCalcAmountHandlers (AuraEffect const *aurEff, int32 &amount, bool &canBeRecalculated)
 
void CallScriptEffectCalcPeriodicHandlers (AuraEffect const *aurEff, bool &isPeriodic, int32 &amplitude)
 
void CallScriptEffectCalcSpellModHandlers (AuraEffect const *aurEff, SpellModifier *&spellMod)
 
void CallScriptEffectAbsorbHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
 
void CallScriptEffectAfterAbsorbHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
 
void CallScriptEffectManaShieldHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount, bool &defaultPrevented)
 
void CallScriptEffectAfterManaShieldHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &absorbAmount)
 
void CallScriptEffectSplitHandlers (AuraEffect *aurEff, AuraApplication const *aurApp, DamageInfo &dmgInfo, uint32 &splitAmount)
 
bool CallScriptCheckProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
bool CallScriptPrepareProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
bool CallScriptProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
void CallScriptAfterProcHandlers (AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
bool CallScriptEffectProcHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
void CallScriptAfterEffectProcHandlers (AuraEffect const *aurEff, AuraApplication const *aurApp, ProcEventInfo &eventInfo)
 
AuraScriptGetScriptByName (std::string const &scriptName) const
 
AuraEffectVector GetAuraEffects () const
 
SpellEffectInfoVector GetSpellEffectInfos () const
 
SpellEffectInfo constGetSpellEffectInfo (uint32 index) const
 

Static Public Member Functions

static uint32 BuildEffectMaskForOwner (SpellInfo const *spellProto, uint32 avalibleEffectMask, WorldObject *owner)
 
static AuraTryRefreshStackOrCreate (SpellInfo const *spellproto, uint32 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, bool *refresh=NULL, int32 castItemLevel=-1)
 
static AuraTryCreate (SpellInfo const *spellproto, uint32 tryEffMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, int32 castItemLevel=-1)
 
static AuraCreate (SpellInfo const *spellproto, uint32 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
 

Public Attributes

std::list< AuraScript * > m_loadedScripts
 

Protected Attributes

SpellInfo const *const m_spellInfo
 
ObjectGuid const m_casterGuid
 
ObjectGuid const m_castItemGuid
 
int32 m_castItemLevel
 
time_t const m_applyTime
 
WorldObject *const m_owner
 
int32 m_maxDuration
 
int32 m_duration
 
int32 m_timeCla
 
std::vector< SpellPowerEntry
const * > 
m_periodicCosts
 
int32 m_updateTargetMapInterval
 
uint8 const m_casterLevel
 
uint8 m_procCharges
 
uint8 m_stackAmount
 
ApplicationMap m_applications
 
bool m_isRemoved:1
 
bool m_isSingleTarget:1
 
bool m_isUsingCharges:1
 
ChargeDropEventm_dropEvent
 

Private Member Functions

void _DeleteRemovedApplications ()
 

Private Attributes

Unit::AuraApplicationList m_removedApplications
 
AuraEffectVector _effects
 
SpellEffectInfoVector _spelEffectInfos
 

Friends

AuraUnit::_TryStackingOrRefreshingExistingAura (SpellInfo const *newAura, uint32 effMask, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
 

Member Typedef Documentation

Constructor & Destructor Documentation

Aura::Aura ( SpellInfo const spellproto,
WorldObject owner,
Unit caster,
Item castItem,
ObjectGuid  casterGUID,
int32  castItemLevel 
)
366  :
367 m_spellInfo(spellproto), m_casterGuid(!casterGUID.IsEmpty() ? casterGUID : caster->GetGUID()),
368 m_castItemGuid(castItem ? castItem->GetGUID() : ObjectGuid::Empty), m_castItemLevel(castItemLevel),
371 m_isRemoved(false), m_isSingleTarget(false), m_isUsingCharges(false), m_dropEvent(nullptr)
372 {
373  std::vector<SpellPowerEntry const*> powers = sDB2Manager.GetSpellPowers(GetId(), caster ? caster->GetMap()->GetDifficultyID() : DIFFICULTY_NONE);
374  for (SpellPowerEntry const* power : powers)
375  if (power->ManaCostPerSecond != 0 || power->ManaCostPercentagePerSecond > 0.0f)
376  m_periodicCosts.push_back(power);
377 
378  if (!m_periodicCosts.empty())
380 
381  m_maxDuration = CalcMaxDuration(caster);
383  m_procCharges = CalcMaxCharges(caster);
385  // m_casterLevel = cast item level/caster level, caster level should be saved to db, confirmed with sniffs
386 }
Definition: DBCEnums.h:404
uint8 const m_casterLevel
Definition: SpellAuras.h:309
#define sDB2Manager
Definition: DB2Stores.h:224
time_t const m_applyTime
Definition: SpellAuras.h:300
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
int32 CalcMaxDuration() const
Definition: SpellAuras.h:161
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
uint8 m_stackAmount
Definition: SpellAuras.h:311
Map * GetMap() const
Definition: Object.h:543
uint32 SpellLevel
Definition: SpellInfo.h:375
bool m_isUsingCharges
Definition: SpellAuras.h:318
Difficulty GetDifficultyID() const
Definition: Map.h:390
bool m_isSingleTarget
Definition: SpellAuras.h:317
arena_t NULL
Definition: jemalloc_internal.h:624
uint8 CalcMaxCharges() const
Definition: SpellAuras.h:173
Definition: DB2Structure.h:1238
uint8 getLevel() const
Definition: Unit.h:1408
ChargeDropEvent * m_dropEvent
Definition: SpellAuras.h:320
bool m_isRemoved
Definition: SpellAuras.h:316
ObjectGuid const m_casterGuid
Definition: SpellAuras.h:297
std::vector< SpellPowerEntry const * > m_periodicCosts
Definition: SpellAuras.h:306
WorldObject *const m_owner
Definition: SpellAuras.h:301
ObjectGuid const & GetGUID() const
Definition: Object.h:105
int32 m_maxDuration
Definition: SpellAuras.h:303
uint8 m_procCharges
Definition: SpellAuras.h:310
Definition: Common.h:103
int32 m_duration
Definition: SpellAuras.h:304
int32 m_updateTargetMapInterval
Definition: SpellAuras.h:307
int32 m_timeCla
Definition: SpellAuras.h:305
int32 m_castItemLevel
Definition: SpellAuras.h:299
bool IsEmpty() const
Definition: ObjectGuid.h:242
ObjectGuid const m_castItemGuid
Definition: SpellAuras.h:298
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

Aura::~Aura ( )
virtual
421 {
422  // unload scripts
423  while (!m_loadedScripts.empty())
424  {
425  std::list<AuraScript*>::iterator itr = m_loadedScripts.begin();
426  (*itr)->_Unload();
427  delete (*itr);
428  m_loadedScripts.erase(itr);
429  }
430 
431  for (AuraEffect* effect : _effects)
432  delete effect;
433 
434  ASSERT(m_applications.empty());
436 }
Definition: SpellAuraEffects.h:30
AuraEffectVector _effects
Definition: SpellAuras.h:325
ApplicationMap m_applications
Definition: SpellAuras.h:314
#define ASSERT
Definition: Errors.h:55
void _DeleteRemovedApplications()
Definition: SpellAuras.cpp:1936
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

Member Function Documentation

void Aura::_ApplyEffectForTargets ( uint8  effIndex)
672 {
673  // prepare list of aura targets
674  UnitList targetList;
675  for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
676  {
677  if ((appIter->second->GetEffectsToApply() & (1 << effIndex)) && !appIter->second->HasEffect(effIndex))
678  targetList.push_back(appIter->second->GetTarget());
679  }
680 
681  // apply effect to targets
682  for (UnitList::iterator itr = targetList.begin(); itr != targetList.end(); ++itr)
683  {
684  if (GetApplicationOfTarget((*itr)->GetGUID()))
685  {
686  // owner has to be in world, or effect has to be applied to self
687  ASSERT((!GetOwner()->IsInWorld() && GetOwner() == *itr) || GetOwner()->IsInMap(*itr));
688  (*itr)->_ApplyAuraEffect(this, effIndex);
689  }
690  }
691 }
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:233
ApplicationMap m_applications
Definition: SpellAuras.h:314
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
#define ASSERT
Definition: Errors.h:55
std::list< Unit * > UnitList
Definition: Unit.h:421

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::_ApplyForTarget ( Unit target,
Unit caster,
AuraApplication auraApp 
)
virtual

Reimplemented in UnitAura.

462 {
463  ASSERT(target);
464  ASSERT(auraApp);
465  // aura mustn't be already applied on target
466  ASSERT (!IsAppliedOnTarget(target->GetGUID()) && "Aura::_ApplyForTarget: aura musn't be already applied on target");
467 
468  m_applications[target->GetGUID()] = auraApp;
469 
470  // set infinity cooldown state for spells
471  if (caster && caster->GetTypeId() == TYPEID_PLAYER)
472  {
474  {
475  Item* castItem = !m_castItemGuid.IsEmpty() ? caster->ToPlayer()->GetItemByGuid(m_castItemGuid) : NULL;
476  caster->GetSpellHistory()->StartCooldown(m_spellInfo, castItem ? castItem->GetEntry() : 0, nullptr, true);
477  }
478  }
479 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
arena_t NULL
Definition: jemalloc_internal.h:624
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
SpellHistory * GetSpellHistory()
Definition: Unit.h:1926
Definition: Item.h:259
ApplicationMap m_applications
Definition: SpellAuras.h:314
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
void StartCooldown(SpellInfo const *spellInfo, uint32 itemId, Spell *spell=nullptr, bool onHold=false)
Definition: SpellHistory.cpp:386
bool IsAppliedOnTarget(ObjectGuid guid) const
Definition: SpellAuras.h:235
#define ASSERT
Definition: Errors.h:55
uint32 GetEntry() const
Definition: Object.h:107
bool IsEmpty() const
Definition: ObjectGuid.h:242
ObjectGuid const m_castItemGuid
Definition: SpellAuras.h:298
bool IsCooldownStartedOnEvent() const
Definition: SpellInfo.cpp:1470

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::_DeleteRemovedApplications ( )
private
1937 {
1938  while (!m_removedApplications.empty())
1939  {
1940  delete m_removedApplications.front();
1941  m_removedApplications.pop_front();
1942  }
1943 }
Unit::AuraApplicationList m_removedApplications
Definition: SpellAuras.h:323

+ Here is the caller graph for this function:

void Aura::_InitEffects ( uint32  effMask,
Unit caster,
int32 baseAmount 
)
405 {
406  // shouldn't be in constructor - functions in AuraEffect::AuraEffect use polymorphism
407  _spelEffectInfos = m_spellInfo->GetEffectsForDifficulty(GetOwner()->GetMap()->GetDifficultyID());
408 
409  ASSERT(!_spelEffectInfos.empty());
410 
411  _effects.resize(GetSpellEffectInfos().size());
412 
413  for (SpellEffectInfo const* effect : GetSpellEffectInfos())
414  {
415  if (effect && effMask & (1 << effect->EffectIndex))
416  _effects[effect->EffectIndex] = new AuraEffect(this, effect->EffectIndex, baseAmount ? baseAmount + effect->EffectIndex : NULL, caster);
417  }
418 }
Definition: SpellAuraEffects.h:30
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
arena_t NULL
Definition: jemalloc_internal.h:624
AuraEffectVector _effects
Definition: SpellAuras.h:325
Definition: SpellInfo.h:238
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
SpellEffectInfoVector _spelEffectInfos
Definition: SpellAuras.h:326
SpellEffectInfoVector GetEffectsForDifficulty(uint32 difficulty) const
Definition: SpellInfo.cpp:3311
#define ASSERT
Definition: Errors.h:55
SpellEffectInfoVector GetSpellEffectInfos() const
Definition: SpellAuras.h:290

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::_RegisterForTargets ( )
inline
151 {Unit* caster = GetCaster(); UpdateTargetMap(caster, false);}
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
void UpdateTargetMap(Unit *caster, bool apply=true)
Definition: SpellAuras.cpp:531
Definition: Unit.h:1305

+ Here is the caller graph for this function:

void Aura::_Remove ( AuraRemoveMode  removeMode)
512 {
513  ASSERT (!m_isRemoved);
514  m_isRemoved = true;
515  ApplicationMap::iterator appItr = m_applications.begin();
516  for (appItr = m_applications.begin(); appItr != m_applications.end();)
517  {
518  AuraApplication * aurApp = appItr->second;
519  Unit* target = aurApp->GetTarget();
520  target->_UnapplyAura(aurApp, removeMode);
521  appItr = m_applications.begin();
522  }
523 
524  if (m_dropEvent)
525  {
526  m_dropEvent->to_Abort = true;
527  m_dropEvent = nullptr;
528  }
529 }
bool to_Abort
Definition: EventProcessor.h:48
Unit * GetTarget() const
Definition: SpellAuras.h:74
Definition: SpellAuras.h:50
ChargeDropEvent * m_dropEvent
Definition: SpellAuras.h:320
bool m_isRemoved
Definition: SpellAuras.h:316
ApplicationMap m_applications
Definition: SpellAuras.h:314
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:1305
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode)
Definition: Unit.cpp:3217

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::_UnapplyForTarget ( Unit target,
Unit caster,
AuraApplication auraApp 
)
virtual
Todo:
Figure out why this happens

Reimplemented in UnitAura.

482 {
483  ASSERT(target);
484  ASSERT(auraApp->GetRemoveMode());
485  ASSERT(auraApp);
486 
487  ApplicationMap::iterator itr = m_applications.find(target->GetGUID());
488 
490  if (itr == m_applications.end())
491  {
492  TC_LOG_ERROR("spells", "Aura::_UnapplyForTarget, target: %s, caster:%s, spell:%u was not found in owners application map!",
493  target->GetGUID().ToString().c_str(), caster ? caster->GetGUID().ToString().c_str() : "Empty", auraApp->GetBase()->GetSpellInfo()->Id);
494  ABORT();
495  }
496 
497  // aura has to be already applied
498  ASSERT(itr->second == auraApp);
499  m_applications.erase(itr);
500 
501  m_removedApplications.push_back(auraApp);
502 
503  // reset cooldown state for spells
504  if (caster && GetSpellInfo()->IsCooldownStartedOnEvent())
505  // note: item based cooldowns and cooldown spell mods with charges ignored (unknown existed cases)
507 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
uint32 Id
Definition: SpellInfo.h:329
Aura * GetBase() const
Definition: SpellAuras.h:75
void SendCooldownEvent(SpellInfo const *spellInfo, uint32 itemId=0, Spell *spell=nullptr, bool startCooldown=true)
Definition: SpellHistory.cpp:487
SpellHistory * GetSpellHistory()
Definition: Unit.h:1926
Unit::AuraApplicationList m_removedApplications
Definition: SpellAuras.h:323
ApplicationMap m_applications
Definition: SpellAuras.h:314
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define ABORT
Definition: Errors.h:56
#define ASSERT
Definition: Errors.h:55
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
AuraRemoveMode GetRemoveMode() const
Definition: SpellAuras.h:86
std::string ToString() const
Definition: ObjectGuid.cpp:99

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::AddProcCooldown ( uint32  msec)
1803 {
1804  //m_procCooldown = time(NULL) + msec;
1805 }

+ Here is the caller graph for this function:

void Aura::ApplyForTargets ( )
inline
152 {Unit* caster = GetCaster(); UpdateTargetMap(caster, true);}
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
void UpdateTargetMap(Unit *caster, bool apply=true)
Definition: SpellAuras.cpp:531
Definition: Unit.h:1305
uint32 Aura::BuildEffectMaskForOwner ( SpellInfo const spellProto,
uint32  avalibleEffectMask,
WorldObject owner 
)
static
255 {
256  ASSERT(spellProto);
257  ASSERT(owner);
258  uint32 effMask = 0;
259  switch (owner->GetTypeId())
260  {
261  case TYPEID_UNIT:
262  case TYPEID_PLAYER:
263  for (SpellEffectInfo const* effect : spellProto->GetEffectsForDifficulty(owner->GetMap()->GetDifficultyID()))
264  {
265  if (effect && effect->IsUnitOwnedAuraEffect())
266  effMask |= 1 << effect->EffectIndex;
267  }
268  break;
270  for (SpellEffectInfo const* effect : spellProto->GetEffectsForDifficulty(owner->GetMap()->GetDifficultyID()))
271  {
272  if (effect && effect->Effect == SPELL_EFFECT_PERSISTENT_AREA_AURA)
273  effMask |= 1 << effect->EffectIndex;
274  }
275  break;
276  default:
277  break;
278  }
279  return effMask & avalibleEffectMask;
280 }
Map * GetMap() const
Definition: Object.h:543
Difficulty GetDifficultyID() const
Definition: Map.h:390
Definition: ObjectGuid.h:32
TypeID GetTypeId() const
Definition: Object.h:113
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
Definition: ObjectGuid.h:33
#define ASSERT
Definition: Errors.h:55
Definition: SharedDefines.h:1037
Definition: ObjectGuid.h:35

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Aura::CalcDispelChance ( Unit auraTarget,
bool  offensive 
) const
1125 {
1126  // we assume that aura dispel chance is 100% on start
1127  // need formula for level difference based chance
1128  int32 resistChance = 0;
1129 
1130  // Apply dispel mod from aura caster
1131  if (Unit* caster = GetCaster())
1132  if (Player* modOwner = caster->GetSpellModOwner())
1133  modOwner->ApplySpellMod(GetId(), SPELLMOD_RESIST_DISPEL_CHANCE, resistChance);
1134 
1135  // Dispel resistance from target SPELL_AURA_MOD_DISPEL_RESIST
1136  // Only affects offensive dispels
1137  if (offensive && auraTarget)
1138  resistChance += auraTarget->GetTotalAuraModifier(SPELL_AURA_MOD_DISPEL_RESIST);
1139 
1140  RoundToInterval(resistChance, 0, 100);
1141  return 100 - resistChance;
1142 }
T RoundToInterval(T &num, T floor, T ceil)
Definition: Util.h:110
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
int32 GetTotalAuraModifier(AuraType auratype) const
Definition: Unit.cpp:4396
Definition: Unit.h:114
Definition: SpellAuraDefines.h:295
int32_t int32
Definition: Define.h:146
Definition: Unit.h:1305
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8 Aura::CalcMaxCharges ( Unit caster) const
875 {
876  uint32 maxProcCharges = m_spellInfo->ProcCharges;
877  if (SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId()))
878  maxProcCharges = procEntry->charges;
879 
880  if (caster)
881  if (Player* modOwner = caster->GetSpellModOwner())
882  modOwner->ApplySpellMod(GetId(), SPELLMOD_CHARGES, maxProcCharges);
883 
884  return uint8(maxProcCharges);
885 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
uint32 ProcCharges
Definition: SpellInfo.h:372
Definition: SpellMgr.h:290
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
Definition: Unit.h:90
uint8_t uint8
Definition: g3dmath.h:164
Player * GetSpellModOwner() const
Definition: Unit.cpp:12691
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8 Aura::CalcMaxCharges ( ) const
inline
173 { return CalcMaxCharges(GetCaster()); }
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
uint8 CalcMaxCharges() const
Definition: SpellAuras.h:173

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Aura::CalcMaxDuration ( ) const
inline
161 { return CalcMaxDuration(GetCaster()); }
int32 CalcMaxDuration() const
Definition: SpellAuras.h:161
Unit * GetCaster() const
Definition: SpellAuras.cpp:438

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Aura::CalcMaxDuration ( Unit caster) const
784 {
785  Player* modOwner = NULL;
786  int32 maxDuration;
787 
788  if (caster)
789  {
790  modOwner = caster->GetSpellModOwner();
791  maxDuration = caster->CalcSpellDuration(m_spellInfo);
792  }
793  else
794  maxDuration = m_spellInfo->GetDuration();
795 
797  maxDuration = -1;
798 
799  // IsPermanent() checks max duration (which we are supposed to calculate here)
800  if (maxDuration != -1 && modOwner)
801  modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, maxDuration);
802 
803  return maxDuration;
804 }
bool IsPassive() const
Definition: SpellAuras.cpp:1026
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: Unit.h:87
arena_t NULL
Definition: jemalloc_internal.h:624
int32 GetDuration() const
Definition: SpellInfo.cpp:2490
SpellDurationEntry const * DurationEntry
Definition: SpellInfo.h:376
int32_t int32
Definition: Define.h:146
int32 CalcSpellDuration(SpellInfo const *spellProto)
Definition: Unit.cpp:10939
Player * GetSpellModOwner() const
Definition: Unit.cpp:12691
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

float Aura::CalcProcChance ( SpellProcEntry const procEntry,
ProcEventInfo eventInfo 
) const
1901 {
1902  float chance = procEntry.chance;
1903  // calculate chances depending on unit with caster's data
1904  // so talents modifying chances and judgements will have properly calculated proc chance
1905  if (Unit* caster = GetCaster())
1906  {
1907  // calculate ppm chance if present and we're using weapon
1908  if (eventInfo.GetDamageInfo() && procEntry.ratePerMinute != 0)
1909  {
1910  uint32 WeaponSpeed = caster->GetAttackTime(eventInfo.GetDamageInfo()->GetAttackType());
1911  chance = caster->GetPPMProcChance(WeaponSpeed, procEntry.ratePerMinute, GetSpellInfo());
1912  }
1913  // apply chance modifer aura, applies also to ppm chance (see improved judgement of light spell)
1914  if (Player* modOwner = caster->GetSpellModOwner())
1915  modOwner->ApplySpellMod(GetId(), SPELLMOD_CHANCE_OF_SUCCESS, chance);
1916  }
1917  return chance;
1918 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
Definition: Unit.h:104
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
uint32_t uint32
Definition: Define.h:150
WeaponAttackType GetAttackType() const
Definition: Unit.h:948
Definition: Unit.h:1305
DamageInfo * GetDamageInfo() const
Definition: Unit.h:1003
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptAfterDispel ( DispelInfo dispelInfo)
1993 {
1994  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
1995  {
1996  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_DISPEL);
1997  std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->AfterDispel.end(), hookItr = (*scritr)->AfterDispel.begin();
1998  for (; hookItr != hookItrEnd; ++hookItr)
1999  hookItr->Call(*scritr, dispelInfo);
2000 
2001  (*scritr)->_FinishScriptCall();
2002  }
2003 }
Definition: SpellScript.h:459
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

void Aura::CallScriptAfterEffectApplyHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp,
AuraEffectHandleModes  mode 
)
2045 {
2046  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2047  {
2048  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp);
2049  std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin();
2050  for (; effItr != effEndItr; ++effItr)
2051  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2052  effItr->Call(*scritr, aurEff, mode);
2053 
2054  (*scritr)->_FinishScriptCall();
2055  }
2056 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:444
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptAfterEffectProcHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp,
ProcEventInfo eventInfo 
)
2307 {
2308  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2309  {
2310  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC, aurApp);
2311  std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->AfterEffectProc.end(), effItr = (*scritr)->AfterEffectProc.begin();
2312  for (; effItr != effEndItr; ++effItr)
2313  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2314  effItr->Call(*scritr, aurEff, eventInfo);
2315 
2316  (*scritr)->_FinishScriptCall();
2317  }
2318 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:465
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptAfterEffectRemoveHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp,
AuraEffectHandleModes  mode 
)
2059 {
2060  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2061  {
2062  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp);
2063  std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin();
2064  for (; effItr != effEndItr; ++effItr)
2065  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2066  effItr->Call(*scritr, aurEff, mode);
2067 
2068  (*scritr)->_FinishScriptCall();
2069  }
2070 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:446
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptAfterProcHandlers ( AuraApplication const aurApp,
ProcEventInfo eventInfo 
)
2275 {
2276  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2277  {
2278  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_AFTER_PROC, aurApp);
2279  std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->AfterProc.end(), hookItr = (*scritr)->AfterProc.begin();
2280  for (; hookItr != hookItrEnd; ++hookItr)
2281  hookItr->Call(*scritr, eventInfo);
2282 
2283  (*scritr)->_FinishScriptCall();
2284  }
2285 }
Definition: SpellScript.h:466
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

bool Aura::CallScriptCheckAreaTargetHandlers ( Unit target)
1965 {
1966  bool result = true;
1967  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
1968  {
1969  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_AREA_TARGET);
1970  std::list<AuraScript::CheckAreaTargetHandler>::iterator hookItrEnd = (*scritr)->DoCheckAreaTarget.end(), hookItr = (*scritr)->DoCheckAreaTarget.begin();
1971  for (; hookItr != hookItrEnd; ++hookItr)
1972  result &= hookItr->Call(*scritr, target);
1973 
1974  (*scritr)->_FinishScriptCall();
1975  }
1976  return result;
1977 }
Definition: SpellScript.h:457
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

bool Aura::CallScriptCheckProcHandlers ( AuraApplication const aurApp,
ProcEventInfo eventInfo 
)
2223 {
2224  bool result = true;
2225  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2226  {
2227  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_CHECK_PROC, aurApp);
2228  std::list<AuraScript::CheckProcHandler>::iterator hookItrEnd = (*scritr)->DoCheckProc.end(), hookItr = (*scritr)->DoCheckProc.begin();
2229  for (; hookItr != hookItrEnd; ++hookItr)
2230  result &= hookItr->Call(*scritr, eventInfo);
2231 
2232  (*scritr)->_FinishScriptCall();
2233  }
2234 
2235  return result;
2236 }
Definition: SpellScript.h:461
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

void Aura::CallScriptDispel ( DispelInfo dispelInfo)
1980 {
1981  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
1982  {
1983  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_DISPEL);
1984  std::list<AuraScript::AuraDispelHandler>::iterator hookItrEnd = (*scritr)->OnDispel.end(), hookItr = (*scritr)->OnDispel.begin();
1985  for (; hookItr != hookItrEnd; ++hookItr)
1986  hookItr->Call(*scritr, dispelInfo);
1987 
1988  (*scritr)->_FinishScriptCall();
1989  }
1990 }
Definition: SpellScript.h:458
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

void Aura::CallScriptEffectAbsorbHandlers ( AuraEffect aurEff,
AuraApplication const aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount,
bool defaultPrevented 
)
2149 {
2150  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2151  {
2152  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp);
2153  std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin();
2154  for (; effItr != effEndItr; ++effItr)
2155 
2156  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2157  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2158 
2159  if (!defaultPrevented)
2160  defaultPrevented = (*scritr)->_IsDefaultActionPrevented();
2161 
2162  (*scritr)->_FinishScriptCall();
2163  }
2164 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:452
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectAfterAbsorbHandlers ( AuraEffect aurEff,
AuraApplication const aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount 
)
2167 {
2168  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2169  {
2170  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp);
2171  std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin();
2172  for (; effItr != effEndItr; ++effItr)
2173  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2174  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2175 
2176  (*scritr)->_FinishScriptCall();
2177  }
2178 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:453
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectAfterManaShieldHandlers ( AuraEffect aurEff,
AuraApplication const aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount 
)
2195 {
2196  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2197  {
2198  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp);
2199  std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin();
2200  for (; effItr != effEndItr; ++effItr)
2201  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2202  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2203 
2204  (*scritr)->_FinishScriptCall();
2205  }
2206 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286
Definition: SpellScript.h:455

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CallScriptEffectApplyHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp,
AuraEffectHandleModes  mode 
)
2006 {
2007  bool preventDefault = false;
2008  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2009  {
2010  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp);
2011  std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin();
2012  for (; effItr != effEndItr; ++effItr)
2013  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2014  effItr->Call(*scritr, aurEff, mode);
2015 
2016  if (!preventDefault)
2017  preventDefault = (*scritr)->_IsDefaultActionPrevented();
2018 
2019  (*scritr)->_FinishScriptCall();
2020  }
2021 
2022  return preventDefault;
2023 }
Definition: SpellScript.h:443
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectCalcAmountHandlers ( AuraEffect const aurEff,
int32 amount,
bool canBeRecalculated 
)
2107 {
2108  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2109  {
2110  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT);
2111  std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin();
2112  for (; effItr != effEndItr; ++effItr)
2113  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2114  effItr->Call(*scritr, aurEff, amount, canBeRecalculated);
2115 
2116  (*scritr)->_FinishScriptCall();
2117  }
2118 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286
Definition: SpellScript.h:449

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectCalcPeriodicHandlers ( AuraEffect const aurEff,
bool isPeriodic,
int32 amplitude 
)
2121 {
2122  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2123  {
2124  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC);
2125  std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin();
2126  for (; effItr != effEndItr; ++effItr)
2127  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2128  effItr->Call(*scritr, aurEff, isPeriodic, amplitude);
2129 
2130  (*scritr)->_FinishScriptCall();
2131  }
2132 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:450
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectCalcSpellModHandlers ( AuraEffect const aurEff,
SpellModifier *&  spellMod 
)
2135 {
2136  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2137  {
2138  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD);
2139  std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin();
2140  for (; effItr != effEndItr; ++effItr)
2141  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2142  effItr->Call(*scritr, aurEff, spellMod);
2143 
2144  (*scritr)->_FinishScriptCall();
2145  }
2146 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:451
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectManaShieldHandlers ( AuraEffect aurEff,
AuraApplication const aurApp,
DamageInfo dmgInfo,
uint32 absorbAmount,
bool defaultPrevented 
)
2181 {
2182  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2183  {
2184  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp);
2185  std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin();
2186  for (; effItr != effEndItr; ++effItr)
2187  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2188  effItr->Call(*scritr, aurEff, dmgInfo, absorbAmount);
2189 
2190  (*scritr)->_FinishScriptCall();
2191  }
2192 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:454
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CallScriptEffectPeriodicHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp 
)
2073 {
2074  bool preventDefault = false;
2075  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2076  {
2077  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp);
2078  std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin();
2079  for (; effItr != effEndItr; ++effItr)
2080  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2081  effItr->Call(*scritr, aurEff);
2082 
2083  if (!preventDefault)
2084  preventDefault = (*scritr)->_IsDefaultActionPrevented();
2085 
2086  (*scritr)->_FinishScriptCall();
2087  }
2088 
2089  return preventDefault;
2090 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:447
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CallScriptEffectProcHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp,
ProcEventInfo eventInfo 
)
2288 {
2289  bool preventDefault = false;
2290  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2291  {
2292  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PROC, aurApp);
2293  std::list<AuraScript::EffectProcHandler>::iterator effEndItr = (*scritr)->OnEffectProc.end(), effItr = (*scritr)->OnEffectProc.begin();
2294  for (; effItr != effEndItr; ++effItr)
2295  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2296  effItr->Call(*scritr, aurEff, eventInfo);
2297 
2298  if (!preventDefault)
2299  preventDefault = (*scritr)->_IsDefaultActionPrevented();
2300 
2301  (*scritr)->_FinishScriptCall();
2302  }
2303  return preventDefault;
2304 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:464
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CallScriptEffectRemoveHandlers ( AuraEffect const aurEff,
AuraApplication const aurApp,
AuraEffectHandleModes  mode 
)
2026 {
2027  bool preventDefault = false;
2028  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2029  {
2030  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp);
2031  std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin();
2032  for (; effItr != effEndItr; ++effItr)
2033  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2034  effItr->Call(*scritr, aurEff, mode);
2035 
2036  if (!preventDefault)
2037  preventDefault = (*scritr)->_IsDefaultActionPrevented();
2038 
2039  (*scritr)->_FinishScriptCall();
2040  }
2041  return preventDefault;
2042 }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:445
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::CallScriptEffectSplitHandlers ( AuraEffect aurEff,
AuraApplication const aurApp,
DamageInfo dmgInfo,
uint32 splitAmount 
)
2209 {
2210  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2211  {
2212  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_SPLIT, aurApp);
2213  std::list<AuraScript::EffectSplitHandler>::iterator effEndItr = (*scritr)->OnEffectSplit.end(), effItr = (*scritr)->OnEffectSplit.begin();
2214  for (; effItr != effEndItr; ++effItr)
2215  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2216  effItr->Call(*scritr, aurEff, dmgInfo, splitAmount);
2217 
2218  (*scritr)->_FinishScriptCall();
2219  }
2220 }
Definition: SpellScript.h:456
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

void Aura::CallScriptEffectUpdatePeriodicHandlers ( AuraEffect aurEff)
2093 {
2094  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2095  {
2096  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC);
2097  std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin();
2098  for (; effItr != effEndItr; ++effItr)
2099  if (effItr->IsEffectAffected(m_spellInfo, aurEff->GetEffIndex()))
2100  effItr->Call(*scritr, aurEff);
2101 
2102  (*scritr)->_FinishScriptCall();
2103  }
2104 }
uint32 GetEffIndex() const
Definition: SpellAuraEffects.h:48
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellScript.h:448
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CallScriptPrepareProcHandlers ( AuraApplication const aurApp,
ProcEventInfo eventInfo 
)
2239 {
2240  bool prepare = true;
2241  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2242  {
2243  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PREPARE_PROC, aurApp);
2244  std::list<AuraScript::AuraProcHandler>::iterator effEndItr = (*scritr)->DoPrepareProc.end(), effItr = (*scritr)->DoPrepareProc.begin();
2245  for (; effItr != effEndItr; ++effItr)
2246  effItr->Call(*scritr, eventInfo);
2247 
2248  if (prepare)
2249  prepare = !(*scritr)->_IsDefaultActionPrevented();
2250 
2251  (*scritr)->_FinishScriptCall();
2252  }
2253 
2254  return prepare;
2255 }
Definition: SpellScript.h:462
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

bool Aura::CallScriptProcHandlers ( AuraApplication const aurApp,
ProcEventInfo eventInfo 
)
2258 {
2259  bool handled = false;
2260  for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end(); ++scritr)
2261  {
2262  (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_PROC, aurApp);
2263  std::list<AuraScript::AuraProcHandler>::iterator hookItrEnd = (*scritr)->OnProc.end(), hookItr = (*scritr)->OnProc.begin();
2264  for (; hookItr != hookItrEnd; ++hookItr)
2265  hookItr->Call(*scritr, eventInfo);
2266 
2267  handled |= (*scritr)->_IsDefaultActionPrevented();
2268  (*scritr)->_FinishScriptCall();
2269  }
2270 
2271  return handled;
2272 }
Definition: SpellScript.h:463
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

bool Aura::CanBeAppliedOn ( Unit target)
1634 {
1635  // unit not in world or during remove from world
1636  if (!target->IsInWorld() || target->IsDuringRemoveFromWorld())
1637  {
1638  // area auras mustn't be applied
1639  if (GetOwner() != target)
1640  return false;
1641  // do not apply non-selfcast single target auras
1643  return false;
1644  return true;
1645  }
1646  else
1647  return CheckAreaTarget(target);
1648 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool CheckAreaTarget(Unit *target)
Definition: SpellAuras.cpp:1650
bool IsDuringRemoveFromWorld() const
Definition: Unit.h:2198
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool IsSingleTarget() const
Definition: SpellInfo.cpp:1596
bool IsInWorld() const
Definition: Object.h:100
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CanBeSaved ( ) const
1037 {
1038  if (IsPassive())
1039  return false;
1040 
1041  if (GetCasterGUID() != GetOwner()->GetGUID())
1042  if (GetSpellInfo()->IsSingleTarget())
1043  return false;
1044 
1045  // Can't be saved - aura handler relies on calculated amount and changes it
1047  return false;
1048 
1049  // No point in saving this, since the stable dialog can't be open on aura load anyway.
1051  return false;
1052 
1053  // Can't save vehicle auras, it requires both caster & target to be in world
1055  return false;
1056 
1057  // Incanter's Absorbtion - considering the minimal duration and problems with aura stacking
1058  // we skip saving this aura
1059  // Also for some reason other auras put as MultiSlot crash core on keeping them after restart,
1060  // so put here only these for which you are sure they get removed
1061  switch (GetId())
1062  {
1063  case 44413: // Incanter's Absorption
1064  case 40075: // Fel Flak Fire
1065  case 55849: // Power Spark
1066  return false;
1067  }
1068 
1069  // When a druid logins, he doesnt have either eclipse power, nor the marker auras, nor the eclipse buffs. Dont save them.
1070  if (GetId() == 67483 || GetId() == 67484 || GetId() == 48517 || GetId() == 48518)
1071  return false;
1072 
1073  // don't save auras removed by proc system
1074  if (IsUsingCharges() && !GetCharges())
1075  return false;
1076 
1077  return true;
1078 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool IsPassive() const
Definition: SpellAuras.cpp:1026
bool IsSingleTarget() const
Definition: SpellAuras.h:204
Definition: SpellAuraDefines.h:309
Definition: SpellAuraDefines.h:296
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
bool IsUsingCharges() const
Definition: SpellAuras.h:250
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1186
uint8 GetCharges() const
Definition: SpellAuras.h:170
Definition: SpellAuraDefines.h:352
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

bool Aura::CanBeSentToClient ( ) const
1081 {
1082  return !IsPassive() || GetSpellInfo()->HasAreaAuraEffect(GetOwner() ? GetOwner()->GetMap()->GetDifficultyID() : DIFFICULTY_NONE)
1088 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool IsPassive() const
Definition: SpellAuras.cpp:1026
Definition: DBCEnums.h:404
Definition: SpellAuraDefines.h:471
Definition: SpellAuraDefines.h:514
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
Definition: SpellAuraDefines.h:322
Definition: SpellAuraDefines.h:390
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1186
Definition: SpellAuraDefines.h:513
bool HasAreaAuraEffect(uint32 difficulty) const
Definition: SpellInfo.cpp:1204

+ Here is the call graph for this function:

bool Aura::CanStackWith ( Aura const existingAura) const
1656 {
1657  // Can stack with self
1658  if (this == existingAura)
1659  return true;
1660 
1661  // Dynobj auras always stack
1662  if (GetType() == DYNOBJ_AURA_TYPE || existingAura->GetType() == DYNOBJ_AURA_TYPE)
1663  return true;
1664 
1665  SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo();
1666  bool sameCaster = GetCasterGUID() == existingAura->GetCasterGUID();
1667 
1668  // passive auras don't stack with another rank of the spell cast by same caster
1669  if (IsPassive() && sameCaster && m_spellInfo->IsDifferentRankOf(existingSpellInfo))
1670  return false;
1671 
1672  for (SpellEffectInfo const* effect : existingAura->GetSpellEffectInfos())
1673  {
1674  // prevent remove triggering aura by triggered aura
1675  if (effect && effect->TriggerSpell == GetId())
1676  return true;
1677  }
1678 
1679  for (SpellEffectInfo const* effect : GetSpellEffectInfos())
1680  {
1681  // prevent remove triggered aura by triggering aura refresh
1682  if (effect && effect->TriggerSpell == existingAura->GetId())
1683  return true;
1684  }
1685 
1686  // Check for custom server setting to allow tracking both Herbs and Minerals
1687  // Note: The following are client limitations and cannot be coded for:
1688  // * The minimap tracking icon will display whichever skill is activated second
1689  // * The minimap tracking list will only show a check mark next to the last skill activated
1690  // Sometimes this bugs out and doesn't switch the check mark. It has no effect on the actual tracking though.
1691  // * The minimap dots are yellow for both resources
1692  if (m_spellInfo->HasAura(GetOwner()->GetMap()->GetDifficultyID(), SPELL_AURA_TRACK_RESOURCES) && existingSpellInfo->HasAura(GetOwner()->GetMap()->GetDifficultyID(), SPELL_AURA_TRACK_RESOURCES))
1693  return sWorld->getBoolConfig(CONFIG_ALLOW_TRACK_BOTH_RESOURCES);
1694 
1695  // check spell specific stack rules
1696  if (m_spellInfo->IsAuraExclusiveBySpecificWith(existingSpellInfo)
1697  || (sameCaster && m_spellInfo->IsAuraExclusiveBySpecificPerCasterWith(existingSpellInfo)))
1698  return false;
1699 
1700  // check spell group stack rules
1701  switch (sSpellMgr->CheckSpellGroupStackRules(m_spellInfo, existingSpellInfo))
1702  {
1704  case SPELL_GROUP_STACK_RULE_EXCLUSIVE_HIGHEST: // if it reaches this point, existing aura is lower/equal
1705  return false;
1707  if (sameCaster)
1708  return false;
1709  break;
1712  default:
1713  break;
1714  }
1715 
1716  if (m_spellInfo->SpellFamilyName != existingSpellInfo->SpellFamilyName)
1717  return true;
1718 
1719  if (!sameCaster)
1720  {
1721  // Channeled auras can stack if not forbidden by db or aura type
1722  if (existingAura->GetSpellInfo()->IsChanneled())
1723  return true;
1724 
1726  return true;
1727 
1728  // check same periodic auras
1729  for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1730  {
1731  SpellEffectInfo const* effect = GetSpellEffectInfo(i);
1732  if (!effect)
1733  continue;
1734  switch (effect->ApplyAuraName)
1735  {
1736  // DOT or HOT from different casters will stack
1744  case SPELL_AURA_POWER_BURN:
1748  {
1749  SpellEffectInfo const* existingEffect = GetSpellEffectInfo(i);
1750  // periodic auras which target areas are not allowed to stack this way (replenishment for example)
1751  if (effect->IsTargetingArea() || (existingEffect && existingEffect->IsTargetingArea()))
1752  break;
1753  }
1754  return true;
1755  default:
1756  break;
1757  }
1758  }
1759  }
1760 
1761  if (HasEffectType(SPELL_AURA_CONTROL_VEHICLE) && existingAura->HasEffectType(SPELL_AURA_CONTROL_VEHICLE))
1762  {
1763  Vehicle* veh = NULL;
1764  if (GetOwner()->ToUnit())
1765  veh = GetOwner()->ToUnit()->GetVehicleKit();
1766 
1767  if (!veh) // We should probably just let it stack. Vehicle system will prevent undefined behaviour later
1768  return true;
1769 
1770  if (!veh->GetAvailableSeatCount())
1771  return false; // No empty seat available
1772 
1773  return true; // Empty seat available (skip rest)
1774  }
1775 
1776  // spell of same spell rank chain
1777  if (m_spellInfo->IsRankOf(existingSpellInfo))
1778  {
1779  // don't allow passive area auras to stack
1780  if (m_spellInfo->IsMultiSlotAura() && !IsArea())
1781  return true;
1782  if (!GetCastItemGUID().IsEmpty() && !existingAura->GetCastItemGUID().IsEmpty())
1783  if (GetCastItemGUID() != existingAura->GetCastItemGUID() && (m_spellInfo->HasAttribute(SPELL_ATTR0_CU_ENCHANT_PROC)))
1784  return true;
1785  // same spell with same caster should not stack
1786  return false;
1787  }
1788 
1789  return true;
1790 }
Definition: SpellAuraDefines.h:68
Definition: SpellAuraDefines.h:63
bool IsPassive() const
Definition: SpellAuras.cpp:1026
Definition: Vehicle.h:32
Definition: SpellAuraDefines.h:287
Definition: SpellAuraDefines.h:222
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SpellInfo.h:326
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:133
Definition: SpellAuraDefines.h:80
uint32 ApplyAuraName
Definition: SpellInfo.h:244
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SpellAuraDefines.h:549
#define sWorld
Definition: World.h:887
SpellEffectInfo const * GetSpellEffectInfo(uint32 index) const
Definition: SpellAuras.cpp:396
Definition: World.h:174
bool HasAura(uint32 difficulty, AuraType aura) const
Definition: SpellInfo.cpp:1193
bool IsMultiSlotAura() const
Definition: SpellInfo.cpp:1459
Definition: SpellInfo.h:184
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:1645
Definition: SpellAuraDefines.h:296
Definition: SpellAuraDefines.h:83
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: SpellAuraDefines.h:286
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
bool IsAuraExclusiveBySpecificWith(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:1613
#define sSpellMgr
Definition: SpellMgr.h:756
Definition: SpellInfo.h:238
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
uint32_t uint32
Definition: Define.h:150
Definition: SpellMgr.h:340
Definition: SpellAuraDefines.h:124
uint8 GetAvailableSeatCount() const
Gets the available seat count.
Definition: Vehicle.cpp:641
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1186
bool IsTargetingArea() const
Definition: SpellInfo.cpp:419
Definition: SpellAuraDefines.h:81
Definition: SpellAuraDefines.h:105
bool IsRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:2815
Definition: SpellAuraDefines.h:84
Definition: SpellMgr.h:339
bool IsArea() const
Definition: SpellAuras.cpp:1017
Definition: SharedDefines.h:471
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
Definition: SpellAuraDefines.h:113
AuraObjectType GetType() const
Definition: SpellAuras.cpp:456
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
SpellEffectInfoVector GetSpellEffectInfos() const
Definition: SpellAuras.h:290
bool IsDifferentRankOf(SpellInfo const *spellInfo) const
Definition: SpellInfo.cpp:2820
Unit * ToUnit()
Definition: Object.h:197
bool IsEmpty() const
Definition: ObjectGuid.h:242
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::CheckAreaTarget ( Unit target)
1651 {
1652  return CallScriptCheckAreaTargetHandlers(target);
1653 }
bool CallScriptCheckAreaTargetHandlers(Unit *target)
Definition: SpellAuras.cpp:1964

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Aura * Aura::Create ( SpellInfo const spellproto,
uint32  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
int32  castItemLevel 
)
static
322 {
323  ASSERT(effMask);
324  ASSERT(spellproto);
325  ASSERT(owner);
326  ASSERT(caster || !casterGUID.IsEmpty());
327  ASSERT(effMask <= MAX_EFFECT_MASK);
328  // try to get caster of aura
329  if (!casterGUID.IsEmpty())
330  {
331  if (owner->GetGUID() == casterGUID)
332  caster = owner->ToUnit();
333  else
334  caster = ObjectAccessor::GetUnit(*owner, casterGUID);
335  }
336  else
337  casterGUID = caster->GetGUID();
338 
339  // check if aura can be owned by owner
340  if (owner->isType(TYPEMASK_UNIT))
341  if (!owner->IsInWorld() || ((Unit*)owner)->IsDuringRemoveFromWorld())
342  // owner not in world so don't allow to own not self cast single target auras
343  if (casterGUID != owner->GetGUID() && spellproto->IsSingleTarget())
344  return NULL;
345 
346  Aura* aura = NULL;
347  switch (owner->GetTypeId())
348  {
349  case TYPEID_UNIT:
350  case TYPEID_PLAYER:
351  aura = new UnitAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemLevel);
352  break;
354  aura = new DynObjAura(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemLevel);
355  break;
356  default:
357  ABORT();
358  return NULL;
359  }
360  // aura can be removed in Unit::_AddAura call
361  if (aura->IsRemoved())
362  return NULL;
363  return aura;
364 }
Definition: SpellAuras.h:350
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
bool isType(uint16 mask) const
Definition: Object.h:114
Definition: ObjectGuid.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: SpellAuras.h:329
Definition: ObjectGuid.h:49
TypeID GetTypeId() const
Definition: Object.h:113
bool IsRemoved() const
Definition: SpellAuras.h:201
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: ObjectGuid.h:33
#define ABORT
Definition: Errors.h:56
#define ASSERT
Definition: Errors.h:55
bool IsInWorld() const
Definition: Object.h:100
Definition: ObjectGuid.h:35
Definition: SpellAuras.h:116
Definition: Unit.h:1305
#define MAX_EFFECT_MASK
Definition: DBCStructure.h:1027
Unit * ToUnit()
Definition: Object.h:197
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::DropCharge ( AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT)
inline
175 { return ModCharges(-1, removeMode); }
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: SpellAuras.cpp:887

+ Here is the caller graph for this function:

void Aura::DropChargeDelayed ( uint32  delay,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
917 {
918  // aura is already during delayed charge drop
919  if (m_dropEvent)
920  return;
921  // only units have events
922  Unit* owner = m_owner->ToUnit();
923  if (!owner)
924  return;
925 
926  m_dropEvent = new ChargeDropEvent(this, removeMode);
927  owner->m_Events.AddEvent(m_dropEvent, owner->m_Events.CalculateTime(delay));
928 }
EventProcessor m_Events
Definition: Unit.h:1948
void AddEvent(BasicEvent *Event, uint64 e_time, bool set_addtime=true)
Definition: EventProcessor.cpp:88
ChargeDropEvent * m_dropEvent
Definition: SpellAuras.h:320
Definition: SpellAuras.h:361
uint64 CalculateTime(uint64 t_offset) const
Definition: EventProcessor.cpp:95
WorldObject *const m_owner
Definition: SpellAuras.h:301
Definition: Unit.h:1305
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

virtual void Aura::FillTargetMap ( std::map< Unit *, uint32 > &  targets,
Unit caster 
)
pure virtual

Implemented in DynObjAura, and UnitAura.

+ Here is the caller graph for this function:

AuraKey Aura::GenerateKey ( uint32 recalculateMask) const

Fills a helper structure containing aura primary key for character_aura, character_aura_effect, pet_aura, pet_aura_effect tables.

Parameters
[out]recalculateMaskMask of effects that can be recalculated to store in database - not part of aura key.
Returns
Aura key.
1145 {
1146  AuraKey key;
1147  key.Caster = GetCasterGUID();
1148  key.Item = GetCastItemGUID();
1149  key.SpellId = GetId();
1150  key.EffectMask = 0;
1151  recalculateMask = 0;
1152  for (uint32 i = 0; i < _effects.size(); ++i)
1153  {
1154  if (AuraEffect const* effect = _effects[i])
1155  {
1156  key.EffectMask |= 1 << i;
1157  if (effect->CanBeRecalculated())
1158  recalculateMask |= 1 << i;
1159  }
1160  }
1161 
1162  return key;
1163 }
ObjectGuid Item
Definition: SpellAuras.h:99
Definition: SpellAuraEffects.h:30
ObjectGuid GetCastItemGUID() const
Definition: SpellAuras.h:133
uint32 EffectMask
Definition: SpellAuras.h:101
AuraEffectVector _effects
Definition: SpellAuras.h:325
uint32_t uint32
Definition: Define.h:150
ObjectGuid Caster
Definition: SpellAuras.h:98
uint32 SpellId
Definition: SpellAuras.h:100
Definition: SpellAuras.h:96
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::GetApplicationList ( Unit::AuraApplicationList applicationList) const
1223 {
1224  for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1225  {
1226  if (appIter->second->GetEffectMask())
1227  applicationList.push_back(appIter->second);
1228  }
1229 }
ApplicationMap m_applications
Definition: SpellAuras.h:314

+ Here is the caller graph for this function:

ApplicationMap const& Aura::GetApplicationMap ( )
inline
231 { return m_applications; }
ApplicationMap m_applications
Definition: SpellAuras.h:314

+ Here is the caller graph for this function:

const AuraApplication* Aura::GetApplicationOfTarget ( ObjectGuid  guid) const
inline
233 { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
ApplicationMap m_applications
Definition: SpellAuras.h:314

+ Here is the caller graph for this function:

AuraApplication* Aura::GetApplicationOfTarget ( ObjectGuid  guid)
inline
234 { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
ApplicationMap m_applications
Definition: SpellAuras.h:314
time_t Aura::GetApplyTime ( ) const
inline
158 { return m_applyTime; }
time_t const m_applyTime
Definition: SpellAuras.h:300

+ Here is the caller graph for this function:

AuraEffectVector Aura::GetAuraEffects ( ) const
inline
288 { return _effects; }
AuraEffectVector _effects
Definition: SpellAuras.h:325

+ Here is the caller graph for this function:

Unit * Aura::GetCaster ( ) const
439 {
440  if (GetOwner()->GetGUID() == GetCasterGUID())
441  return GetUnitOwner();
443  return aurApp->GetTarget();
444 
446 }
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Definition: SpellAuras.h:50
Unit * GetUnitOwner() const
Definition: SpellAuras.h:138
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:233
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid Aura::GetCasterGUID ( ) const
inline
135 { return m_casterGuid; }
ObjectGuid const m_casterGuid
Definition: SpellAuras.h:297

+ Here is the caller graph for this function:

uint8 Aura::GetCasterLevel ( ) const
inline
185 { return m_casterLevel; }
uint8 const m_casterLevel
Definition: SpellAuras.h:309

+ Here is the caller graph for this function:

ObjectGuid Aura::GetCastItemGUID ( ) const
inline
133 { return m_castItemGuid; }
ObjectGuid const m_castItemGuid
Definition: SpellAuras.h:298

+ Here is the caller graph for this function:

int32 Aura::GetCastItemLevel ( ) const
inline
134 { return m_castItemLevel; }
int32 m_castItemLevel
Definition: SpellAuras.h:299

+ Here is the caller graph for this function:

uint8 Aura::GetCharges ( ) const
inline
170 { return m_procCharges; }
uint8 m_procCharges
Definition: SpellAuras.h:310

+ Here is the caller graph for this function:

int32 Aura::GetDuration ( ) const
inline
163 { return m_duration; }
int32 m_duration
Definition: SpellAuras.h:304

+ Here is the caller graph for this function:

DynamicObject* Aura::GetDynobjOwner ( ) const
inline
Definition: SpellAuraDefines.h:549
Definition: DynamicObject.h:35
WorldObject *const m_owner
Definition: SpellAuras.h:301
#define ASSERT
Definition: Errors.h:55
AuraObjectType GetType() const
Definition: SpellAuras.cpp:456

+ Here is the caller graph for this function:

AuraEffect * Aura::GetEffect ( uint32  index) const
449 {
450  if (index >= _effects.size())
451  return nullptr;
452 
453  return _effects[index];
454 }
AuraEffectVector _effects
Definition: SpellAuras.h:325

+ Here is the caller graph for this function:

uint32 Aura::GetEffectMask ( ) const
1214 {
1215  uint32 effMask = 0;
1216  for (AuraEffect* effect : GetAuraEffects())
1217  if (effect)
1218  effMask |= 1 << effect->GetEffIndex();
1219  return effMask;
1220 }
Definition: SpellAuraEffects.h:30
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
uint32_t uint32
Definition: Define.h:150

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Aura::GetId ( void  ) const
inline
131 { return GetSpellInfo()->Id; }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
uint32 Id
Definition: SpellInfo.h:329

+ Here is the caller graph for this function:

int32 Aura::GetMaxDuration ( ) const
inline
159 { return m_maxDuration; }
int32 m_maxDuration
Definition: SpellAuras.h:303

+ Here is the caller graph for this function:

WorldObject* Aura::GetOwner ( ) const
inline
137 { return m_owner; }
WorldObject *const m_owner
Definition: SpellAuras.h:301

+ Here is the caller graph for this function:

AuraScript * Aura::GetScriptByName ( std::string const scriptName) const
389 {
390  for (std::list<AuraScript*>::const_iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end(); ++itr)
391  if ((*itr)->_GetScriptName()->compare(scriptName) == 0)
392  return *itr;
393  return NULL;
394 }
arena_t NULL
Definition: jemalloc_internal.h:624
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286
SpellEffectInfo const * Aura::GetSpellEffectInfo ( uint32  index) const
397 {
398  if (index >= _spelEffectInfos.size())
399  return nullptr;
400 
401  return _spelEffectInfos[index];
402 }
SpellEffectInfoVector _spelEffectInfos
Definition: SpellAuras.h:326

+ Here is the caller graph for this function:

SpellEffectInfoVector Aura::GetSpellEffectInfos ( ) const
inline
290 { return _spelEffectInfos; }
SpellEffectInfoVector _spelEffectInfos
Definition: SpellAuras.h:326

+ Here is the caller graph for this function:

SpellInfo const* Aura::GetSpellInfo ( ) const
inline
130 { return m_spellInfo; }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296

+ Here is the caller graph for this function:

uint8 Aura::GetStackAmount ( ) const
inline
179 { return m_stackAmount; }
uint8 m_stackAmount
Definition: SpellAuras.h:311

+ Here is the caller graph for this function:

AuraObjectType Aura::GetType ( ) const
457 {
459 }
Definition: SpellAuraDefines.h:549
TypeID GetTypeId() const
Definition: Object.h:113
WorldObject *const m_owner
Definition: SpellAuras.h:301
Definition: SpellAuraDefines.h:548
Definition: ObjectGuid.h:35

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Unit* Aura::GetUnitOwner ( ) const
inline
138 { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; }
WorldObject *const m_owner
Definition: SpellAuras.h:301
#define ASSERT
Definition: Errors.h:55
Definition: SpellAuraDefines.h:548
AuraObjectType GetType() const
Definition: SpellAuras.cpp:456
Definition: Unit.h:1305

+ Here is the caller graph for this function:

void Aura::HandleAllEffects ( AuraApplication aurApp,
uint8  mode,
bool  apply 
)
1206 {
1207  ASSERT (!IsRemoved());
1208  for (AuraEffect* effect : GetAuraEffects())
1209  if (effect && !IsRemoved())
1210  effect->HandleEffect(aurApp, mode, apply);
1211 }
Definition: SpellAuraEffects.h:30
void apply(T *val)
Definition: ByteConverter.h:41
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
bool IsRemoved() const
Definition: SpellAuras.h:201
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

void Aura::HandleAuraSpecificMods ( AuraApplication const aurApp,
Unit caster,
bool  apply,
bool  onReapply 
)
1239 {
1240  Unit* target = aurApp->GetTarget();
1241  AuraRemoveMode removeMode = aurApp->GetRemoveMode();
1242  // handle spell_area table
1243  SpellAreaForAreaMapBounds saBounds = sSpellMgr->GetSpellAreaForAuraMapBounds(GetId());
1244  if (saBounds.first != saBounds.second)
1245  {
1246  uint32 zone, area;
1247  target->GetZoneAndAreaId(zone, area);
1248 
1249  for (SpellAreaForAreaMap::const_iterator itr = saBounds.first; itr != saBounds.second; ++itr)
1250  {
1251  // some auras remove at aura remove
1252  if (!itr->second->IsFitToRequirements(target->ToPlayer(), zone, area))
1253  target->RemoveAurasDueToSpell(itr->second->spellId);
1254  // some auras applied at aura apply
1255  else if (itr->second->autocast)
1256  {
1257  if (!target->HasAura(itr->second->spellId))
1258  target->CastSpell(target, itr->second->spellId, true);
1259  }
1260  }
1261  }
1262 
1263  // handle spell_linked_spell table
1264  if (!onReapply)
1265  {
1266  // apply linked auras
1267  if (apply)
1268  {
1269  if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
1270  {
1271  for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1272  {
1273  if (*itr < 0)
1274  target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), true);
1275  else if (caster)
1276  caster->AddAura(*itr, target);
1277  }
1278  }
1279  }
1280  else
1281  {
1282  // remove linked auras
1283  if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(-(int32)GetId()))
1284  {
1285  for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1286  {
1287  if (*itr < 0)
1288  target->RemoveAurasDueToSpell(-(*itr));
1289  else if (removeMode != AURA_REMOVE_BY_DEATH)
1290  target->CastSpell(target, *itr, true, NULL, NULL, GetCasterGUID());
1291  }
1292  }
1293  if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
1294  {
1295  for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1296  {
1297  if (*itr < 0)
1298  target->ApplySpellImmune(GetId(), IMMUNITY_ID, -(*itr), false);
1299  else
1300  target->RemoveAura(*itr, GetCasterGUID(), 0, removeMode);
1301  }
1302  }
1303  }
1304  }
1305  else if (apply)
1306  {
1307  // modify stack amount of linked auras
1308  if (std::vector<int32> const* spellTriggered = sSpellMgr->GetSpellLinked(GetId() + SPELL_LINK_AURA))
1309  {
1310  for (std::vector<int32>::const_iterator itr = spellTriggered->begin(); itr != spellTriggered->end(); ++itr)
1311  if (*itr > 0)
1312  if (Aura* triggeredAura = target->GetAura(*itr, GetCasterGUID()))
1313  triggeredAura->ModStackAmount(GetStackAmount() - triggeredAura->GetStackAmount());
1314  }
1315  }
1316 
1317  // mods at aura apply
1318  if (apply)
1319  {
1320  switch (GetSpellInfo()->SpellFamilyName)
1321  {
1322  case SPELLFAMILY_GENERIC:
1323  switch (GetId())
1324  {
1325  case 32474: // Buffeting Winds of Susurrus
1326  if (target->GetTypeId() == TYPEID_PLAYER)
1327  target->ToPlayer()->ActivateTaxiPathTo(506, GetId());
1328  break;
1329  case 33572: // Gronn Lord's Grasp, becomes stoned
1330  if (GetStackAmount() >= 5 && !target->HasAura(33652))
1331  target->CastSpell(target, 33652, true);
1332  break;
1333  case 50836: //Petrifying Grip, becomes stoned
1334  if (GetStackAmount() >= 5 && !target->HasAura(50812))
1335  target->CastSpell(target, 50812, true);
1336  break;
1337  case 60970: // Heroic Fury (remove Intercept cooldown)
1338  if (target->GetTypeId() == TYPEID_PLAYER)
1339  target->GetSpellHistory()->ResetCooldown(20252, true);
1340  break;
1341  }
1342  break;
1343  case SPELLFAMILY_DRUID:
1344  if (!caster)
1345  break;
1346  // Rejuvenation
1347  if (GetSpellInfo()->SpellFamilyFlags[0] & 0x10 && GetEffect(EFFECT_0))
1348  {
1349  // Druid T8 Restoration 4P Bonus
1350  if (caster->HasAura(64760))
1351  {
1352  int32 heal = GetEffect(EFFECT_0)->GetAmount();
1353  caster->CastCustomSpell(target, 64801, &heal, NULL, NULL, true, NULL, GetEffect(EFFECT_0));
1354  }
1355  }
1356  break;
1357  case SPELLFAMILY_MAGE:
1358  if (!caster)
1359  break;
1360  switch (GetId())
1361  {
1362  case 12536: // Clearcasting
1363  case 12043: // Presence of Mind
1364  // Arcane Potency
1365  if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_MAGE, 2120, 0))
1366  {
1367  uint32 spellId = 0;
1368 
1369  switch (aurEff->GetId())
1370  {
1371  case 31571: spellId = 57529; break;
1372  case 31572: spellId = 57531; break;
1373  default:
1374  TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Arcane Potency (%d) found", aurEff->GetId());
1375  }
1376  if (spellId)
1377  caster->CastSpell(caster, spellId, true);
1378  }
1379  break;
1380  default:
1381  break;
1382  }
1383  break;
1384  case SPELLFAMILY_PRIEST:
1385  if (!caster)
1386  break;
1387  // Devouring Plague
1388  if (GetSpellInfo()->SpellFamilyFlags[0] & 0x02000000 && GetEffect(0))
1389  {
1390  // Improved Devouring Plague
1391  if (AuraEffect const* aurEff = caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 3790, 0))
1392  {
1393  uint32 damage = caster->SpellDamageBonusDone(target, GetSpellInfo(), GetEffect(0)->GetAmount(), DOT, GetEffect(0)->GetSpellEffectInfo());
1394  damage *= caster->SpellDamagePctDone(target, GetSpellInfo(), SPELL_DIRECT_DAMAGE);
1395  damage = target->SpellDamageBonusTaken(caster, GetSpellInfo(), damage, DOT, GetEffect(0)->GetSpellEffectInfo());
1396  int32 basepoints0 = aurEff->GetAmount() * GetEffect(0)->GetTotalTicks() * int32(damage) / 100;
1397  int32 heal = int32(CalculatePct(basepoints0, 15));
1398 
1399  caster->CastCustomSpell(target, 63675, &basepoints0, NULL, NULL, true, NULL, GetEffect(0));
1400  caster->CastCustomSpell(caster, 75999, &heal, NULL, NULL, true, NULL, GetEffect(0));
1401  }
1402  }
1403  // Power Word: Shield
1404  else if (m_spellInfo->SpellFamilyFlags[0] & 0x1 && m_spellInfo->SpellFamilyFlags[2] & 0x400 && GetEffect(0))
1405  {
1406  // Glyph of Power Word: Shield
1407  if (AuraEffect* glyph = caster->GetAuraEffect(55672, 0))
1408  {
1409  // instantly heal m_amount% of the absorb-value
1410  int32 heal = glyph->GetAmount() * GetEffect(0)->GetAmount()/100;
1411  caster->CastCustomSpell(GetUnitOwner(), 56160, &heal, nullptr, nullptr, true, nullptr, GetEffect(0));
1412  }
1413  }
1414  break;
1415  case SPELLFAMILY_ROGUE:
1416  // Sprint (skip non player cast spells by category)
1417  if (GetSpellInfo()->SpellFamilyFlags[0] & 0x40 && GetSpellInfo()->GetCategory() == 44)
1418  // in official maybe there is only one icon?
1419  if (target->HasAura(58039)) // Glyph of Blurred Speed
1420  target->CastSpell(target, 61922, true); // Sprint (waterwalk)
1421  break;
1422  }
1423  }
1424  // mods at aura remove
1425  else
1426  {
1427  switch (GetSpellInfo()->SpellFamilyName)
1428  {
1429  case SPELLFAMILY_GENERIC:
1430  switch (GetId())
1431  {
1432  case 61987: // Avenging Wrath
1433  // Remove the immunity shield marker on Avenging Wrath removal if Forbearance is not present
1434  if (target->HasAura(61988) && !target->HasAura(25771))
1435  target->RemoveAura(61988);
1436  break;
1437  default:
1438  break;
1439  }
1440  break;
1441  case SPELLFAMILY_MAGE:
1442  switch (GetId())
1443  {
1444  case 66: // Invisibility
1445  if (removeMode != AURA_REMOVE_BY_EXPIRE)
1446  break;
1447  target->CastSpell(target, 32612, true, NULL, GetEffect(1));
1448  target->CombatStop();
1449  break;
1450  default:
1451  break;
1452  }
1453  break;
1454  case SPELLFAMILY_WARLOCK:
1455  if (!caster)
1456  break;
1457  // Improved Fear
1458  if (GetSpellInfo()->SpellFamilyFlags[1] & 0x00000400)
1459  {
1460  if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_WARLOCK, 98, 0))
1461  {
1462  uint32 spellId = 0;
1463  switch (aurEff->GetId())
1464  {
1465  case 53759: spellId = 60947; break;
1466  case 53754: spellId = 60946; break;
1467  default:
1468  TC_LOG_ERROR("spells", "Aura::HandleAuraSpecificMods: Unknown rank of Improved Fear (%d) found", aurEff->GetId());
1469  }
1470  if (spellId)
1471  caster->CastSpell(target, spellId, true);
1472  }
1473  }
1474  break;
1475  case SPELLFAMILY_PRIEST:
1476  if (!caster)
1477  break;
1478  // Power word: shield
1479  if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[0] & 0x00000001)
1480  {
1481  // Rapture
1482  if (Aura const* aura = caster->GetAuraOfRankedSpell(47535))
1483  {
1484  // check cooldown
1485  if (caster->GetTypeId() == TYPEID_PLAYER)
1486  {
1487  if (caster->GetSpellHistory()->HasCooldown(aura->GetId()))
1488  {
1489  // This additional check is needed to add a minimal delay before cooldown in in effect
1490  // to allow all bubbles broken by a single damage source proc mana return
1491  if (caster->GetSpellHistory()->GetRemainingCooldown(aura->GetSpellInfo()) <= 11 * IN_MILLISECONDS)
1492  break;
1493  }
1494  else // and add if needed
1495  caster->GetSpellHistory()->AddCooldown(aura->GetId(), 0, std::chrono::seconds(12));
1496  }
1497 
1498  // effect on caster
1499  if (AuraEffect const* aurEff = aura->GetEffect(0))
1500  {
1501  float multiplier = float(aurEff->GetAmount());
1502  int32 basepoints0 = int32(CalculatePct(caster->GetMaxPower(POWER_MANA), multiplier));
1503  caster->CastCustomSpell(caster, 47755, &basepoints0, NULL, NULL, true);
1504  }
1505  }
1506  }
1507  break;
1508  case SPELLFAMILY_ROGUE:
1509  // Remove Vanish on stealth remove
1510  if (GetId() == 1784)
1511  target->RemoveAurasWithFamily(SPELLFAMILY_ROGUE, flag128(0x0000800, 0, 0, 0), target->GetGUID());
1512  break;
1513  case SPELLFAMILY_PALADIN:
1514  // Remove the immunity shield marker on Forbearance removal if AW marker is not present
1515  if (GetId() == 25771 && target->HasAura(61988) && !target->HasAura(61987))
1516  target->RemoveAura(61988);
1517  break;
1519  // Blood of the North
1520  // Reaping
1521  // Death Rune Mastery
1522  if (GetSpellInfo()->SpellIconID == 3041 || GetSpellInfo()->SpellIconID == 22 || GetSpellInfo()->SpellIconID == 2622)
1523  {
1524  if (!GetEffect(0) || GetEffect(0)->GetAuraType() != SPELL_AURA_PERIODIC_DUMMY)
1525  break;
1526  if (target->GetTypeId() != TYPEID_PLAYER)
1527  break;
1528  if (target->ToPlayer()->getClass() != CLASS_DEATH_KNIGHT)
1529  break;
1530 
1531  // aura removed - remove death runes
1532  target->ToPlayer()->RemoveRunesByAuraEffect(GetEffect(0));
1533  }
1534  break;
1535  case SPELLFAMILY_HUNTER:
1536  // Glyph of Freezing Trap
1537  if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00000008)
1538  if (caster && caster->HasAura(56845))
1539  target->CastSpell(target, 61394, true);
1540  break;
1541  }
1542  }
1543 
1544  // mods at aura apply or remove
1545  switch (GetSpellInfo()->SpellFamilyName)
1546  {
1547  case SPELLFAMILY_HUNTER:
1548  switch (GetId())
1549  {
1550  case 19574: // Bestial Wrath
1551  // The Beast Within cast on owner if talent present
1552  if (Unit* owner = target->GetOwner())
1553  {
1554  // Search talent
1555  if (owner->HasAura(34692))
1556  {
1557  if (apply)
1558  owner->CastSpell(owner, 34471, true, 0, GetEffect(0));
1559  else
1560  owner->RemoveAurasDueToSpell(34471);
1561  }
1562  }
1563  break;
1564  }
1565  break;
1566  case SPELLFAMILY_PALADIN:
1567  switch (GetId())
1568  {
1569  case 31842: // Divine Favor
1570  // Item - Paladin T10 Holy 2P Bonus
1571  if (target->HasAura(70755))
1572  {
1573  if (apply)
1574  target->CastSpell(target, 71166, true);
1575  else
1576  target->RemoveAurasDueToSpell(71166);
1577  }
1578  break;
1579  }
1580  break;
1581  }
1582 }
Definition: SpellAuraEffects.h:30
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
Definition: SharedDefines.h:4633
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
int32 GetTotalTicks() const
Definition: SpellAuraEffects.h:84
void AddCooldown(uint32 spellId, uint32 itemId, std::chrono::duration< Type, Period > cooldownDuration)
Definition: SpellHistory.h:95
Definition: SharedDefines.h:1866
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Definition: SharedDefines.h:172
void RemoveAurasWithFamily(SpellFamilyNames family, flag128 const &familyFlag, ObjectGuid casterGUID)
Definition: Unit.cpp:3847
Definition: SharedDefines.h:28
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4151
flag128 SpellFamilyFlags
Definition: SpellInfo.h:397
Aura * AddAura(uint32 spellId, Unit *target)
Definition: Unit.cpp:14463
Unit * GetUnitOwner() const
Definition: SpellAuras.h:138
Definition: SharedDefines.h:4638
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Unit.h:664
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply)
Definition: Unit.cpp:9615
Aura * GetAuraOfRankedSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4169
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3442
Definition: Unit.h:455
Definition: SharedDefines.h:4628
float seconds()
Definition: units.h:97
SpellEffectInfo const * GetSpellEffectInfo(uint32 index) const
Definition: SpellAuras.cpp:396
void apply(T *val)
Definition: ByteConverter.h:41
Definition: SharedDefines.h:4632
Player * ToPlayer()
Definition: Object.h:191
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8212
TypeID GetTypeId() const
Definition: Object.h:113
AuraEffect * GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const
Definition: Unit.cpp:4127
Definition: SharedDefines.h:4626
SpellHistory * GetSpellHistory()
Definition: Unit.h:1926
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
uint32 SpellFamilyName
Definition: SpellInfo.h:396
Definition: SpellAuraDefines.h:286
Definition: SharedDefines.h:4629
Definition: Util.h:362
Definition: SharedDefines.h:4631
int32 GetAmount() const
Definition: SpellAuraEffects.h:55
uint32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8493
#define sSpellMgr
Definition: SpellMgr.h:756
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:4630
T CalculatePct(T base, U pct)
Definition: Util.h:92
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3586
ObjectGuid GetTarget() const
Definition: Unit.h:2209
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:454
void ResetCooldown(uint32 spellId, bool update=false)
Definition: SpellHistory.cpp:549
Definition: ObjectGuid.h:33
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.cpp:1535
Definition: SharedDefines.h:4623
Definition: Unit.h:453
bool HasCooldown(SpellInfo const *spellInfo, uint32 itemId=0, bool ignoreCategoryCooldown=false) const
Definition: SpellHistory.cpp:591
Unit * GetOwner() const
Definition: Unit.cpp:7542
uint8 GetStackAmount() const
Definition: SpellAuras.h:179
Definition: Common.h:103
AuraRemoveMode
Definition: Unit.h:448
int32_t int32
Definition: g3dmath.h:167
uint32 GetRemainingCooldown(SpellInfo const *spellInfo) const
Definition: SpellHistory.cpp:612
Definition: SpellAuraDefines.h:64
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4071
std::pair< SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator > SpellAreaForAreaMapBounds
Definition: SpellMgr.h:504
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: Unit.h:663
Definition: SpellAuras.h:116
void CombatStop(bool includingCast=false)
Definition: Unit.cpp:7371
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
Definition: Unit.h:1305
void CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:869
float SpellDamagePctDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
Definition: Unit.cpp:8301
void CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=NULL, AuraEffect const *triggeredByAura=NULL, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:920
Definition: SharedDefines.h:248
Definition: SpellMgr.h:101
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::HandleAuraSpecificPeriodics ( AuraApplication const aurApp,
Unit caster 
)
1585 {
1586  Unit* target = aurApp->GetTarget();
1587 
1588  if (!caster || aurApp->GetRemoveMode())
1589  return;
1590 
1591  for (AuraEffect* effect : GetAuraEffects())
1592  {
1593  if (!effect || effect->IsAreaAuraEffect() || effect->IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
1594  continue;
1595 
1596  switch (effect->GetSpellEffectInfo()->ApplyAuraName)
1597  {
1601  {
1602  // ignore non positive values (can be result apply spellmods to aura damage
1603  uint32 damage = std::max(effect->GetAmount(), 0);
1604 
1605  // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
1606  sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
1607 
1608  effect->SetDonePct(caster->SpellDamagePctDone(target, m_spellInfo, DOT)); // Calculate done percentage first!
1609  effect->SetDamage(caster->SpellDamageBonusDone(target, m_spellInfo, damage, DOT, effect->GetSpellEffectInfo(), GetStackAmount()) * effect->GetDonePct());
1610  effect->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()));
1611  break;
1612  }
1615  {
1616  // ignore non positive values (can be result apply spellmods to aura damage
1617  uint32 damage = std::max(effect->GetAmount(), 0);
1618 
1619  // Script Hook For HandlePeriodicDamageAurasTick -- Allow scripts to change the Damage pre class mitigation calculations
1620  sScriptMgr->ModifyPeriodicDamageAurasTick(target, caster, damage);
1621 
1622  effect->SetDonePct(caster->SpellHealingPctDone(target, m_spellInfo)); // Calculate done percentage first!
1623  effect->SetDamage(caster->SpellHealingBonusDone(target, m_spellInfo, damage, DOT, effect->GetSpellEffectInfo(), GetStackAmount()) * effect->GetDonePct());
1624  effect->SetCritChance(caster->GetUnitSpellCriticalChance(target, m_spellInfo, m_spellInfo->GetSchoolMask()));
1625  break;
1626  }
1627  default:
1628  break;
1629  }
1630  }
1631 }
Definition: SpellAuraDefines.h:68
Definition: SpellAuraEffects.h:30
Definition: SpellAuraDefines.h:63
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
float SpellHealingPctDone(Unit *victim, SpellInfo const *spellProto) const
Definition: Unit.cpp:9001
Definition: SpellAuraDefines.h:80
Definition: Unit.h:664
float GetUnitSpellCriticalChance(Unit *victim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType=BASE_ATTACK) const
Definition: Unit.cpp:8648
T max(const T &x, const T &y)
Definition: g3dmath.h:320
uint32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 pdamage, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8212
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetTarget() const
Definition: Unit.h:2209
uint8 GetStackAmount() const
Definition: SpellAuras.h:179
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2131
#define sScriptMgr
Definition: ScriptMgr.h:837
Definition: SharedDefines.h:1037
Definition: SpellAuraDefines.h:113
uint32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, SpellEffectInfo const *effect, uint32 stack=1) const
Definition: Unit.cpp:8886
Definition: SpellAuraDefines.h:149
Definition: Unit.h:1305
float SpellDamagePctDone(Unit *victim, SpellInfo const *spellProto, DamageEffectType damagetype) const
Definition: Unit.cpp:8301

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::HasEffect ( uint8  effIndex) const
inline
223 { return GetEffect(effIndex) != NULL; }
arena_t NULL
Definition: jemalloc_internal.h:624
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448

+ Here is the caller graph for this function:

bool Aura::HasEffectType ( AuraType  type) const
1187 {
1188  for (AuraEffect* effect : GetAuraEffects())
1189  {
1190  if (effect && effect->GetAuraType() == type)
1191  return true;
1192  }
1193  return false;
1194 }
Definition: SpellAuraEffects.h:30
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::HasMoreThanOneEffectForType ( AuraType  auraType) const
1008 {
1009  uint32 count = 0;
1010  for (SpellEffectInfo const* effect : GetSpellEffectInfos())
1011  if (effect && HasEffect(effect->EffectIndex) && AuraType(effect->ApplyAuraName) == auraType)
1012  ++count;
1013 
1014  return count > 1;
1015 }
AuraType
Definition: SpellAuraDefines.h:58
Definition: SpellInfo.h:238
uint32_t uint32
Definition: Define.h:150
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:223
SpellEffectInfoVector GetSpellEffectInfos() const
Definition: SpellAuras.h:290

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::IsAppliedOnTarget ( ObjectGuid  guid) const
inline
235 { return m_applications.find(guid) != m_applications.end(); }
ApplicationMap m_applications
Definition: SpellAuras.h:314

+ Here is the caller graph for this function:

bool Aura::IsArea ( ) const
1018 {
1019  for (SpellEffectInfo const* effect : GetSpellEffectInfos())
1020  if (effect && HasEffect(effect->EffectIndex) && effect->IsAreaAuraEffect())
1021  return true;
1022 
1023  return false;
1024 }
Definition: SpellInfo.h:238
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:223
SpellEffectInfoVector GetSpellEffectInfos() const
Definition: SpellAuras.h:290

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::IsDeathPersistent ( ) const
1032 {
1033  return GetSpellInfo()->IsDeathPersistent();
1034 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool IsDeathPersistent() const
Definition: SpellInfo.cpp:1475

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::IsExpired ( ) const
inline
167 { return !GetDuration() && !m_dropEvent; }
ChargeDropEvent * m_dropEvent
Definition: SpellAuras.h:320
int32 GetDuration() const
Definition: SpellAuras.h:163

+ Here is the caller graph for this function:

bool Aura::IsPassive ( ) const
1027 {
1028  return GetSpellInfo()->IsPassive();
1029 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool IsPassive() const
Definition: SpellInfo.cpp:1403

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::IsPermanent ( ) const
inline
168 { return GetMaxDuration() == -1; }
int32 GetMaxDuration() const
Definition: SpellAuras.h:159

+ Here is the caller graph for this function:

bool Aura::IsProcOnCooldown ( ) const
1793 {
1794  /*if (m_procCooldown)
1795  {
1796  if (m_procCooldown > time(NULL))
1797  return true;
1798  }*/
1799  return false;
1800 }

+ Here is the caller graph for this function:

bool Aura::IsProcTriggeredOnEvent ( AuraApplication aurApp,
ProcEventInfo eventInfo 
) const
Todo:
Todo:
Todo:
this needs to be unified for all kinds of auras
1829 {
1830  SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
1831  // only auras with spell proc entry can trigger proc
1832  if (!procEntry)
1833  return false;
1834 
1835  // check if we have charges to proc with
1836  if (IsUsingCharges() && !GetCharges())
1837  return false;
1838 
1839  // check proc cooldown
1840  if (IsProcOnCooldown())
1841  return false;
1842 
1844  // something about triggered spells triggering, and add extra attack effect
1845 
1846  // do checks against db data
1847  if (!sSpellMgr->CanSpellTriggerProcOnEvent(*procEntry, eventInfo))
1848  return false;
1849 
1850  // do checks using conditions table
1851  if (!sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_SPELL_PROC, GetId(), eventInfo.GetActor(), eventInfo.GetActionTarget()))
1852  return false;
1853 
1854  // AuraScript Hook
1855  bool check = const_cast<Aura*>(this)->CallScriptCheckProcHandlers(aurApp, eventInfo);
1856  if (!check)
1857  return false;
1858 
1860  // do allow additional requirements for procs
1861  // this is needed because this is the last moment in which you can prevent aura charge drop on proc
1862  // and possibly a way to prevent default checks (if there're going to be any)
1863 
1864  // Check if current equipment meets aura requirements
1865  // do that only for passive spells
1867  Unit* target = aurApp->GetTarget();
1868  if (IsPassive() && target->GetTypeId() == TYPEID_PLAYER)
1869  {
1871  {
1872  if (target->ToPlayer()->IsInFeralForm())
1873  return false;
1874 
1875  if (eventInfo.GetDamageInfo())
1876  {
1877  WeaponAttackType attType = eventInfo.GetDamageInfo()->GetAttackType();
1878  Item* item = NULL;
1879  if (attType == BASE_ATTACK || attType == RANGED_ATTACK)
1880  item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
1881  else if (attType == OFF_ATTACK)
1882  item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
1883 
1884  if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_WEAPON || !((1 << item->GetTemplate()->GetSubClass()) & GetSpellInfo()->EquippedItemSubClassMask))
1885  return false;
1886  }
1887  }
1889  {
1890  // Check if player is wearing shield
1891  Item* item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
1892  if (!item || item->IsBroken() || item->GetTemplate()->GetClass() != ITEM_CLASS_ARMOR || !((1 << item->GetTemplate()->GetSubClass()) & GetSpellInfo()->EquippedItemSubClassMask))
1893  return false;
1894  }
1895  }
1896 
1897  return roll_chance_f(CalcProcChance(*procEntry, eventInfo));
1898 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
bool IsPassive() const
Definition: SpellAuras.cpp:1026
#define INVENTORY_SLOT_BAG_0
int32 EquippedItemClass
Definition: SpellInfo.h:385
Unit * GetTarget() const
Definition: SpellAuras.h:74
Definition: Unit.h:619
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:386
bool IsProcOnCooldown() const
Definition: SpellAuras.cpp:1792
uint32 GetClass() const
Definition: ItemTemplate.h:653
arena_t NULL
Definition: jemalloc_internal.h:624
float CalcProcChance(SpellProcEntry const &procEntry, ProcEventInfo &eventInfo) const
Definition: SpellAuras.cpp:1900
Unit * GetActionTarget() const
Definition: Unit.h:992
Definition: ConditionMgr.h:151
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
Definition: Unit.h:618
bool roll_chance_f(float chance)
Definition: Random.h:47
Definition: SpellMgr.h:290
Definition: Item.h:259
#define sSpellMgr
Definition: SpellMgr.h:756
#define sConditionMgr
Definition: ConditionMgr.h:307
bool IsUsingCharges() const
Definition: SpellAuras.h:250
WeaponAttackType GetAttackType() const
Definition: Unit.h:948
Unit * GetActor()
Definition: Unit.h:991
bool IsBroken() const
Definition: Item.h:310
Definition: ItemTemplate.h:369
Definition: ObjectGuid.h:33
uint32 GetSubClass() const
Definition: ItemTemplate.h:654
uint8 GetCharges() const
Definition: SpellAuras.h:170
bool CallScriptCheckProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2222
T check(T value)
Definition: format.h:305
Definition: SpellAuras.h:116
WeaponAttackType
Definition: Unit.h:615
Definition: Unit.h:1305
DamageInfo * GetDamageInfo() const
Definition: Unit.h:1003
Definition: ItemTemplate.h:371
Definition: Unit.h:617
uint32 GetId() const
Definition: SpellAuras.h:131
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:547

+ Here is the call graph for this function:

bool Aura::IsRemoved ( ) const
inline
201 { return m_isRemoved; }
bool m_isRemoved
Definition: SpellAuras.h:316

+ Here is the caller graph for this function:

bool Aura::IsRemovedOnShapeLost ( Unit target) const
inline
193  {
194  return GetCasterGUID() == target->GetGUID()
195  && m_spellInfo->Stances
198  }
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
uint32 Attributes
Definition: SpellInfo.h:333
uint32 AttributesEx2
Definition: SpellInfo.h:335
uint64 Stances
Definition: SpellInfo.h:348
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: SharedDefines.h:372
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:135
Definition: SharedDefines.h:447

+ Here is the call graph for this function:

bool Aura::IsSingleTarget ( ) const
inline
204 {return m_isSingleTarget; }
bool m_isSingleTarget
Definition: SpellAuras.h:317

+ Here is the caller graph for this function:

bool Aura::IsSingleTargetWith ( Aura const aura) const
1091 {
1092  // Same spell?
1093  if (GetSpellInfo()->IsRankOf(aura->GetSpellInfo()))
1094  return true;
1095 
1097  // spell with single target specific types
1098  switch (spec)
1099  {
1102  if (aura->GetSpellInfo()->GetSpellSpecific() == spec)
1103  return true;
1104  break;
1105  default:
1106  break;
1107  }
1108 
1110  return true;
1111 
1112  return false;
1113 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
Definition: SpellInfo.h:166
Definition: SpellAuraDefines.h:296
Definition: SpellInfo.h:165
bool HasEffectType(AuraType type) const
Definition: SpellAuras.cpp:1186
SpellSpecificType
Definition: SpellInfo.h:153
SpellSpecificType GetSpellSpecific() const
Definition: SpellInfo.cpp:2281

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::IsUsingCharges ( ) const
inline
250 { return m_isUsingCharges; }
bool m_isUsingCharges
Definition: SpellAuras.h:318

+ Here is the caller graph for this function:

void Aura::LoadScripts ( )
1946 {
1947  sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts);
1948  for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end();)
1949  {
1950  if (!(*itr)->_Load(this))
1951  {
1952  std::list<AuraScript*>::iterator bitr = itr;
1953  ++itr;
1954  delete (*bitr);
1955  m_loadedScripts.erase(bitr);
1956  continue;
1957  }
1958  TC_LOG_DEBUG("spells", "Aura::LoadScripts: Script `%s` for aura `%u` is loaded now", (*itr)->_GetScriptName()->c_str(), m_spellInfo->Id);
1959  (*itr)->Register();
1960  ++itr;
1961  }
1962 }
uint32 Id
Definition: SpellInfo.h:329
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:198
#define sScriptMgr
Definition: ScriptMgr.h:837
std::list< AuraScript * > m_loadedScripts
Definition: SpellAuras.h:286

+ Here is the caller graph for this function:

bool Aura::ModCharges ( int32  num,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
888 {
889  if (IsUsingCharges())
890  {
891  int32 charges = m_procCharges + num;
892  int32 maxCharges = CalcMaxCharges();
893 
894  // limit charges (only on charges increase, charges may be changed manually)
895  if ((num > 0) && (charges > int32(maxCharges)))
896  charges = maxCharges;
897  // we're out of charges, remove
898  else if (charges <= 0)
899  {
900  Remove(removeMode);
901  return true;
902  }
903 
904  SetCharges(charges);
905  }
906 
907  return false;
908 }
uint8 CalcMaxCharges() const
Definition: SpellAuras.h:173
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:864
int32_t int32
Definition: Define.h:146
bool IsUsingCharges() const
Definition: SpellAuras.h:250
uint8 m_procCharges
Definition: SpellAuras.h:310
int32_t int32
Definition: g3dmath.h:167

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::ModChargesDelayed ( int32  num,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
911 {
912  m_dropEvent = nullptr;
913  ModCharges(num, removeMode);
914 }
ChargeDropEvent * m_dropEvent
Definition: SpellAuras.h:320
bool ModCharges(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: SpellAuras.cpp:887

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Aura::ModStackAmount ( int32  num,
AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT 
)
957 {
958  int32 stackAmount = m_stackAmount + num;
959 
960  // limit the stack amount (only on stack increase, stack amount may be changed manually)
961  if ((num > 0) && (stackAmount > int32(m_spellInfo->StackAmount)))
962  {
963  // not stackable aura - set stack amount to 1
964  if (!m_spellInfo->StackAmount)
965  stackAmount = 1;
966  else
967  stackAmount = m_spellInfo->StackAmount;
968  }
969  // we're out of stacks, remove
970  else if (stackAmount <= 0)
971  {
972  Remove(removeMode);
973  return true;
974  }
975 
976  bool refresh = stackAmount >= GetStackAmount();
977 
978  // Update stack amount
979  SetStackAmount(stackAmount);
980 
981  if (refresh)
982  {
984  RefreshTimers();
985 
986  // reset charges
988  // FIXME: not a best way to synchronize charges, but works
989  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
990  if (AuraEffect* aurEff = GetEffect(i))
991  if (aurEff->GetAuraType() == SPELL_AURA_ADD_FLAT_MODIFIER || aurEff->GetAuraType() == SPELL_AURA_ADD_PCT_MODIFIER)
992  if (SpellModifier* mod = aurEff->GetSpellModifier())
993  mod->charges = GetCharges();
994  }
995 
997  return false;
998 }
Definition: SpellAuraEffects.h:30
void SetStackAmount(uint8 num)
Definition: SpellAuras.cpp:930
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
uint8 m_stackAmount
Definition: SpellAuras.h:311
Definition: Player.h:167
uint8 CalcMaxCharges() const
Definition: SpellAuras.h:173
Definition: SpellAuraDefines.h:168
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1231
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
void SetCharges(uint8 charges)
Definition: SpellAuras.cpp:864
void RefreshTimers()
Definition: SpellAuras.cpp:837
int32_t int32
Definition: Define.h:146
Definition: SpellAuraDefines.h:167
uint8 GetStackAmount() const
Definition: SpellAuras.h:179
int32_t int32
Definition: g3dmath.h:167
uint8 GetCharges() const
Definition: SpellAuras.h:170
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
uint32 StackAmount
Definition: SpellInfo.h:381
void RefreshSpellMods()
Definition: SpellAuras.cpp:1000

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::PrepareProcToTrigger ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
1808 {
1809  bool prepare = CallScriptPrepareProcHandlers(aurApp, eventInfo);
1810  if (!prepare)
1811  return;
1812 
1813  // take one charge, aura expiration will be handled in Aura::TriggerProcOnEvent (if needed)
1814  if (IsUsingCharges())
1815  {
1816  --m_procCharges;
1818  }
1819 
1820  SpellProcEntry const* procEntry = sSpellMgr->GetSpellProcEntry(GetId());
1821 
1822  ASSERT(procEntry);
1823 
1824  // cooldowns should be added to the whole aura (see 51698 area aura)
1825  AddProcCooldown(procEntry->cooldown);
1826 }
bool CallScriptPrepareProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2238
void AddProcCooldown(uint32 msec)
Definition: SpellAuras.cpp:1802
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1231
Definition: SpellMgr.h:290
#define sSpellMgr
Definition: SpellMgr.h:756
bool IsUsingCharges() const
Definition: SpellAuras.h:250
uint8 m_procCharges
Definition: SpellAuras.h:310
#define ASSERT
Definition: Errors.h:55
uint32 cooldown
Definition: SpellMgr.h:302
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

void Aura::RecalculateAmountOfEffects ( )
1197 {
1198  ASSERT (!IsRemoved());
1199  Unit* caster = GetCaster();
1200  for (AuraEffect* effect : GetAuraEffects())
1201  if (effect && !IsRemoved())
1202  effect->RecalculateAmount(caster);
1203 }
Definition: SpellAuraEffects.h:30
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
bool IsRemoved() const
Definition: SpellAuras.h:201
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:1305

+ Here is the call graph for this function:

void Aura::RefreshDuration ( bool  withMods = false)
818 {
819  Unit* caster = GetCaster();
820  if (withMods && caster)
821  {
822  int32 duration = m_spellInfo->GetMaxDuration();
823  // Calculate duration of periodics affected by haste.
825  duration = int32(duration * caster->GetFloatValue(UNIT_MOD_CAST_SPEED));
826 
827  SetMaxDuration(duration);
828  SetDuration(duration);
829  }
830  else
832 
833  if (!m_periodicCosts.empty())
835 }
Definition: SharedDefines.h:549
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
int32 GetMaxDuration() const
Definition: SpellAuras.h:159
Definition: SpellAuraDefines.h:376
void SetMaxDuration(int32 duration)
Definition: SpellAuras.h:160
Definition: UpdateFields.h:129
bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const *affectedSpell) const
Definition: Unit.cpp:4270
std::vector< SpellPowerEntry const * > m_periodicCosts
Definition: SpellAuras.h:306
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
int32_t int32
Definition: Define.h:146
int32 GetMaxDuration() const
Definition: SpellInfo.cpp:2497
Definition: Common.h:103
int32_t int32
Definition: g3dmath.h:167
int32 m_timeCla
Definition: SpellAuras.h:305
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:806
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::RefreshSpellMods ( )
1001 {
1002  for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1003  if (Player* player = appIter->second->GetTarget()->ToPlayer())
1004  player->RestoreAllSpellMods(0, this);
1005 }
ApplicationMap m_applications
Definition: SpellAuras.h:314

+ Here is the caller graph for this function:

void Aura::RefreshTimers ( )
838 {
840  bool resetPeriodic = true;
842  {
843  int32 minPeriod = m_maxDuration;
844  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
845  if (AuraEffect const* eff = GetEffect(i))
846  if (int32 period = eff->GetPeriod())
847  minPeriod = std::min(period, minPeriod);
848 
849  // If only one tick remaining, roll it over into new duration
850  if (GetDuration() <= minPeriod)
851  {
853  resetPeriodic = false;
854  }
855  }
856 
857  RefreshDuration();
858  Unit* caster = GetCaster();
859  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
860  if (HasEffect(i))
861  GetEffect(i)->CalculatePeriodic(caster, resetPeriodic, false);
862 }
Definition: SpellAuraEffects.h:30
void CalculatePeriodic(Unit *caster, bool resetPeriodicTimer=true, bool load=false)
Definition: SpellAuraEffects.cpp:728
int32 CalcMaxDuration() const
Definition: SpellAuras.h:161
SpellInfo const *const m_spellInfo
Definition: SpellAuras.h:296
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
void RefreshDuration(bool withMods=false)
Definition: SpellAuras.cpp:817
T min(const T &x, const T &y)
Definition: g3dmath.h:305
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
int32_t int32
Definition: Define.h:146
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:223
int32 GetDuration() const
Definition: SpellAuras.h:163
int32 m_maxDuration
Definition: SpellAuras.h:303
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
Definition: Unit.h:1305
Definition: SharedDefines.h:653

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void Aura::Remove ( AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT)
pure virtual

Implemented in DynObjAura, and UnitAura.

+ Here is the caller graph for this function:

void Aura::SetCharges ( uint8  charges)
865 {
866  if (m_procCharges == charges)
867  return;
868 
869  m_procCharges = charges;
872 }
bool m_isUsingCharges
Definition: SpellAuras.h:318
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1231
uint8 m_procCharges
Definition: SpellAuras.h:310

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::SetDuration ( int32  duration,
bool  withMods = false 
)
807 {
808  if (withMods)
809  if (Unit* caster = GetCaster())
810  if (Player* modOwner = caster->GetSpellModOwner())
811  modOwner->ApplySpellMod(GetId(), SPELLMOD_DURATION, duration);
812 
813  m_duration = duration;
815 }
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
Definition: Unit.h:87
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1231
int32 m_duration
Definition: SpellAuras.h:304
Definition: Unit.h:1305
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::SetIsSingleTarget ( bool  val)
inline
206 { m_isSingleTarget = val; }
bool m_isSingleTarget
Definition: SpellAuras.h:317

+ Here is the caller graph for this function:

void Aura::SetLoadedState ( int32  maxDuration,
int32  duration,
int32  charges,
uint8  stackAmount,
uint32  recalculateMask,
int32 amount 
)
1166 {
1167  m_maxDuration = maxDuration;
1168  m_duration = duration;
1169  m_procCharges = charges;
1171  m_stackAmount = stackAmount;
1172  Unit* caster = GetCaster();
1173  for (AuraEffect* effect : GetAuraEffects())
1174  {
1175  if (!effect)
1176  continue;
1177 
1178  effect->SetAmount(amount[effect->GetEffIndex()]);
1179  effect->SetCanBeRecalculated((recalculateMask & (1 << effect->GetEffIndex())) != 0);
1180  effect->CalculatePeriodic(caster, false, true);
1181  effect->CalculateSpellMod();
1182  effect->RecalculateAmount(caster);
1183  }
1184 }
Definition: SpellAuraEffects.h:30
uint8 m_stackAmount
Definition: SpellAuras.h:311
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
bool m_isUsingCharges
Definition: SpellAuras.h:318
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
int32 m_maxDuration
Definition: SpellAuras.h:303
uint8 m_procCharges
Definition: SpellAuras.h:310
int32 m_duration
Definition: SpellAuras.h:304
Definition: Unit.h:1305

+ Here is the call graph for this function:

void Aura::SetMaxDuration ( int32  duration)
inline
160 { m_maxDuration = duration; }
int32 m_maxDuration
Definition: SpellAuras.h:303

+ Here is the caller graph for this function:

void Aura::SetNeedClientUpdateForTargets ( ) const
1232 {
1233  for (ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter)
1234  appIter->second->SetNeedClientUpdate();
1235 }
ApplicationMap m_applications
Definition: SpellAuras.h:314

+ Here is the caller graph for this function:

void Aura::SetStackAmount ( uint8  num)
931 {
932  m_stackAmount = stackAmount;
933  Unit* caster = GetCaster();
934 
935  std::list<AuraApplication*> applications;
936  GetApplicationList(applications);
937 
938  for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
939  if (!(*apptItr)->GetRemoveMode())
940  HandleAuraSpecificMods(*apptItr, caster, false, true);
941 
942  for (AuraEffect* effect : GetAuraEffects())
943  if (effect)
944  effect->ChangeAmount(effect->CalculateAmount(caster), false, true);
945 
946  for (std::list<AuraApplication*>::const_iterator apptItr = applications.begin(); apptItr != applications.end(); ++apptItr)
947  if (!(*apptItr)->GetRemoveMode())
948  {
949  HandleAuraSpecificMods(*apptItr, caster, true, true);
950  HandleAuraSpecificPeriodics(*apptItr, caster);
951  }
952 
954 }
Definition: SpellAuraEffects.h:30
uint8 m_stackAmount
Definition: SpellAuras.h:311
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
void GetApplicationList(Unit::AuraApplicationList &applicationList) const
Definition: SpellAuras.cpp:1222
void HandleAuraSpecificMods(AuraApplication const *aurApp, Unit *caster, bool apply, bool onReapply)
Definition: SpellAuras.cpp:1238
void HandleAuraSpecificPeriodics(AuraApplication const *aurApp, Unit *caster)
Definition: SpellAuras.cpp:1584
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
void SetNeedClientUpdateForTargets() const
Definition: SpellAuras.cpp:1231
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::SetUsingCharges ( bool  val)
inline
251 { m_isUsingCharges = val; }
bool m_isUsingCharges
Definition: SpellAuras.h:318

+ Here is the caller graph for this function:

void Aura::TriggerProcOnEvent ( AuraApplication aurApp,
ProcEventInfo eventInfo 
)
1921 {
1922  CallScriptProcHandlers(aurApp, eventInfo);
1923 
1924  for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
1925  if (aurApp->HasEffect(i))
1926  // OnEffectProc / AfterEffectProc hooks handled in AuraEffect::HandleProc()
1927  GetEffect(i)->HandleProc(aurApp, eventInfo);
1928 
1929  CallScriptAfterProcHandlers(aurApp, eventInfo);
1930 
1931  // Remove aura if we've used last charge to proc
1932  if (IsUsingCharges() && !GetCharges())
1933  Remove();
1934 }
void CallScriptAfterProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2274
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
void HandleProc(AuraApplication *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuraEffects.cpp:1217
bool CallScriptProcHandlers(AuraApplication const *aurApp, ProcEventInfo &eventInfo)
Definition: SpellAuras.cpp:2257
AuraEffect * GetEffect(uint32 index) const
Definition: SpellAuras.cpp:448
bool HasEffect(uint8 effect) const
Definition: SpellAuras.h:80
bool IsUsingCharges() const
Definition: SpellAuras.h:250
uint8 GetCharges() const
Definition: SpellAuras.h:170
uint8_t uint8
Definition: Define.h:152
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026

+ Here is the call graph for this function:

Aura * Aura::TryCreate ( SpellInfo const spellproto,
uint32  tryEffMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem = NULL,
ObjectGuid  casterGUID = ObjectGuid::Empty,
int32  castItemLevel = -1 
)
static
310 {
311  ASSERT(spellproto);
312  ASSERT(owner);
313  ASSERT(caster || !casterGUID.IsEmpty());
314  ASSERT(tryEffMask <= MAX_EFFECT_MASK);
315  uint32 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
316  if (!effMask)
317  return NULL;
318  return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemLevel);
319 }
arena_t NULL
Definition: jemalloc_internal.h:624
uint32_t uint32
Definition: Define.h:150
#define ASSERT
Definition: Errors.h:55
static Aura * Create(SpellInfo const *spellproto, uint32 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
Definition: SpellAuras.cpp:321
static uint32 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint32 avalibleEffectMask, WorldObject *owner)
Definition: SpellAuras.cpp:254
#define MAX_EFFECT_MASK
Definition: DBCStructure.h:1027
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Aura * Aura::TryRefreshStackOrCreate ( SpellInfo const spellproto,
uint32  tryEffMask,
WorldObject owner,
Unit caster,
int32 baseAmount = NULL,
Item castItem = NULL,
ObjectGuid  casterGUID = ObjectGuid::Empty,
bool refresh = NULL,
int32  castItemLevel = -1 
)
static
283 {
284  ASSERT(spellproto);
285  ASSERT(owner);
286  ASSERT(caster || !casterGUID.IsEmpty());
287  ASSERT(tryEffMask <= MAX_EFFECT_MASK);
288  if (refresh)
289  *refresh = false;
290  uint32 effMask = Aura::BuildEffectMaskForOwner(spellproto, tryEffMask, owner);
291  if (!effMask)
292  return NULL;
293 
294  if (Aura* foundAura = owner->ToUnit()->_TryStackingOrRefreshingExistingAura(spellproto, effMask, caster, baseAmount, castItem, casterGUID, castItemLevel))
295  {
296  // we've here aura, which script triggered removal after modding stack amount
297  // check the state here, so we won't create new Aura object
298  if (foundAura->IsRemoved())
299  return NULL;
300 
301  if (refresh)
302  *refresh = true;
303  return foundAura;
304  }
305  else
306  return Create(spellproto, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemLevel);
307 }
arena_t NULL
Definition: jemalloc_internal.h:624
Aura * _TryStackingOrRefreshingExistingAura(SpellInfo const *newAura, uint32 effMask, Unit *caster, int32 *baseAmount=NULL, Item *castItem=NULL, ObjectGuid casterGUID=ObjectGuid::Empty, int32 castItemLevel=-1)
Definition: Unit.cpp:3024
uint32_t uint32
Definition: Define.h:150
#define ASSERT
Definition: Errors.h:55
static Aura * Create(SpellInfo const *spellproto, uint32 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
Definition: SpellAuras.cpp:321
Definition: SpellAuras.h:116
static uint32 BuildEffectMaskForOwner(SpellInfo const *spellProto, uint32 avalibleEffectMask, WorldObject *owner)
Definition: SpellAuras.cpp:254
#define MAX_EFFECT_MASK
Definition: DBCStructure.h:1027
Unit * ToUnit()
Definition: Object.h:197
bool IsEmpty() const
Definition: ObjectGuid.h:242

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::UnregisterSingleTarget ( )
1116 {
1118  Unit* caster = GetCaster();
1119  ASSERT(caster);
1120  caster->GetSingleCastAuras().remove(this);
1121  SetIsSingleTarget(false);
1122 }
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
void SetIsSingleTarget(bool val)
Definition: SpellAuras.h:206
bool m_isSingleTarget
Definition: SpellAuras.h:317
AuraList & GetSingleCastAuras()
Definition: Unit.h:1833
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:1305

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::Update ( uint32  diff,
Unit caster 
)
732 {
733  if (m_duration > 0)
734  {
735  m_duration -= diff;
736  if (m_duration < 0)
737  m_duration = 0;
738 
739  // handle manaPerSecond/manaPerSecondPerLevel
740  if (m_timeCla)
741  {
742  if (m_timeCla > int32(diff))
743  m_timeCla -= diff;
744  else if (caster)
745  {
746  if (!m_periodicCosts.empty())
747  {
748  m_timeCla += 1000 - diff;
749 
750  for (SpellPowerEntry const* power : m_periodicCosts)
751  {
752  if (power->RequiredAura && !caster->HasAura(power->RequiredAura))
753  continue;
754 
755  int32 manaPerSecond = power->ManaCostPerSecond;
756  Powers powertype = Powers(power->PowerType);
757  if (powertype != POWER_HEALTH)
758  manaPerSecond += int32(CalculatePct(caster->GetMaxPower(powertype), power->ManaCostPercentagePerSecond));
759  else
760  manaPerSecond += int32(CalculatePct(caster->GetMaxHealth(), power->ManaCostPercentagePerSecond));
761 
762  if (manaPerSecond)
763  {
764  if (powertype == POWER_HEALTH)
765  {
766  if (int32(caster->GetHealth()) > manaPerSecond)
767  caster->ModifyHealth(-manaPerSecond);
768  else
769  Remove();
770  }
771  else if (int32(caster->GetPower(powertype)) >= manaPerSecond)
772  caster->ModifyPower(powertype, -manaPerSecond);
773  else
774  Remove();
775  }
776  }
777  }
778  }
779  }
780  }
781 }
int32 ModifyPower(Powers power, int32 val)
Definition: Unit.cpp:10285
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4240
uint32 GetMaxHealth() const
Definition: Unit.h:1427
int32 ModifyHealth(int32 val)
Definition: Unit.cpp:10216
virtual void Remove(AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)=0
int32 GetPower(Powers power) const
Definition: Unit.cpp:11589
Definition: DB2Structure.h:1238
Powers
Definition: SharedDefines.h:246
std::vector< SpellPowerEntry const * > m_periodicCosts
Definition: SpellAuras.h:306
int32_t int32
Definition: Define.h:146
T CalculatePct(T base, U pct)
Definition: Util.h:92
int32 m_duration
Definition: SpellAuras.h:304
int32_t int32
Definition: g3dmath.h:167
int32 m_timeCla
Definition: SpellAuras.h:305
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:11598
uint32 GetHealth() const
Definition: Unit.h:1426
Definition: SharedDefines.h:267

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::UpdateOwner ( uint32  diff,
WorldObject owner 
)
693 {
694  ASSERT(owner == m_owner);
695 
696  Unit* caster = GetCaster();
697  // Apply spellmods for channeled auras
698  // used for example when triggered spell of spell:10 is modded
699  Spell* modSpell = NULL;
700  Player* modOwner = NULL;
701  if (caster)
702  {
703  modOwner = caster->GetSpellModOwner();
704  if (modOwner)
705  {
706  modSpell = modOwner->FindCurrentSpellBySpellId(GetId());
707  if (modSpell)
708  modOwner->SetSpellModTakingSpell(modSpell, true);
709  }
710  }
711 
712  Update(diff, caster);
713 
714  if (m_updateTargetMapInterval <= int32(diff))
715  UpdateTargetMap(caster);
716  else
718 
719  // update aura effects
720  for (AuraEffect* effect : GetAuraEffects())
721  if (effect)
722  effect->Update(diff, caster);
723 
724  // remove spellmods after effects update
725  if (modSpell)
726  modOwner->SetSpellModTakingSpell(modSpell, false);
727 
729 }
Definition: SpellAuraEffects.h:30
Unit * GetCaster() const
Definition: SpellAuras.cpp:438
arena_t NULL
Definition: jemalloc_internal.h:624
AuraEffectVector GetAuraEffects() const
Definition: SpellAuras.h:288
void UpdateTargetMap(Unit *caster, bool apply=true)
Definition: SpellAuras.cpp:531
WorldObject *const m_owner
Definition: SpellAuras.h:301
Player * GetSpellModOwner() const
Definition: Unit.cpp:12691
int32 m_updateTargetMapInterval
Definition: SpellAuras.h:307
int32_t int32
Definition: g3dmath.h:167
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:1305
void _DeleteRemovedApplications()
Definition: SpellAuras.cpp:1936
void Update(uint32 diff, Unit *caster)
Definition: SpellAuras.cpp:731
uint32 GetId() const
Definition: SpellAuras.h:131
Definition: Spell.h:294

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Aura::UpdateTargetMap ( Unit caster,
bool  apply = true 
)
Todo:
There is a crash caused by shadowfiend load addon
532 {
533  if (IsRemoved())
534  return;
535 
537 
538  // fill up to date target list
539  // target, effMask
540  std::map<Unit*, uint32> targets;
541 
542  FillTargetMap(targets, caster);
543 
544  UnitList targetsToRemove;
545 
546  // mark all auras as ready to remove
547  for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end();++appIter)
548  {
549  std::map<Unit*, uint32>::iterator existing = targets.find(appIter->second->GetTarget());
550  // not found in current area - remove the aura
551  if (existing == targets.end())
552  targetsToRemove.push_back(appIter->second->GetTarget());
553  else
554  {
555  // needs readding - remove now, will be applied in next update cycle
556  // (dbcs do not have auras which apply on same type of targets but have different radius, so this is not really needed)
557  if (appIter->second->GetEffectMask() != existing->second || !CanBeAppliedOn(existing->first))
558  targetsToRemove.push_back(appIter->second->GetTarget());
559  // nothing todo - aura already applied
560  // remove from auras to register list
561  targets.erase(existing);
562  }
563  }
564 
565  // register auras for units
566  for (std::map<Unit*, uint32>::iterator itr = targets.begin(); itr!= targets.end();)
567  {
568  // aura mustn't be already applied on target
569  if (AuraApplication * aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
570  {
571  // the core created 2 different units with same guid
572  // this is a major failue, which i can't fix right now
573  // let's remove one unit from aura list
574  // this may cause area aura "bouncing" between 2 units after each update
575  // but because we know the reason of a crash we can remove the assertion for now
576  if (aurApp->GetTarget() != itr->first)
577  {
578  // remove from auras to register list
579  targets.erase(itr++);
580  continue;
581  }
582  else
583  {
584  // ok, we have one unit twice in target map (impossible, but...)
585  ABORT();
586  }
587  }
588 
589  bool addUnit = true;
590  // check target immunities
591  for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
592  {
593  if (itr->first->IsImmunedToSpellEffect(GetSpellInfo(), effIndex))
594  itr->second &= ~(1 << effIndex);
595  }
596  if (!itr->second
597  || itr->first->IsImmunedToSpell(GetSpellInfo())
598  || !CanBeAppliedOn(itr->first))
599  addUnit = false;
600 
601  if (addUnit && !itr->first->IsHighestExclusiveAura(this, true))
602  addUnit = false;
603 
604  if (addUnit)
605  {
606  // persistent area aura does not hit flying targets
607  if (GetType() == DYNOBJ_AURA_TYPE)
608  {
609  if (itr->first->IsInFlight())
610  addUnit = false;
611  }
612  // unit auras can not stack with each other
613  else // (GetType() == UNIT_AURA_TYPE)
614  {
615  // Allow to remove by stack when aura is going to be applied on owner
616  if (itr->first != GetOwner())
617  {
618  // check if not stacking aura already on target
619  // this one prevents unwanted usefull buff loss because of stacking and prevents overriding auras periodicaly by 2 near area aura owners
620  for (Unit::AuraApplicationMap::iterator iter = itr->first->GetAppliedAuras().begin(); iter != itr->first->GetAppliedAuras().end(); ++iter)
621  {
622  Aura const* aura = iter->second->GetBase();
623  if (!CanStackWith(aura))
624  {
625  addUnit = false;
626  break;
627  }
628  }
629  }
630  }
631  }
632  if (!addUnit)
633  targets.erase(itr++);
634  else
635  {
636  // owner has to be in world, or effect has to be applied to self
637  if (!GetOwner()->IsSelfOrInSameMap(itr->first))
638  {
640  TC_LOG_FATAL("spells", "Aura %u: Owner %s (map %u) is not in the same map as target %s (map %u).", GetSpellInfo()->Id,
641  GetOwner()->GetName().c_str(), GetOwner()->IsInWorld() ? GetOwner()->GetMap()->GetId() : uint32(-1),
642  itr->first->GetName().c_str(), itr->first->IsInWorld() ? itr->first->GetMap()->GetId() : uint32(-1));
643  ABORT();
644  }
645  itr->first->_CreateAuraApplication(this, itr->second);
646  ++itr;
647  }
648  }
649 
650  // remove auras from units no longer needing them
651  for (UnitList::iterator itr = targetsToRemove.begin(); itr != targetsToRemove.end();++itr)
652  if (AuraApplication * aurApp = GetApplicationOfTarget((*itr)->GetGUID()))
653  (*itr)->_UnapplyAura(aurApp, AURA_REMOVE_BY_DEFAULT);
654 
655  if (!apply)
656  return;
657 
658  // apply aura effects for units
659  for (std::map<Unit*, uint32>::iterator itr = targets.begin(); itr!= targets.end();++itr)
660  {
661  if (AuraApplication * aurApp = GetApplicationOfTarget(itr->first->GetGUID()))
662  {
663  // owner has to be in world, or effect has to be applied to self
664  ASSERT((!GetOwner()->IsInWorld() && GetOwner() == itr->first) || GetOwner()->IsInMap(itr->first));
665  itr->first->_ApplyAura(aurApp, itr->second);
666  }
667  }
668 }
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:130
Definition: SpellAuras.h:50
bool CanStackWith(Aura const *existingAura) const
Definition: SpellAuras.cpp:1655
Definition: SpellAuraDefines.h:549
void apply(T *val)
Definition: ByteConverter.h:41
const AuraApplication * GetApplicationOfTarget(ObjectGuid guid) const
Definition: SpellAuras.h:233
bool IsRemoved() const
Definition: SpellAuras.h:201
ApplicationMap m_applications
Definition: SpellAuras.h:314
WorldObject * GetOwner() const
Definition: SpellAuras.h:137
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
Definition: BattlenetAccountMgr.cpp:138
virtual void FillTargetMap(std::map< Unit *, uint32 > &targets, Unit *caster)=0
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
#define ABORT
Definition: Errors.h:56
int32 m_updateTargetMapInterval
Definition: SpellAuras.h:307
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55
#define MAX_SPELL_EFFECTS
Definition: DBCStructure.h:1026
std::list< Unit * > UnitList
Definition: Unit.h:421
#define UPDATE_TARGET_MAP_INTERVAL
Definition: SpellAuras.h:48
uint32_t uint32
Definition: g3dmath.h:168
AuraObjectType GetType() const
Definition: SpellAuras.cpp:456
Definition: SpellAuras.h:116
bool CanBeAppliedOn(Unit *target)
Definition: SpellAuras.cpp:1633
Definition: Unit.h:451
uint32 GetId() const
Definition: SpellAuras.h:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Friends And Related Function Documentation

Aura* Unit::_TryStackingOrRefreshingExistingAura ( SpellInfo const newAura,
uint32  effMask,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
int32  castItemLevel 
)
friend

Member Data Documentation

AuraEffectVector Aura::_effects
private
SpellEffectInfoVector Aura::_spelEffectInfos
private
ApplicationMap Aura::m_applications
protected
time_t const Aura::m_applyTime
protected
ObjectGuid const Aura::m_casterGuid
protected
uint8 const Aura::m_casterLevel
protected
ObjectGuid const Aura::m_castItemGuid
protected
int32 Aura::m_castItemLevel
protected
ChargeDropEvent* Aura::m_dropEvent
protected
int32 Aura::m_duration
protected
bool Aura::m_isRemoved
protected
bool Aura::m_isSingleTarget
protected
bool Aura::m_isUsingCharges
protected
std::list<AuraScript*> Aura::m_loadedScripts
int32 Aura::m_maxDuration
protected
WorldObject* const Aura::m_owner
protected
std::vector<SpellPowerEntry const*> Aura::m_periodicCosts
protected
uint8 Aura::m_procCharges
protected
Unit::AuraApplicationList Aura::m_removedApplications
private
SpellInfo const* const Aura::m_spellInfo
protected
uint8 Aura::m_stackAmount
protected
int32 Aura::m_timeCla
protected
int32 Aura::m_updateTargetMapInterval
protected

The documentation for this class was generated from the following files: