Core/Pets: Fixed crash happening when current pet is forcibly removed while being temporarily unsummoned (like on a mount)
Port From (https://github.com/TrinityCore/TrinityCore/commit/688d1d9533bc42dfd5684f30b8e1c2deff2795c4)
This commit is contained in:
@@ -4834,8 +4834,23 @@ namespace Game.Entities
|
||||
m_temporaryUnsummonedPetNumber = 0;
|
||||
}
|
||||
|
||||
if (!pet || pet.GetOwnerGUID() != GetGUID())
|
||||
if (pet == null)
|
||||
{
|
||||
if (mode == PetSaveMode.NotInSlot && m_petStable.CurrentPet != null)
|
||||
{
|
||||
// Handle removing pet while it is in "temporarily unsummoned" state, for example on mount
|
||||
PreparedStatement stmt = DB.Characters.GetPreparedStatement(CharStatements.UPD_CHAR_PET_SLOT_BY_ID);
|
||||
stmt.AddValue(0, (byte)PetSaveMode.NotInSlot);
|
||||
stmt.AddValue(1, GetGUID().GetCounter());
|
||||
stmt.AddValue(2, m_petStable.CurrentPet.PetNumber);
|
||||
DB.Characters.Execute(stmt);
|
||||
|
||||
m_petStable.UnslottedPets.Add(m_petStable.CurrentPet);
|
||||
m_petStable.CurrentPet = null;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
pet.CombatStop();
|
||||
|
||||
|
||||
@@ -3351,7 +3351,7 @@ namespace Game.Spells
|
||||
Pet pet = unitTarget.ToPet();
|
||||
|
||||
ExecuteLogEffectUnsummonObject(effectInfo.Effect, pet);
|
||||
pet.GetOwner().RemovePet(pet, PetSaveMode.NotInSlot);
|
||||
pet.Remove(PetSaveMode.NotInSlot);
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.SummonObjectSlot1)]
|
||||
|
||||
Reference in New Issue
Block a user