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

Private Member Functions

 PrepareSpellScript (spell_hun_tame_beast)
 
SpellCastResult CheckCast ()
 
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

◆ CheckCast()

SpellCastResult spell_hun_tame_beast::CheckCast ( )
inlineprivate
938 {
939 Unit* caster = GetCaster();
940 if (caster->GetTypeId() != TYPEID_PLAYER)
942
943 Player* player = GetCaster()->ToPlayer();
944
945 if (!GetExplTargetUnit())
946 {
949 }
950
951 if (Creature* target = GetExplTargetUnit()->ToCreature())
952 {
953 if (target->GetLevel() > player->GetLevel())
954 {
957 }
958
959 if (target->GetCreatureTemplate()->IsExotic() && !player->CanTameExoticPets())
960 {
963 }
964
965 if (!target->GetCreatureTemplate()->IsTameable(player->CanTameExoticPets()))
966 {
969 }
970
971 PetStable const* petStable = player->GetPetStable();
972 if (petStable)
973 {
974 if (petStable->CurrentPet)
976
977 if (petStable->GetUnslottedHunterPet())
978 {
981 }
982 }
983
984 if (player->GetCharmGUID())
985 {
988 }
989
990 if (target->GetOwnerGUID())
991 {
994 }
995 }
996 else
997 {
1000 }
1001
1002 return SPELL_CAST_OK;
1003 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ PET_TAME_NOT_TAMEABLE
Definition: SharedDefines.h:3652
@ PET_TAME_INVALID_CREATURE
Definition: SharedDefines.h:3649
@ PET_TAME_TOO_HIGHLEVEL
Definition: SharedDefines.h:3657
@ PET_TAME_CREATURE_ALREADY_OWNED
Definition: SharedDefines.h:3651
@ PET_TAME_CANT_CONTROL_EXOTIC
Definition: SharedDefines.h:3660
@ PET_TAME_TOO_MANY
Definition: SharedDefines.h:3650
@ PET_TAME_ANOTHER_SUMMON_ACTIVE
Definition: SharedDefines.h:3653
@ SPELL_FAILED_ALREADY_HAVE_SUMMON
Definition: SharedDefines.h:928
@ SPELL_FAILED_DONT_REPORT
Definition: SharedDefines.h:948
@ SPELL_CAST_OK
Definition: SharedDefines.h:1110
Definition: Creature.h:46
Player * ToPlayer()
Definition: Object.h:195
TypeID GetTypeId() const
Definition: Object.h:121
Definition: PetDefines.h:197
PetInfo const * GetUnslottedHunterPet() const
Definition: PetDefines.h:225
Optional< PetInfo > CurrentPet
Definition: PetDefines.h:220
Definition: Player.h:1046
bool CanTameExoticPets() const
Definition: Player.h:2138
PetStable * GetPetStable()
Definition: Player.h:1178
Definition: Unit.h:1290
void SendTameFailure(uint8 result)
Definition: Unit.cpp:20168
ObjectGuid GetCharmGUID() const
Definition: Unit.h:1822
uint8 GetLevel() const
Definition: Unit.h:1420
Unit * GetExplTargetUnit()
Definition: SpellScript.cpp:433
Unit * GetCaster()
Definition: SpellScript.cpp:401

References Player::CanTameExoticPets(), PetStable::CurrentPet, SpellScript::GetCaster(), Unit::GetCharmGUID(), SpellScript::GetExplTargetUnit(), Unit::GetLevel(), Player::GetPetStable(), Object::GetTypeId(), PetStable::GetUnslottedHunterPet(), PET_TAME_ANOTHER_SUMMON_ACTIVE, PET_TAME_CANT_CONTROL_EXOTIC, PET_TAME_CREATURE_ALREADY_OWNED, PET_TAME_INVALID_CREATURE, PET_TAME_NOT_TAMEABLE, PET_TAME_TOO_HIGHLEVEL, PET_TAME_TOO_MANY, Unit::SendTameFailure(), SPELL_CAST_OK, SPELL_FAILED_ALREADY_HAVE_SUMMON, SPELL_FAILED_DONT_REPORT, Object::ToPlayer(), and TYPEID_PLAYER.

Referenced by Register().

◆ PrepareSpellScript()

spell_hun_tame_beast::PrepareSpellScript ( spell_hun_tame_beast  )
private

◆ Register()

void spell_hun_tame_beast::Register ( )
inlineoverrideprivatevirtual

Implements _SpellScript.

1006 {
1008 }
#define SpellCheckCastFn(F)
Definition: SpellScript.h:329
HookList< CheckCastHandler > OnCheckCast
Definition: SpellScript.h:328
SpellCastResult CheckCast()
Definition: spell_hunter.cpp:937

References CheckCast(), SpellScript::OnCheckCast, and SpellCheckCastFn.