mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-04 16:23:52 +00:00
feat: implement CMSG_PET_RENAME with rename dialog in pet frame
- Add PetRenamePacket::build(petGuid, name, isDeclined) builder - Add GameHandler::renamePet(newName) — sends packet via petGuid_ - Add 'Rename Pet' to pet frame context menu (right-click pet name) - Modal input dialog with 12-char limit matches server validation
This commit is contained in:
parent
9aa4b223dc
commit
bba2f20588
6 changed files with 60 additions and 0 deletions
|
|
@ -14655,6 +14655,14 @@ void GameHandler::dismissPet() {
|
|||
socket->send(packet);
|
||||
}
|
||||
|
||||
void GameHandler::renamePet(const std::string& newName) {
|
||||
if (petGuid_ == 0 || state != WorldState::IN_WORLD || !socket) return;
|
||||
if (newName.empty() || newName.size() > 12) return; // Server enforces max 12 chars
|
||||
auto packet = PetRenamePacket::build(petGuid_, newName, 0);
|
||||
socket->send(packet);
|
||||
LOG_INFO("Sent CMSG_PET_RENAME: petGuid=0x", std::hex, petGuid_, std::dec, " name='", newName, "'");
|
||||
}
|
||||
|
||||
void GameHandler::requestStabledPetList() {
|
||||
if (state != WorldState::IN_WORLD || !socket || stableMasterGuid_ == 0) return;
|
||||
auto pkt = ListStabledPetsPacket::build(stableMasterGuid_);
|
||||
|
|
|
|||
|
|
@ -5421,5 +5421,13 @@ network::Packet UnstablePetPacket::build(uint64_t stableMasterGuid, uint32_t pet
|
|||
return p;
|
||||
}
|
||||
|
||||
network::Packet PetRenamePacket::build(uint64_t petGuid, const std::string& name, uint8_t isDeclined) {
|
||||
network::Packet p(wireOpcode(Opcode::CMSG_PET_RENAME));
|
||||
p.writeUInt64(petGuid);
|
||||
p.writeString(name); // null-terminated
|
||||
p.writeUInt8(isDeclined);
|
||||
return p;
|
||||
}
|
||||
|
||||
} // namespace game
|
||||
} // namespace wowee
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue