Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Core/Spells: no longer allow to summon exotic beasts if the Hunter ca…
Browse files Browse the repository at this point in the history
…n't control them
  • Loading branch information
Ovahlord committed Oct 15, 2023
1 parent 54c95d9 commit 8d8099e
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2569,6 +2569,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)

bool isClassPet = m_spellInfo->SpellFamilyName != SPELLFAMILY_GENERIC || petCreatureId == 0;

// Hunter pet handling
if (petCreatureId == 0 && unitCaster->IsPlayer())
{
Player* player = unitCaster->ToPlayer();
Expand All @@ -2594,6 +2595,17 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
{
if (PlayerPetData* petData = player->GetPlayerPetData(key->first, key->second))
{
if (petData->TamedCreatureId)
{
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(petData->TamedCreatureId);
if (cInfo->StaticFlags.HasFlag(CREATURE_STATIC_FLAG_3_TAMEABLE_EXOTIC) && !player->CanTameExoticPets())
{
player->GetSession()->SendStableResult(PetStableResultCode::CannotControlExoticPets);
player->GetSpellHistory()->ResetCooldown(m_spellInfo->Id, true);
return;
}
}

if (petData->SavedHealth == 0)
{
player->SendTamePetFailure(PET_TAME_FAILURE_DEAD_PET);
Expand All @@ -2608,6 +2620,22 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex)
return;
}
}
else
{
if (PlayerPetData* petData = player->GetPlayerPetData(petSlotIndex, 0))
{
if (petData->TamedCreatureId)
{
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(petData->TamedCreatureId);
if (cInfo->StaticFlags.HasFlag(CREATURE_STATIC_FLAG_3_TAMEABLE_EXOTIC) && !player->CanTameExoticPets())
{
player->GetSession()->SendStableResult(PetStableResultCode::CannotControlExoticPets);
player->GetSpellHistory()->ResetCooldown(m_spellInfo->Id, true);
return;
}
}
}
}
}

if (NewPet* summon = unitCaster->SummonPet(petCreatureId, petSlotIndex, m_spellInfo->Id, isClassPet, *destTarget))
Expand Down

0 comments on commit 8d8099e

Please sign in to comment.