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

Private Member Functions

 PrepareSpellScript (spell_brewfest_unfill_keg)
 
uint32 GetEmptyEntry (uint32 baseEntry)
 
void HandleAfterHit ()
 
void Register () override
 

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 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 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

◆ GetEmptyEntry()

uint32 spell_brewfest_unfill_keg::GetEmptyEntry ( uint32  baseEntry)
inlineprivate
1120 {
1121 switch (baseEntry)
1122 {
1123 case 37893:
1124 case 37894:
1125 case 37895:
1126 case 37896:
1127 case 37897:
1128 return GREEN_EMPTY_KEG;
1129 case 33017:
1130 case 33018:
1131 case 33019:
1132 case 33020:
1133 case 33021:
1134 return BLUE_EMPTY_KEG;
1135 case 32915:
1136 case 32917:
1137 case 32918:
1138 case 32919:
1139 case 32920:
1140 return YELLOW_EMPTY_KEG;
1141 }
1142
1143 return 0;
1144 }
@ YELLOW_EMPTY_KEG
Definition brewfest.cpp:1070
@ BLUE_EMPTY_KEG
Definition brewfest.cpp:1069
@ GREEN_EMPTY_KEG
Definition brewfest.cpp:1068

References BLUE_EMPTY_KEG, GREEN_EMPTY_KEG, and YELLOW_EMPTY_KEG.

Referenced by HandleAfterHit().

◆ HandleAfterHit()

void spell_brewfest_unfill_keg::HandleAfterHit ( )
inlineprivate
1147 {
1148 if (GetCaster() && GetCaster()->ToPlayer())
1149 {
1150 if (Item* itemCaster = GetCastItem())
1151 {
1152 uint32 item = GetEmptyEntry(itemCaster->GetEntry());
1153 Player* player = GetCaster()->ToPlayer();
1154
1155 if (item && player->AddItem(item, 1)) // ensure filled keg is stored
1156 {
1157 player->DestroyItemCount(itemCaster->GetEntry(), 1, true);
1158 GetSpell()->m_CastItem = nullptr;
1160 }
1161 }
1162 }
1163 }
std::uint32_t uint32
Definition Define.h:107
Definition Item.h:220
void Clear()
Definition ObjectGuid.h:141
Player * ToPlayer()
Definition Object.h:208
Definition Player.h:1086
bool AddItem(uint32 itemId, uint32 count)
Definition Player.cpp:16022
void DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition PlayerStorage.cpp:3225
Item * GetCastItem()
Definition SpellScript.cpp:625
Spell * GetSpell()
Definition SpellScript.h:443
Unit * GetCaster()
Definition SpellScript.cpp:401
Item * m_CastItem
Definition Spell.h:536
ObjectGuid m_castItemGUID
Definition Spell.h:538
uint32 GetEmptyEntry(uint32 baseEntry)
Definition brewfest.cpp:1119

References Player::AddItem(), ObjectGuid::Clear(), Player::DestroyItemCount(), SpellScript::GetCaster(), SpellScript::GetCastItem(), GetEmptyEntry(), SpellScript::GetSpell(), Spell::m_CastItem, Spell::m_castItemGUID, and Object::ToPlayer().

Referenced by Register().

◆ PrepareSpellScript()

spell_brewfest_unfill_keg::PrepareSpellScript ( spell_brewfest_unfill_keg  )
private

◆ Register()

void spell_brewfest_unfill_keg::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1166 {
1168 }
#define SpellHitFn(F)
Definition SpellScript.h:349
HookList< HitHandler > AfterHit
Definition SpellScript.h:347
void HandleAfterHit()
Definition brewfest.cpp:1146

References SpellScript::AfterHit, HandleAfterHit(), and SpellHitFn.


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