Core/Pets: Fixed crash when summoning hunter pets

This commit is contained in:
Shauren
2023-07-05 00:18:55 +02:00
parent aa96fce1db
commit 074c5da6e4
2 changed files with 6 additions and 2 deletions
@@ -497,7 +497,7 @@ bool Creature::InitEntry(uint32 entry, CreatureData const* data /*= nullptr*/)
m_creatureInfo = creatureInfo;
SetEntry(entry);
m_creatureDifficulty = creatureInfo->GetDifficulty(GetMap()->GetDifficultyID());
m_creatureDifficulty = creatureInfo->GetDifficulty(!IsPet() ? GetMap()->GetDifficultyID() : DIFFICULTY_NONE);
// equal to player Race field, but creature does not have race
SetRace(RACE_NONE);
+5 -1
View File
@@ -230,7 +230,11 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petEntry, uint32 petnumber, bool c
if (petInfo->Type == HUNTER_PET)
{
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petInfo->CreatureId);
if (!creatureInfo || !creatureInfo->IsTameable(owner->CanTameExoticPets(), GetCreatureDifficulty()))
if (!creatureInfo)
return false;
CreatureDifficulty const* creatureDifficulty = creatureInfo->GetDifficulty(DIFFICULTY_NONE);
if (!creatureDifficulty || !creatureInfo->IsTameable(owner->CanTameExoticPets(), creatureDifficulty))
return false;
}