aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-08-16 21:39:25 +0200
committerGitHub <noreply@github.com>2020-08-16 21:39:25 +0200
commit5c1fc5e3876549f5ed2b9051fffb6f3d94a67d7a (patch)
tree7f432455e2be060cb25ba8d3b971fe866a5efc6b /src/server/scripts/Spells
parent7edad0d601a7ae925cba850c5a23019f99be2a1e (diff)
Core/Pets: Pet management refactoring (#25191)
* Core/Pets: Pet management refactoring * Preload basic pet data on character login with async query * Load additional pet data (declined names/auras/spells/cooldowns) using async query after we are sure pet loading will succeed * Remove all select queries related to pet stable/unstable * Remove all silent pet deletions except explicit UI-triggered abandons * Fixed displaying stable master content when current pet is not summoned * Allow to stable/swap unsummoned current pet Closes #3610 Closes #21266
Diffstat (limited to 'src/server/scripts/Spells')
-rw-r--r--src/server/scripts/Spells/spell_hunter.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp
index e1278a77828..48abad416b7 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -1415,8 +1415,8 @@ class spell_hun_tame_beast : public SpellScriptLoader
SpellCastResult CheckCast()
{
- Unit* caster = GetCaster();
- if (caster->GetTypeId() != TYPEID_PLAYER)
+ Player* caster = GetCaster()->ToPlayer();
+ if (!caster)
return SPELL_FAILED_DONT_REPORT;
if (!GetExplTargetUnit())
@@ -1428,11 +1428,21 @@ class spell_hun_tame_beast : public SpellScriptLoader
return SPELL_FAILED_HIGHLEVEL;
// use SMSG_PET_TAME_FAILURE?
- if (!target->GetCreatureTemplate()->IsTameable(caster->ToPlayer()->CanTameExoticPets()))
+ if (!target->GetCreatureTemplate()->IsTameable(caster->CanTameExoticPets()))
return SPELL_FAILED_BAD_TARGETS;
- if (caster->GetPetGUID())
- return SPELL_FAILED_ALREADY_HAVE_SUMMON;
+ PetStable const* petStable = caster->GetPetStable();
+ if (petStable)
+ {
+ if (petStable->CurrentPet)
+ return SPELL_FAILED_ALREADY_HAVE_SUMMON;
+
+ if (petStable->GetUnslottedHunterPet())
+ {
+ caster->SendTameFailure(PETTAME_TOOMANY);
+ return SPELL_FAILED_DONT_REPORT;
+ }
+ }
if (caster->GetCharmedGUID())
return SPELL_FAILED_ALREADY_HAVE_CHARM;