Core/BattlePets: Misc fixes

Port From (https://github.com/TrinityCore/TrinityCore/commit/446997cdf2bf24163141d7dcaa80bb6ef891f933)
This commit is contained in:
hondacrx
2022-01-01 17:37:27 -05:00
parent 23ee2b5a48
commit c900592e1c
4 changed files with 57 additions and 15 deletions
+7 -2
View File
@@ -34,15 +34,20 @@ namespace Game
Unit pet = ObjectAccessor.GetCreatureOrPetOrVehicle(GetPlayer(), packet.CritterGUID);
if (!pet)
{
Log.outDebug(LogFilter.Network, "Vanitypet {0} does not exist - player '{1}' ({2} / account: {3}) attempted to dismiss it (possibly lagged out)",
Log.outDebug(LogFilter.Network, "Critter {0} does not exist - player '{1}' ({2} / account: {3}) attempted to dismiss it (possibly lagged out)",
packet.CritterGUID.ToString(), GetPlayer().GetName(), GetPlayer().GetGUID().ToString(), GetAccountId());
return;
}
if (GetPlayer().GetCritterGUID() == pet.GetGUID())
{
if (pet.IsTypeId(TypeId.Unit) && pet.ToCreature().IsSummon())
if (pet.IsCreature() && pet.IsSummon())
{
if (!_player.GetSummonedBattlePetGUID().IsEmpty() && _player.GetSummonedBattlePetGUID() == pet.GetBattlePetCompanionGUID())
_player.SetBattlePetData(null);
pet.ToTempSummon().UnSummon();
}
}
}