Core/BattlePets: Fixes when adding pets (#27076)

* Add pet when learning it for the first time (summon spell not known).
* Removed code that adds battle pet if its summon spell is known (Learn cageable pet -> Cage pet -> Log out -> Log in -> Pet is added).
* When uncaging check that the species has a summon spell before trying to learn it.
This commit is contained in:
Meji
2021-10-17 00:11:48 +02:00
committed by GitHub
parent ba4fa060d7
commit 7c15ec00c7
4 changed files with 9 additions and 18 deletions
@@ -3115,17 +3115,6 @@ bool Player::AddSpell(uint32 spellId, bool active, bool learning, bool dependent
if (sDB2Manager.GetMount(spellId))
GetSession()->GetCollectionMgr()->AddMount(spellId, MOUNT_STATUS_NONE, false, IsInWorld() ? false : true);
// need to add Battle pets automatically into pet journal
for (BattlePetSpeciesEntry const* entry : sBattlePetSpeciesStore)
{
if (entry->SummonSpellID == int32(spellId) && GetSession()->GetBattlePetMgr()->GetPetCount(entry->ID) == 0)
{
GetSession()->GetBattlePetMgr()->AddPet(entry->ID, BattlePetMgr::SelectPetDisplay(entry), BattlePetMgr::RollPetBreed(entry->ID), BattlePetMgr::GetDefaultPetQuality(entry->ID));
UpdateCriteria(CriteriaType::UniquePetsOwned);
break;
}
}
// return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell
return active && !disabled && !superceded_old;
}