game: implement SMSG_PET_SPELLS/MODE/BROKEN and pet action plumbing

SMSG_PET_SPELLS: Parse full packet — pet GUID, react/command state,
10 action bar slots, per-spell entries with autocast flags.  Previously
only read the GUID.

SMSG_PET_MODE: Parse petGuid + mode uint32 (command low byte, react
high byte) to keep stance state in sync after server updates.

SMSG_PET_BROKEN: Clear pet state and show "Your pet has died." chat
message.

SMSG_PET_LEARNED_SPELL / SMSG_PET_UNLEARNED_SPELL: Maintain pet spell
list incrementally.

SMSG_PET_CAST_FAILED: Parse and log cast count + spell + reason.

New state accessors: getPetActionSlot(), getPetCommand(), getPetReact(),
getPetSpells(), isPetSpellAutocast().

CMSG_PET_ACTION: Add targetGuid (uint64) field — the wire format
requires petGuid(8)+action(4)+targetGuid(8).  Was sending an 12-byte
packet instead of the required 20 bytes.

sendPetAction(): New method that builds and sends CMSG_PET_ACTION with
the correct target guid.
This commit is contained in:
Kelsi 2026-03-09 22:53:09 -07:00
parent 52c1fed6ab
commit 06a628dae2
4 changed files with 153 additions and 12 deletions

View file

@ -2934,10 +2934,12 @@ network::Packet CancelAuraPacket::build(uint32_t spellId) {
return packet;
}
network::Packet PetActionPacket::build(uint64_t petGuid, uint32_t action) {
network::Packet PetActionPacket::build(uint64_t petGuid, uint32_t action, uint64_t targetGuid) {
// CMSG_PET_ACTION: petGuid(8) + action(4) + targetGuid(8)
network::Packet packet(wireOpcode(Opcode::CMSG_PET_ACTION));
packet.writeUInt64(petGuid);
packet.writeUInt32(action);
packet.writeUInt64(targetGuid);
return packet;
}