From 4f26a8a09b8832a2d129a020daa096238dd8f84d Mon Sep 17 00:00:00 2001 From: EricksOliveira Date: Wed, 14 May 2025 09:56:50 -0300 Subject: [PATCH] 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 * . --- src/factory/PlayerbotFactory.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/factory/PlayerbotFactory.cpp b/src/factory/PlayerbotFactory.cpp index 2c55c4ef..3eb165db 100644 --- a/src/factory/PlayerbotFactory.cpp +++ b/src/factory/PlayerbotFactory.cpp @@ -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)