AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
spell_botanica_shift_form_aura Class Reference
Inheritance diagram for spell_botanica_shift_form_aura:
AuraScript _SpellScript

Private Member Functions

 PrepareAuraScript (spell_botanica_shift_form_aura)
 
bool Load () override
 
bool CheckProc (ProcEventInfo &eventInfo)
 
void Register () override
 

Private Attributes

uint32 _lastSchool
 
uint32 _lastForm
 
uint32 _swapTime
 

Additional Inherited Members

- Public Member Functions inherited from AuraScript
 AuraScript ()
 
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Aura *aura)
 
void _PrepareScriptCall (AuraScriptHookType hookType, AuraApplication const *aurApp=nullptr)
 
void _FinishScriptCall ()
 
bool _IsDefaultActionPrevented ()
 
void PreventDefaultAction ()
 
SpellInfo const * GetSpellInfo () const
 
uint32 GetId () const
 
ObjectGuid GetCasterGUID () const
 
Unit * GetCaster () const
 
WorldObject * GetOwner () const
 
Unit * GetUnitOwner () const
 
DynamicObject * GetDynobjOwner () const
 
void Remove (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
Aura * GetAura () const
 
AuraObjectType GetType () const
 
int32 GetDuration () const
 
void SetDuration (int32 duration, bool withMods=false)
 
void RefreshDuration ()
 
time_t GetApplyTime () const
 
int32 GetMaxDuration () const
 
void SetMaxDuration (int32 duration)
 
int32 CalcMaxDuration () const
 
bool IsExpired () const
 
bool IsPermanent () const
 
uint8 GetCharges () const
 
void SetCharges (uint8 charges)
 
uint8 CalcMaxCharges () const
 
bool ModCharges (int8 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool DropCharge (AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
uint8 GetStackAmount () const
 
void SetStackAmount (uint8 num)
 
bool ModStackAmount (int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
 
bool IsPassive () const
 
bool IsDeathPersistent () const
 
bool HasEffect (uint8 effIndex) const
 
AuraEffect * GetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
Unit * GetTarget () const
 
AuraApplication const * GetTargetApplication () const
 
- Public Member Functions inherited from _SpellScript
 _SpellScript ()
 
virtual ~_SpellScript ()
 
virtual void _Register ()
 
virtual void _Unload ()
 
virtual void _Init (std::string const *scriptname, uint32 spellId)
 
std::string const * _GetScriptName () const
 
virtual bool Validate (SpellInfo const *)
 
virtual void Unload ()
 
- Static Public Member Functions inherited from _SpellScript
static bool ValidateSpellInfo (std::initializer_list< uint32 > spellIds)
 
template<class T >
static bool ValidateSpellInfo (T const &spellIds)
 
- Public Attributes inherited from AuraScript
HookList< CheckAreaTargetHandler > DoCheckAreaTarget
 
HookList< AuraDispelHandler > OnDispel
 
HookList< AuraDispelHandler > AfterDispel
 
HookList< EffectApplyHandler > OnEffectApply
 
HookList< EffectApplyHandler > AfterEffectApply
 
HookList< EffectApplyHandler > OnEffectRemove
 
HookList< EffectApplyHandler > AfterEffectRemove
 
HookList< EffectPeriodicHandler > OnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandler > OnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandler > DoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandler > DoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandler > DoEffectCalcSpellMod
 
HookList< EffectAbsorbHandler > OnEffectAbsorb
 
HookList< EffectAbsorbHandler > AfterEffectAbsorb
 
HookList< EffectManaShieldHandler > OnEffectManaShield
 
HookList< EffectManaShieldHandler > AfterEffectManaShield
 
HookList< EffectSplitHandler > OnEffectSplit
 
HookList< CheckProcHandler > DoCheckProc
 
HookList< CheckEffectProcHandler > DoCheckEffectProc
 
HookList< AfterCheckProcHandler > DoAfterCheckProc
 
HookList< AuraProcHandler > DoPrepareProc
 
HookList< AuraProcHandler > OnProc
 
HookList< AuraProcHandler > AfterProc
 
HookList< EffectProcHandler > OnEffectProc
 
HookList< EffectProcHandler > AfterEffectProc
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CheckProc()

bool spell_botanica_shift_form_aura::CheckProc ( ProcEventInfo &  eventInfo)
inlineprivate
101 {
102 if (SpellInfo const* spellInfo = eventInfo.GetSpellInfo())
103 {
104 if ((spellInfo->GetSchoolMask() & _lastSchool) && _swapTime > GameTime::GetGameTime().count())
105 return false;
106
107 uint32 form = 0;
108 switch (GetFirstSchoolInMask(spellInfo->GetSchoolMask()))
109 {
111 form = SPELL_FIRE_FORM;
112 break;
114 form = SPELL_FROST_FORM;
115 break;
117 form = SPELL_ARCANE_FORM;
118 break;
120 form = SPELL_SHADOW_FORM;
121 break;
122 default:
123 break;
124 }
125
126 if (form)
127 {
128 _swapTime = GameTime::GetGameTime().count() + 6;
129 _lastSchool = spellInfo->GetSchoolMask();
130
131 // Runs from Aura::GetProcEffectMask while the proc engine iterates the owner's
132 // applied-aura map. Swapping forms mutates that map (RemoveAura + CastSpell),
133 // which invalidates the live iterator now that aura containers are flat_multimaps.
134 // Defer the swap to the owner's event queue so it runs outside the proc walk.
135 Unit* owner = GetUnitOwner();
136 uint32 const oldForm = _lastForm;
137 _lastForm = form;
138 owner->m_Events.AddEventAtOffset([owner, oldForm, form]()
139 {
140 owner->RemoveAurasDueToSpell(oldForm);
141 owner->CastSpell(owner, form, true);
142 }, 1ms);
143 }
144 }
145
146 return false;
147 }
std::uint32_t uint32
Definition Define.h:107
@ SPELL_SCHOOL_SHADOW
Definition SharedDefines.h:276
@ SPELL_SCHOOL_FROST
Definition SharedDefines.h:275
@ SPELL_SCHOOL_ARCANE
Definition SharedDefines.h:277
@ SPELL_SCHOOL_FIRE
Definition SharedDefines.h:273
SpellSchools GetFirstSchoolInMask(SpellSchoolMask mask)
Definition SharedDefines.h:306
Unit * GetUnitOwner() const
Definition SpellScript.cpp:1050
void AddEventAtOffset(BasicEvent *event, Milliseconds offset, uint8 eventGroup=0)
Definition EventProcessor.h:108
SpellInfo const * GetSpellInfo() const
Definition Unit.cpp:301
Definition SpellInfo.h:340
Definition Unit.h:665
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1372
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4936
EventProcessor m_Events
Definition Object.h:749
uint32 _lastForm
Definition instance_the_botanica.cpp:156
uint32 _swapTime
Definition instance_the_botanica.cpp:157
uint32 _lastSchool
Definition instance_the_botanica.cpp:155
Seconds GetGameTime()
Definition GameTime.cpp:38
@ SPELL_SHADOW_FORM
Definition the_botanica.h:53
@ SPELL_ARCANE_FORM
Definition the_botanica.h:50
@ SPELL_FROST_FORM
Definition the_botanica.h:52
@ SPELL_FIRE_FORM
Definition the_botanica.h:51

References _lastForm, _lastSchool, _swapTime, EventProcessor::AddEventAtOffset(), Unit::CastSpell(), GetFirstSchoolInMask(), GameTime::GetGameTime(), ProcEventInfo::GetSpellInfo(), AuraScript::GetUnitOwner(), WorldObject::m_Events, Unit::RemoveAurasDueToSpell(), SPELL_ARCANE_FORM, SPELL_FIRE_FORM, SPELL_FROST_FORM, SPELL_SCHOOL_ARCANE, SPELL_SCHOOL_FIRE, SPELL_SCHOOL_FROST, SPELL_SCHOOL_SHADOW, and SPELL_SHADOW_FORM.

Referenced by Register().

◆ Load()

bool spell_botanica_shift_form_aura::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

93 {
94 _lastSchool = 0;
95 _lastForm = 0;
96 _swapTime = 0;
97 return true;
98 }

References _lastForm, _lastSchool, and _swapTime.

◆ PrepareAuraScript()

spell_botanica_shift_form_aura::PrepareAuraScript ( spell_botanica_shift_form_aura  )
private

◆ Register()

void spell_botanica_shift_form_aura::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

150 {
152 }
#define AuraCheckProcFn(F)
Definition SpellScript.h:831
HookList< CheckProcHandler > DoCheckProc
Definition SpellScript.h:830
bool CheckProc(ProcEventInfo &eventInfo)
Definition instance_the_botanica.cpp:100

References AuraCheckProcFn, CheckProc(), and AuraScript::DoCheckProc.

Member Data Documentation

◆ _lastForm

uint32 spell_botanica_shift_form_aura::_lastForm
private

Referenced by CheckProc(), and Load().

◆ _lastSchool

uint32 spell_botanica_shift_form_aura::_lastSchool
private

Referenced by CheckProc(), and Load().

◆ _swapTime

uint32 spell_botanica_shift_form_aura::_swapTime
private

Referenced by CheckProc(), and Load().


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