Core/BattlePets: Misc fixes

* The battle pet's experience and level will now be reflected in the player's UpdateFields
* Despawn summoned battle pet when it is caged
This commit is contained in:
Meji
2021-12-14 20:45:20 +01:00
committed by Shauren
parent 01ac538cd2
commit 446997cdf2
5 changed files with 59 additions and 17 deletions

View File

@@ -46,15 +46,20 @@ void WorldSession::HandleDismissCritter(WorldPackets::Pet::DismissCritter& packe
if (!pet)
{
TC_LOG_DEBUG("entities.pet", "Vanitypet (%s) does not exist - player '%s' (%s / account: %u) attempted to dismiss it (possibly lagged out)",
TC_LOG_DEBUG("entities.pet", "Critter (%s) does not exist - player '%s' (%s / account: %u) attempted to dismiss it (possibly lagged out)",
packet.CritterGUID.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetAccountId());
return;
}
if (_player->GetCritterGUID() == pet->GetGUID())
{
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsSummon())
pet->ToTempSummon()->UnSummon();
if (pet->GetTypeId() == TYPEID_UNIT && pet->IsSummon())
{
if (!_player->GetSummonedBattlePetGUID().IsEmpty() && _player->GetSummonedBattlePetGUID() == pet->GetBattlePetCompanionGUID())
_player->SetBattlePetData(nullptr);
pet->ToTempSummon()->UnSummon();
}
}
}