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

Private Member Functions

 PrepareAuraScript (spell_gen_sober_up)
 
bool Validate (SpellInfo const *) override
 
void OnRemove (AuraEffect const *aurEff, AuraEffectHandleModes)
 
void Register () override
 

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
 
UnitGetCaster () const
 
WorldObjectGetOwner () const
 
UnitGetUnitOwner () const
 
DynamicObjectGetDynobjOwner () const
 
void Remove (uint32 removeMode=0)
 
AuraGetAura () 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
 
AuraEffectGetEffect (uint8 effIndex) const
 
bool HasEffectType (AuraType type) const
 
UnitGetTarget () 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 void Register ()=0
 
virtual bool Validate (SpellInfo const *)
 
virtual bool Load ()
 
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< CheckAreaTargetHandlerDoCheckAreaTarget
 
HookList< AuraDispelHandlerOnDispel
 
HookList< AuraDispelHandlerAfterDispel
 
HookList< EffectApplyHandlerOnEffectApply
 
HookList< EffectApplyHandlerAfterEffectApply
 
HookList< EffectApplyHandlerOnEffectRemove
 
HookList< EffectApplyHandlerAfterEffectRemove
 
HookList< EffectPeriodicHandlerOnEffectPeriodic
 
HookList< EffectUpdatePeriodicHandlerOnEffectUpdatePeriodic
 
HookList< EffectCalcAmountHandlerDoEffectCalcAmount
 
HookList< EffectCalcPeriodicHandlerDoEffectCalcPeriodic
 
HookList< EffectCalcSpellModHandlerDoEffectCalcSpellMod
 
HookList< EffectAbsorbHandlerOnEffectAbsorb
 
HookList< EffectAbsorbHandlerAfterEffectAbsorb
 
HookList< EffectManaShieldHandlerOnEffectManaShield
 
HookList< EffectManaShieldHandlerAfterEffectManaShield
 
HookList< EffectSplitHandlerOnEffectSplit
 
HookList< CheckProcHandlerDoCheckProc
 
HookList< AfterCheckProcHandlerDoAfterCheckProc
 
HookList< AuraProcHandlerDoPrepareProc
 
HookList< AuraProcHandlerOnProc
 
HookList< AuraProcHandlerAfterProc
 
HookList< EffectProcHandlerOnEffectProc
 
HookList< EffectProcHandlerAfterEffectProc
 
virtual bool _Validate (SpellInfo const *entry)
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ OnRemove()

void spell_gen_sober_up::OnRemove ( AuraEffect const *  aurEff,
AuraEffectHandleModes   
)
inlineprivate
5194 {
5195 Unit* target = GetTarget();
5196 if (!target && !target->ToPlayer())
5197 return;
5198
5199 SpellEffIndex InebriateEffIndex = EFFECT_0;
5200 if (Player* player = target->ToPlayer())
5201 {
5202 switch (GetSpellInfo()->Id)
5203 {
5204 case SPELL_DRUNKEN_HAZE:
5205 InebriateEffIndex = EFFECT_1;
5206 break;
5208 InebriateEffIndex = EFFECT_2;
5209 break;
5210 }
5211
5212 uint16 level = aurEff->GetSpellInfo()->Effects[InebriateEffIndex].CalcValue();
5213 player->SetDrunkValue(player->GetDrunkValue() - (level > 100 ? 100 : level)); // Some (maybe it's only 29690) spells can have over 100 inebriate points
5214 }
5215 }
std::uint16_t uint16
Definition: Define.h:108
@ SPELL_DRUNKEN_HAZE
Definition: spell_generic.cpp:5180
@ SPELL_DRUNKEN_SKULL_CRACK
Definition: spell_generic.cpp:5181
SpellEffIndex
Definition: SharedDefines.h:30
@ EFFECT_1
Definition: SharedDefines.h:32
@ EFFECT_0
Definition: SharedDefines.h:31
@ EFFECT_2
Definition: SharedDefines.h:33
Player * ToPlayer()
Definition: Object.h:201
Definition: Player.h:1081
Definition: Unit.h:630
SpellInfo const * GetSpellInfo() const
Definition: SpellScript.cpp:1005
Unit * GetTarget() const
Definition: SpellScript.cpp:1165

References EFFECT_0, EFFECT_1, EFFECT_2, SpellInfo::Effects, AuraEffect::GetSpellInfo(), AuraScript::GetSpellInfo(), AuraScript::GetTarget(), SPELL_DRUNKEN_HAZE, SPELL_DRUNKEN_SKULL_CRACK, and Object::ToPlayer().

Referenced by Register().

◆ PrepareAuraScript()

spell_gen_sober_up::PrepareAuraScript ( spell_gen_sober_up  )
private

◆ Register()

void spell_gen_sober_up::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

5218 {
5220 {
5222 }
5223 else
5224 {
5226 }
5227 }
#define SPELL_AURA_ANY
Definition: SpellScript.h:43
#define AuraEffectRemoveFn(F, I, N, M)
Definition: SpellScript.h:754
@ AURA_EFFECT_HANDLE_REAL
Definition: SpellAuraDefines.h:42
uint32 m_scriptSpellId
Definition: SpellScript.h:107
HookList< EffectApplyHandler > AfterEffectRemove
Definition: SpellScript.h:753
void OnRemove(AuraEffect const *aurEff, AuraEffectHandleModes)
Definition: spell_generic.cpp:5193

References AuraScript::AfterEffectRemove, AURA_EFFECT_HANDLE_REAL, AuraEffectRemoveFn, EFFECT_0, EFFECT_1, _SpellScript::m_scriptSpellId, OnRemove(), SPELL_AURA_ANY, and SPELL_DRUNKEN_HAZE.

◆ Validate()

bool spell_gen_sober_up::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

5189 {
5191 }
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:125

References SPELL_DRUNKEN_HAZE, SPELL_DRUNKEN_SKULL_CRACK, and _SpellScript::ValidateSpellInfo().