aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts/Spells
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2020-08-16 21:39:25 +0200
committerShauren <shauren.trinity@gmail.com>2022-01-31 00:17:21 +0100
commitca92686b44cc8c53a8991bf02d6e8534797fc115 (patch)
tree2456cf72513722d93bb444590a4606d7717261d6 /src/server/scripts/Spells
parentb79a91039bba12d62e43806d8a20ad76107ac5d7 (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 (cherry picked from commit 5c1fc5e3876549f5ed2b9051fffb6f3d94a67d7a)
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 e3be7cf78ed..ef3197d7119 100644
--- a/src/server/scripts/Spells/spell_hunter.cpp
+++ b/src/server/scripts/Spells/spell_hunter.cpp
@@ -617,8 +617,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())
@@ -630,11 +630,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().IsEmpty())
- 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(PetTameResult::TooMany);
+ return SPELL_FAILED_DONT_REPORT;
+ }
+ }
if (!caster->GetCharmedGUID().IsEmpty())
return SPELL_FAILED_ALREADY_HAVE_CHARM;