Bots: the idle pet upkeep also revives a pet whose body is gone

The out-of-combat pet upkeep had its own Revive Pet check, still tied
to the pet guid. Once the dead pet's body despawned it fell through to
the Call Pet loop, which the core refuses while the pet is saved dead.
It now revives for a saved-dead active pet too, and never casts Call
Pet while one is (it waits for Revive Pet to be ready).
This commit is contained in:
Karrz1
2026-11-15 09:28:11 +00:00
parent 3dd6af5795
commit 27e159c56f
@@ -359,9 +359,17 @@ bool MaintainPet(BotSnapshotView const& s, BotAI& ai, BotIntentEmitter& emit,
constexpr uint32 CALL_PET_4 = 83244;
constexpr uint32 CALL_PET_5 = 83245;
constexpr uint32 REVIVE_PET = 982;
// Pet entry exists but is dead → revive
if (!s.pet_guid().IsEmpty() && s.knows_spell(REVIVE_PET) && s.is_ready(REVIVE_PET))
// The pet died: its body still lies there (a guid but no living pet), or the body is gone and the pet is saved dead in an
// active slot (no guid any more). Only Revive Pet brings it back; the core refuses Call Pet for every active pet while one is
// saved dead, so never fall through to the Call Pet loop below (it was cast again and again, Discord 2026-11-14).
bool active_pet_dead = false;
for (auto const& sp : s.raw().pet.stable_pets)
if (sp.slot_kind == 0 && sp.creature_id != 0 && sp.dead)
{ active_pet_dead = true; break; }
if (!s.pet_guid().IsEmpty() || active_pet_dead)
{
if (!s.knows_spell(REVIVE_PET) || !s.is_ready(REVIVE_PET))
return false;
emit.cast(REVIVE_PET);
ai.note_pet_summon_attempt(pet_now_ms);
return true;