[Pets] Fix renamed pets loading as blank names (#4751)

This commit is contained in:
nytmyr authored and GitHub committed 2025-03-05 14:31:16 -05:00
1 parent 09e079a45e
commit 8cd7148b29
1 file changed
+8 -5
+8 -5
View File
@@ -165,11 +165,14 @@ void Mob::MakePoweredPet(uint16 spell_id, const char* pettype, int16 petpower,
// 4 - Keep DB name
// 5 - `s ward
if (IsClient() && !petname) {
const auto vanity_name = CharacterPetNameRepository::FindOne(database, CastToClient()->CharacterID());
if (!vanity_name.name.empty()) {
petname = vanity_name.name.c_str();
}
const auto vanity_name = (IsClient() && !petname) ? CharacterPetNameRepository::FindOne(database, CastToClient()->CharacterID()) : CharacterPetNameRepository::CharacterPetName{};
if (
IsClient() &&
!petname &&
!vanity_name.name.empty()
) {
petname = vanity_name.name.c_str();
}
if (petname != nullptr) {