From 743636c41621cd9defdf0a7f70fdb5d2c036df0f Mon Sep 17 00:00:00 2001 From: Kitzunu <24550914+Kitzunu@users.noreply.github.com> Date: Sat, 13 Nov 2021 01:00:30 +0100 Subject: [PATCH] fix(Scripts/Spell): don't allow to tame an already owned creature (#9005) --- src/server/game/Entities/Unit/Unit.h | 2 +- src/server/scripts/Spells/spell_hunter.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 8d1836079..a34b83edf 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1891,7 +1891,7 @@ public: DeathState getDeathState() { return m_deathState; }; virtual void setDeathState(DeathState s, bool despawn = false); // overwrited in Creature/Player/Pet - [[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); } + [[nodiscard]] ObjectGuid GetOwnerGUID() const { return GetGuidValue(UNIT_FIELD_SUMMONEDBY); } void SetOwnerGUID(ObjectGuid owner); [[nodiscard]] ObjectGuid GetCreatorGUID() const { return GetGuidValue(UNIT_FIELD_CREATEDBY); } void SetCreatorGUID(ObjectGuid creator) { SetGuidValue(UNIT_FIELD_CREATEDBY, creator); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 215e91d4f..9c26cfb8a 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -946,6 +946,12 @@ class spell_hun_tame_beast : public SpellScript player->SendTameFailure(PET_TAME_ANOTHER_SUMMON_ACTIVE); return SPELL_FAILED_DONT_REPORT; } + + if (target->GetOwnerGUID()) + { + player->SendTameFailure(PET_TAME_CREATURE_ALREADY_OWNED); + return SPELL_FAILED_DONT_REPORT; + } } else {