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

Private Member Functions

 PrepareSpellScript (spell_gen_pet_summoned)
 
bool Load () override
 
void HandleScript (SpellEffIndex)
 
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
 
UnitGetCaster ()
 
UnitGetOriginalCaster ()
 
SpellInfo const * GetSpellInfo ()
 
SpellValue const * GetSpellValue ()
 
WorldLocation const * GetExplTargetDest ()
 
void SetExplTargetDest (WorldLocation &loc)
 
WorldObjectGetExplTargetWorldObject ()
 
UnitGetExplTargetUnit ()
 
GameObjectGetExplTargetGObj ()
 
ItemGetExplTargetItem ()
 
UnitGetHitUnit ()
 
CreatureGetHitCreature ()
 
PlayerGetHitPlayer ()
 
ItemGetHitItem ()
 
GameObjectGetHitGObj ()
 
WorldLocationGetHitDest ()
 
int32 GetHitDamage ()
 
void SetHitDamage (int32 damage)
 
void PreventHitDamage ()
 
int32 GetHitHeal ()
 
void SetHitHeal (int32 heal)
 
void PreventHitHeal ()
 
SpellGetSpell ()
 
AuraGetHitAura ()
 
void PreventHitAura ()
 
void PreventHitEffect (SpellEffIndex effIndex)
 
void PreventHitDefaultEffect (SpellEffIndex effIndex)
 
int32 GetEffectValue () const
 
void SetEffectValue (int32 value)
 
ItemGetCastItem ()
 
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 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 SpellScript
HookList< CastHandlerBeforeCast
 
HookList< CastHandlerOnCast
 
HookList< CastHandlerAfterCast
 
HookList< CheckCastHandlerOnCheckCast
 
HookList< EffectHandlerOnEffectLaunch
 
HookList< EffectHandlerOnEffectLaunchTarget
 
HookList< EffectHandlerOnEffectHit
 
HookList< EffectHandlerOnEffectHitTarget
 
HookList< BeforeHitHandlerBeforeHit
 
HookList< HitHandlerOnHit
 
HookList< HitHandlerAfterHit
 
HookList< ObjectAreaTargetSelectHandlerOnObjectAreaTargetSelect
 
HookList< ObjectTargetSelectHandlerOnObjectTargetSelect
 
HookList< DestinationTargetSelectHandlerOnDestinationTargetSelect
 
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

◆ HandleScript()

void spell_gen_pet_summoned::HandleScript ( SpellEffIndex  )
inlineprivate
1674 {
1675 Player* player = GetCaster()->ToPlayer();
1676 if (player->GetLastPetNumber() && player->CanResummonPet(player->GetLastPetSpell()))
1677 {
1678 PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
1679 Pet* newPet = new Pet(player, newPetType);
1680 if (newPet->LoadPetFromDB(player, 0, player->GetLastPetNumber(), true, 100))
1681 {
1682 newPet->SetPower(newPet->getPowerType(), newPet->GetMaxPower(newPet->getPowerType()));
1683
1684 switch (newPet->GetEntry())
1685 {
1686 case NPC_DOOMGUARD:
1687 case NPC_INFERNAL:
1688 newPet->SetEntry(NPC_IMP);
1689 break;
1690 default:
1691 break;
1692 }
1693 }
1694 else
1695 delete newPet;
1696 }
1697 }
@ NPC_DOOMGUARD
Definition: PetDefines.h:99
@ NPC_INFERNAL
Definition: PetDefines.h:94
@ NPC_IMP
Definition: PetDefines.h:95
PetType
Definition: PetDefines.h:30
@ SUMMON_PET
Definition: PetDefines.h:31
@ HUNTER_PET
Definition: PetDefines.h:32
@ CLASS_HUNTER
Definition: SharedDefines.h:115
Player * ToPlayer()
Definition: Object.h:195
uint32 GetEntry() const
Definition: Object.h:109
void SetEntry(uint32 entry)
Definition: Object.h:110
Definition: Pet.h:40
bool LoadPetFromDB(Player *owner, uint32 petEntry, uint32 petnumber, bool current, uint32 healthPct=0)
Definition: Pet.cpp:207
Definition: Player.h:1046
uint32 GetLastPetSpell() const
Definition: Player.h:2409
uint32 GetLastPetNumber() const
Definition: Player.h:2407
bool CanResummonPet(uint32 spellid)
Definition: Player.cpp:14137
void SetPower(Powers power, uint32 val, bool withPowerUpdate=true, bool fromRegenerate=false)
Definition: Unit.cpp:15458
uint8 getClass() const
Definition: Unit.h:1426
uint32 GetMaxPower(Powers power) const
Definition: Unit.h:1462
Powers getPowerType() const
Definition: Unit.h:1459
Unit * GetCaster()
Definition: SpellScript.cpp:401

References Player::CanResummonPet(), CLASS_HUNTER, SpellScript::GetCaster(), Unit::getClass(), Object::GetEntry(), Player::GetLastPetNumber(), Player::GetLastPetSpell(), Unit::GetMaxPower(), Unit::getPowerType(), HUNTER_PET, Pet::LoadPetFromDB(), NPC_DOOMGUARD, NPC_IMP, NPC_INFERNAL, Object::SetEntry(), Unit::SetPower(), SUMMON_PET, and Object::ToPlayer().

Referenced by Register().

◆ Load()

bool spell_gen_pet_summoned::Load ( )
inlineoverrideprivatevirtual

Reimplemented from _SpellScript.

1669 {
1670 return GetCaster()->GetTypeId() == TYPEID_PLAYER;
1671 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
TypeID GetTypeId() const
Definition: Object.h:121

References SpellScript::GetCaster(), Object::GetTypeId(), and TYPEID_PLAYER.

◆ PrepareSpellScript()

spell_gen_pet_summoned::PrepareSpellScript ( spell_gen_pet_summoned  )
private

◆ Register()

void spell_gen_pet_summoned::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1700 {
1702 }
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:337
@ EFFECT_0
Definition: SharedDefines.h:30
@ SPELL_EFFECT_SCRIPT_EFFECT
Definition: SharedDefines.h:827
HookList< EffectHandler > OnEffectHitTarget
Definition: SpellScript.h:336
void HandleScript(SpellEffIndex)
Definition: spell_generic.cpp:1673

References EFFECT_0, HandleScript(), SpellScript::OnEffectHitTarget, SPELL_EFFECT_SCRIPT_EFFECT, and SpellEffectFn.