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

#include <SpellAuras.h>

Public Member Functions

 UnitAura (SpellInfo const *spellproto, uint32 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
 
void _ApplyForTarget (Unit *target, Unit *caster, AuraApplication *aurApp) override
 
void _UnapplyForTarget (Unit *target, Unit *caster, AuraApplication *aurApp) override
 
void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT) override
 
void FillTargetMap (std::map< Unit *, uint32 > &targets, Unit *caster) override
 
void SetDiminishGroup (DiminishingGroup group)
 
DiminishingGroup GetDiminishGroup () const
 
- Public Member Functions inherited from Aura
 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
 
void _Remove (AuraRemoveMode removeMode)
 
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
 

Private Attributes

DiminishingGroup m_AuraDRGroup:8
 

Friends

AuraAura::Create (SpellInfo const *spellproto, uint32 effMask, WorldObject *owner, Unit *caster, int32 *baseAmount, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
 

Additional Inherited Members

- Public Types inherited from Aura
typedef std::map< ObjectGuid,
AuraApplication * > 
ApplicationMap
 
- Static Public Member Functions inherited from Aura
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 inherited from Aura
std::list< AuraScript * > m_loadedScripts
 
- Protected Attributes inherited from Aura
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
 

Constructor & Destructor Documentation

UnitAura::UnitAura ( SpellInfo const spellproto,
uint32  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
int32  castItemLevel 
)
2321  : Aura(spellproto, owner, caster, castItem, casterGUID, castItemLevel)
2322 {
2324  LoadScripts();
2325  _InitEffects(effMask, caster, baseAmount);
2326  GetUnitOwner()->_AddAura(this, caster);
2327 }
DiminishingGroup m_AuraDRGroup
Definition: SpellAuras.h:347
Definition: SharedDefines.h:4371
Aura(SpellInfo const *spellproto, WorldObject *owner, Unit *caster, Item *castItem, ObjectGuid casterGUID, int32 castItemLevel)
Definition: SpellAuras.cpp:366
void _InitEffects(uint32 effMask, Unit *caster, int32 *baseAmount)
Definition: SpellAuras.cpp:404
void LoadScripts()
Definition: SpellAuras.cpp:1945
Unit * GetUnitOwner() const
Definition: SpellAuras.h:138
void _AddAura(UnitAura *aura, Unit *caster)
Definition: Unit.cpp:3090

+ Here is the call graph for this function:

Member Function Documentation

void UnitAura::_ApplyForTarget ( Unit target,
Unit caster,
AuraApplication aurApp 
)
overridevirtual

Reimplemented from Aura.

2330 {
2331  Aura::_ApplyForTarget(target, caster, aurApp);
2332 
2333  // register aura diminishing on apply
2334  if (DiminishingGroup group = GetDiminishGroup())
2335  target->ApplyDiminishingAura(group, true);
2336 }
DiminishingGroup
Definition: SharedDefines.h:4369
void ApplyDiminishingAura(DiminishingGroup group, bool apply)
Definition: Unit.cpp:11207
DiminishingGroup GetDiminishGroup() const
Definition: SpellAuras.h:344
virtual void _ApplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:461

+ Here is the call graph for this function:

void UnitAura::_UnapplyForTarget ( Unit target,
Unit caster,
AuraApplication aurApp 
)
overridevirtual

Reimplemented from Aura.

2339 {
2340  Aura::_UnapplyForTarget(target, caster, aurApp);
2341 
2342  // unregister aura diminishing (and store last time)
2343  if (DiminishingGroup group = GetDiminishGroup())
2344  target->ApplyDiminishingAura(group, false);
2345 }
DiminishingGroup
Definition: SharedDefines.h:4369
void ApplyDiminishingAura(DiminishingGroup group, bool apply)
Definition: Unit.cpp:11207
DiminishingGroup GetDiminishGroup() const
Definition: SpellAuras.h:344
virtual void _UnapplyForTarget(Unit *target, Unit *caster, AuraApplication *auraApp)
Definition: SpellAuras.cpp:481

+ Here is the call graph for this function:

void UnitAura::FillTargetMap ( std::map< Unit *, uint32 > &  targets,
Unit caster 
)
overridevirtual

Implements Aura.

2355 {
2356  for (SpellEffectInfo const* effect : GetSpellEffectInfos())
2357  {
2358  if (!effect || !HasEffect(effect->EffectIndex))
2359  continue;
2360  UnitList targetList;
2361  // non-area aura
2362  if (effect->Effect == SPELL_EFFECT_APPLY_AURA)
2363  {
2364  targetList.push_back(GetUnitOwner());
2365  }
2366  else
2367  {
2368  float radius = effect->CalcRadius(caster);
2369 
2370  if (!GetUnitOwner()->HasUnitState(UNIT_STATE_ISOLATED))
2371  {
2372  switch (effect->Effect)
2373  {
2376  {
2377  targetList.push_back(GetUnitOwner());
2380  GetUnitOwner()->VisitNearbyObject(radius, searcher);
2381  break;
2382  }
2384  {
2385  targetList.push_back(GetUnitOwner());
2388  GetUnitOwner()->VisitNearbyObject(radius, searcher);
2389  break;
2390  }
2392  {
2393  Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(GetUnitOwner(), GetUnitOwner(), radius); // No GetCharmer in searcher
2395  GetUnitOwner()->VisitNearbyObject(radius, searcher);
2396  break;
2397  }
2399  targetList.push_back(GetUnitOwner());
2400  // no break
2402  {
2403  if (Unit* owner = GetUnitOwner()->GetCharmerOrOwner())
2404  if (GetUnitOwner()->IsWithinDistInMap(owner, radius))
2405  targetList.push_back(owner);
2406  break;
2407  }
2408  }
2409  }
2410  }
2411 
2412  for (UnitList::iterator itr = targetList.begin(); itr!= targetList.end();++itr)
2413  {
2414  std::map<Unit*, uint32>::iterator existing = targets.find(*itr);
2415  if (existing != targets.end())
2416  existing->second |= 1 << effect->EffectIndex;
2417  else
2418  targets[*itr] = 1 << effect->EffectIndex;
2419  }
2420  }
2421 }
Definition: SharedDefines.h:1153
Definition: GridNotifiers.h:840
Unit * GetUnitOwner() const
Definition: SpellAuras.h:138
Definition: SharedDefines.h:1139
Definition: SharedDefines.h:1016
Definition: GridNotifiers.h:858
Definition: SharedDefines.h:1138
void VisitNearbyObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:587
Definition: GridNotifiers.h:410
Definition: SharedDefines.h:1075
Definition: GridNotifiers.h:926
Definition: SpellInfo.h:238
bool HasEffect(uint8 effIndex) const
Definition: SpellAuras.h:223
std::list< Unit * > UnitList
Definition: Unit.h:421
Definition: SharedDefines.h:1045
Definition: Unit.h:1305
SpellEffectInfoVector GetSpellEffectInfos() const
Definition: SpellAuras.h:290
Definition: Unit.h:563
Definition: SharedDefines.h:1129

+ Here is the call graph for this function:

DiminishingGroup UnitAura::GetDiminishGroup ( ) const
inline
344 { return m_AuraDRGroup; }
DiminishingGroup m_AuraDRGroup
Definition: SpellAuras.h:347

+ Here is the caller graph for this function:

void UnitAura::Remove ( AuraRemoveMode  removeMode = AURA_REMOVE_BY_DEFAULT)
overridevirtual

Implements Aura.

2348 {
2349  if (IsRemoved())
2350  return;
2351  GetUnitOwner()->RemoveOwnedAura(this, removeMode);
2352 }
Unit * GetUnitOwner() const
Definition: SpellAuras.h:138
bool IsRemoved() const
Definition: SpellAuras.h:201
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3365

+ Here is the call graph for this function:

void UnitAura::SetDiminishGroup ( DiminishingGroup  group)
inline
343 { m_AuraDRGroup = group; }
DiminishingGroup m_AuraDRGroup
Definition: SpellAuras.h:347

Friends And Related Function Documentation

Aura* Aura::Create ( SpellInfo const spellproto,
uint32  effMask,
WorldObject owner,
Unit caster,
int32 baseAmount,
Item castItem,
ObjectGuid  casterGUID,
int32  castItemLevel 
)
friend

Member Data Documentation

DiminishingGroup UnitAura::m_AuraDRGroup
private

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