fix(pets): summoned pets play their spawn animation and effect

Issue 546. The client plays a pet's spawnAnim ("spawn" unless set in
its config) only when the pet is constructed with state 8 (bit 0x80)
set (LWOPetComponent::Deserialize 0x00cd1270). Live summons were
constructed with status 0x84, played the pet's "despawn" effect (the
circles and stars, effect 365) and then dropped the bit; summoned pets
are now constructed that way, with the effect and the state change at
the end of the spawn animation.

Sending a pet back to the backpack killed it right after sending the
despawn effect, so the client removed it before the effect could play.
Live removed the pet some time after the effect; it is now removed once
the pet's despawn animation time has passed, and does nothing in the
meantime.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-27 08:28:57 -05:00
parent bcc47ca273
commit d1e0f21522
2 changed files with 38 additions and 2 deletions

View File

@@ -18,6 +18,13 @@ class PetComponent final : public Component
public:
static constexpr eReplicaComponentType ComponentType = eReplicaComponentType::PET;
// Bits of the serialized pet status. State number N is bit 1 << (N - 1) (the client's StateNumToIndex,
// 0x00bd19b0); the meanings are what the live server sent (2014 packet captures) and what the client does with them.
// State 8: a pet constructed with it plays its spawnAnim (LWOPetComponent::Deserialize, 0x00cd1270). Live
// constructed summoned pets with 0x84 and cleared this bit once the spawn animation was over.
static constexpr uint32_t PET_STATE_SPAWNING = 1 << 7;
explicit PetComponent(Entity* parentEntity, const int32_t componentID);
~PetComponent() override;
@@ -344,6 +351,11 @@ private:
* Pet information loaded from the CDClientDatabase
*/
CDPetComponent m_PetInfo;
/**
* Set once the pet has been sent back to the backpack; it is removed after its despawn effect has played
*/
bool m_Despawning{ false };
};
#endif // !PETCOMPONENT_H