mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 13:46:24 +00:00
fix(Core/Pet): fix Pet::resetTalentsForAllPetsOf for stabled pets (#15779)
This commit is contained in:
@@ -2101,34 +2101,52 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= nullptr*/)
|
||||
{
|
||||
// not need after this call
|
||||
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
|
||||
{
|
||||
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
|
||||
}
|
||||
|
||||
// reset for online
|
||||
if (onlinePet)
|
||||
{
|
||||
onlinePet->resetTalents();
|
||||
}
|
||||
|
||||
PetStable* petStable = owner->GetPetStable();
|
||||
if (!petStable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::unordered_set<uint32> petIds;
|
||||
if (petStable->CurrentPet)
|
||||
{
|
||||
petIds.insert(petStable->CurrentPet->PetNumber);
|
||||
}
|
||||
|
||||
for (Optional<PetStable::PetInfo> const& stabledPet : petStable->StabledPets)
|
||||
{
|
||||
if (stabledPet)
|
||||
{
|
||||
petIds.insert(stabledPet->PetNumber);
|
||||
}
|
||||
}
|
||||
|
||||
for (PetStable::PetInfo const& unslottedPet : petStable->UnslottedPets)
|
||||
{
|
||||
petIds.insert(unslottedPet.PetNumber);
|
||||
}
|
||||
|
||||
// now need only reset for offline pets (all pets except online case)
|
||||
if (onlinePet)
|
||||
{
|
||||
petIds.erase(onlinePet->GetCharmInfo()->GetPetNumber());
|
||||
}
|
||||
|
||||
// no offline pets
|
||||
if (!petIds.empty())
|
||||
if (petIds.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool need_comma = false;
|
||||
std::ostringstream ss;
|
||||
@@ -2137,7 +2155,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= nullptr*/)
|
||||
for (uint32 id : petIds)
|
||||
{
|
||||
if (need_comma)
|
||||
{
|
||||
ss << ',';
|
||||
}
|
||||
|
||||
ss << id;
|
||||
|
||||
@@ -2150,7 +2170,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* onlinePet /*= nullptr*/)
|
||||
for (uint32 spell : sPetTalentSpells)
|
||||
{
|
||||
if (need_comma)
|
||||
{
|
||||
ss << ',';
|
||||
}
|
||||
|
||||
ss << spell;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user