Fix hunter bot losing dismissed pet during maintenance (#1286)

* Prevents recreating the tamed pet in InitPet() for hunter bots

This update adds a check to prevent the InitPet() method from re-creating a pet for hunter bots that already have a tamed pet (GetPetId() != 0). This prevents pets that have already been trained and have talents set from being lost, especially after login or teleportation. Responsibility for re-summoning an existing pet can be handled separately via LoadPetFromDB.

* Including check at start to avoid creating a new pet if the bot already has one active or saved in the stable (CurrentPet).

Initial check to avoid pet re-creation.

Selection of tamable creatures appropriate to the bot's level.

Creation, configuration and saving of the pet.

Application of visual effects and initialization of talents.

Activation of autocast for non-passive spells.

* Fix

* .
This commit is contained in:
EricksOliveira
2025-05-14 09:56:50 -03:00
committed by GitHub
parent f17ec36cde
commit 4f26a8a09b

View File

@@ -813,6 +813,10 @@ void PlayerbotFactory::InitPetTalents()
void PlayerbotFactory::InitPet()
{
Pet* pet = bot->GetPet();
if (!pet && bot->GetPetStable() && bot->GetPetStable()->CurrentPet)
return;
if (!pet)
{
if (bot->getClass() != CLASS_HUNTER || bot->GetLevel() < 10)