mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-25 03:12:09 +01:00
Core/Pets: Updated pet summoning for latest client version (5 Call Pet spells and stable size 200)
This commit is contained in:
@@ -615,6 +615,15 @@ class spell_hun_tame_beast : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_hun_tame_beast_SpellScript);
|
||||
|
||||
static constexpr uint32 CallPetSpellIds[MAX_ACTIVE_PETS] =
|
||||
{
|
||||
883,
|
||||
83242,
|
||||
83243,
|
||||
83244,
|
||||
83245,
|
||||
};
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
@@ -633,13 +642,25 @@ class spell_hun_tame_beast : public SpellScriptLoader
|
||||
if (!target->GetCreatureTemplate()->IsTameable(caster->CanTameExoticPets()))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
|
||||
PetStable const* petStable = caster->GetPetStable();
|
||||
if (petStable)
|
||||
if (PetStable const* petStable = caster->GetPetStable())
|
||||
{
|
||||
if (petStable->CurrentPet)
|
||||
if (petStable->CurrentPetIndex)
|
||||
return SPELL_FAILED_ALREADY_HAVE_SUMMON;
|
||||
|
||||
if (petStable->GetUnslottedHunterPet())
|
||||
auto freeSlotItr = std::find_if(petStable->ActivePets.begin(), petStable->ActivePets.end(), [](Optional<PetStable::PetInfo> const& petInfo)
|
||||
{
|
||||
return !petInfo.has_value();
|
||||
});
|
||||
|
||||
if (freeSlotItr == petStable->ActivePets.end())
|
||||
{
|
||||
caster->SendTameFailure(PetTameResult::TooMany);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
}
|
||||
|
||||
// Check for known Call Pet X spells
|
||||
std::size_t freeSlotIndex = std::distance(petStable->ActivePets.begin(), freeSlotItr);
|
||||
if (!caster->HasSpell(CallPetSpellIds[freeSlotIndex]))
|
||||
{
|
||||
caster->SendTameFailure(PetTameResult::TooMany);
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
Reference in New Issue
Block a user