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

Private Member Functions

 PrepareSpellScript (spell_warl_create_healthstone)
 
bool Validate (SpellInfo const *) override
 
SpellCastResult CheckCast ()
 
void HandleScriptEffect (SpellEffIndex effIndex)
 
void Register () override
 

Static Private Attributes

static uint32 const iTypes [8][3]
 

Additional Inherited Members

- Public Member Functions inherited from SpellScript
bool _Validate (SpellInfo const *entry) override
 
bool _Load (Spell *spell)
 
void _InitHit ()
 
bool _IsEffectPrevented (SpellEffIndex effIndex)
 
bool _IsDefaultEffectPrevented (SpellEffIndex effIndex)
 
void _PrepareScriptCall (SpellScriptHookType hookType)
 
void _FinishScriptCall ()
 
bool IsInCheckCastHook () const
 
bool IsInTargetHook () const
 
bool IsInHitPhase () const
 
bool IsInEffectHook () const
 
Unit * GetCaster ()
 
GameObject * GetGObjCaster ()
 
Unit * GetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObject * GetExplTargetWorldObject ()
 
Unit * GetExplTargetUnit ()
 
GameObject * GetExplTargetGObj ()
 
Item * GetExplTargetItem ()
 
Unit * GetHitUnit ()
 
Creature * GetHitCreature ()
 
Player * GetHitPlayer ()
 
Item * GetHitItem ()
 
GameObject * GetHitGObj ()
 
WorldLocation * GetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
Spell * GetSpell ()
 
Aura * GetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
Item * GetCastItem ()
 
void CreateItem (uint32 effIndex, uint32 itemId)
 
SpellInfo const * GetTriggeringSpell ()
 
void FinishCast (SpellCastResult result)
 
void Cancel ()
 
void SetCustomCastResultMessage (SpellCustomErrors result)
 
- 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 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 SpellScript
HookList< CastHandler > BeforeCast
 
HookList< CastHandler > OnCast
 
HookList< CastHandler > AfterCast
 
HookList< CheckCastHandler > OnCheckCast
 
HookList< EffectHandler > OnEffectLaunch
 
HookList< EffectHandler > OnEffectLaunchTarget
 
HookList< EffectHandler > OnEffectHit
 
HookList< EffectHandler > OnEffectHitTarget
 
HookList< BeforeHitHandler > BeforeHit
 
HookList< HitHandler > OnHit
 
HookList< HitHandler > AfterHit
 
HookList< ObjectAreaTargetSelectHandler > OnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandler > OnObjectTargetSelect
 
HookList< DestinationTargetSelectHandler > OnDestinationTargetSelect
 
- Protected Attributes inherited from _SpellScript
uint8 m_currentScriptState
 
std::string const * m_scriptName
 
uint32 m_scriptSpellId
 

Detailed Description

Member Function Documentation

◆ CheckCast()

SpellCastResult spell_warl_create_healthstone::CheckCast ( )
inlineprivate
613 {
614 if (Player* caster = GetCaster()->ToPlayer())
615 {
616 uint8 spellRank = GetSpellInfo()->GetRank();
617 ItemPosCountVec dest;
618 InventoryResult msg = caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, iTypes[spellRank - 1][0], 1, nullptr);
619 if (msg != EQUIP_ERR_OK)
621 }
622 return SPELL_CAST_OK;
623 }
std::uint8_t uint8
Definition Define.h:109
InventoryResult
Definition Item.h:46
@ EQUIP_ERR_OK
Definition Item.h:47
@ NULL_BAG
Definition Item.h:40
@ NULL_SLOT
Definition Item.h:41
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:758
@ SPELL_FAILED_TOO_MANY_OF_ITEM
Definition SharedDefines.h:1066
@ SPELL_CAST_OK
Definition SharedDefines.h:1126
Definition Player.h:1086
uint8 GetRank() const
Definition SpellInfo.cpp:2927
SpellInfo const * GetSpellInfo()
Definition SpellScript.cpp:416
Unit * GetCaster()
Definition SpellScript.cpp:401
static uint32 const iTypes[8][3]
Definition spell_warlock.cpp:605

References EQUIP_ERR_OK, SpellScript::GetCaster(), SpellInfo::GetRank(), SpellScript::GetSpellInfo(), iTypes, NULL_BAG, NULL_SLOT, SPELL_CAST_OK, and SPELL_FAILED_TOO_MANY_OF_ITEM.

Referenced by Register().

◆ HandleScriptEffect()

void spell_warl_create_healthstone::HandleScriptEffect ( SpellEffIndex  effIndex)
inlineprivate
626 {
627 if (Unit* unitTarget = GetHitUnit())
628 {
629 uint32 rank = 0;
630 // Improved Healthstone
631 if (AuraEffect const* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
632 {
633 switch (aurEff->GetId())
634 {
636 rank = 1;
637 break;
639 rank = 2;
640 break;
641 default:
642 LOG_ERROR("spells", "Unknown rank of Improved Healthstone id: {}", aurEff->GetId());
643 break;
644 }
645 }
646 uint8 spellRank = GetSpellInfo()->GetRank();
647 if (spellRank > 0 && spellRank <= 8)
648 CreateItem(effIndex, iTypes[spellRank - 1][rank]);
649 }
650 }
std::uint32_t uint32
Definition Define.h:107
#define LOG_ERROR(filterType__,...)
Definition Log.h:145
@ SPELLFAMILY_WARLOCK
Definition SharedDefines.h:3789
Definition SpellAuraEffects.h:39
Unit * GetHitUnit()
Definition SpellScript.cpp:453
void CreateItem(uint32 effIndex, uint32 itemId)
Definition SpellScript.cpp:630
Definition Unit.h:667
@ SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1
Definition spell_warlock.cpp:57
@ SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2
Definition spell_warlock.cpp:58

References SpellScript::CreateItem(), SpellScript::GetHitUnit(), SpellInfo::GetRank(), SpellScript::GetSpellInfo(), iTypes, LOG_ERROR, SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1, SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2, and SPELLFAMILY_WARLOCK.

Referenced by Register().

◆ PrepareSpellScript()

spell_warl_create_healthstone::PrepareSpellScript ( spell_warl_create_healthstone  )
private

◆ Register()

void spell_warl_create_healthstone::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

653 {
656 }
@ EFFECT_0
Definition SharedDefines.h:31
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition SharedDefines.h:843
#define SpellCheckCastFn(F)
Definition SpellScript.h:329
#define SpellEffectFn(F, I, N)
Definition SpellScript.h:337
HookList< CheckCastHandler > OnCheckCast
Definition SpellScript.h:328
HookList< EffectHandler > OnEffectHitTarget
Definition SpellScript.h:336
void HandleScriptEffect(SpellEffIndex effIndex)
Definition spell_warlock.cpp:625
SpellCastResult CheckCast()
Definition spell_warlock.cpp:612

References CheckCast(), EFFECT_0, HandleScriptEffect(), SpellScript::OnCheckCast, SpellScript::OnEffectHitTarget, SPELL_EFFECT_SCRIPT_EFFECT, SpellCheckCastFn, and SpellEffectFn.

◆ Validate()

bool spell_warl_create_healthstone::Validate ( SpellInfo const *  )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

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

References SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R1, SPELL_WARLOCK_IMPROVED_HEALTHSTONE_R2, and _SpellScript::ValidateSpellInfo().

Member Data Documentation

◆ iTypes

uint32 const spell_warl_create_healthstone::iTypes[8][3]
staticprivate

Referenced by CheckCast(), and HandleScriptEffect().


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