mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-23 07:40:14 +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
|
|
@ -3030,11 +3030,41 @@ void GameScreen::renderPetFrame(game::GameHandler& gameHandler) {
|
|||
if (ImGui::MenuItem("Target Pet")) {
|
||||
gameHandler.setTarget(petGuid);
|
||||
}
|
||||
if (ImGui::MenuItem("Rename Pet")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
petRenameOpen_ = true;
|
||||
petRenameBuf_[0] = '\0';
|
||||
}
|
||||
if (ImGui::MenuItem("Dismiss Pet")) {
|
||||
gameHandler.dismissPet();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
// Pet rename modal (opened via context menu)
|
||||
if (petRenameOpen_) {
|
||||
ImGui::OpenPopup("Rename Pet###PetRename");
|
||||
petRenameOpen_ = false;
|
||||
}
|
||||
if (ImGui::BeginPopupModal("Rename Pet###PetRename", nullptr,
|
||||
ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoCollapse)) {
|
||||
ImGui::Text("Enter new pet name (max 12 characters):");
|
||||
ImGui::SetNextItemWidth(180.0f);
|
||||
bool submitted = ImGui::InputText("##PetRenameInput", petRenameBuf_, sizeof(petRenameBuf_),
|
||||
ImGuiInputTextFlags_EnterReturnsTrue);
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("OK") || submitted) {
|
||||
std::string newName(petRenameBuf_);
|
||||
if (!newName.empty() && newName.size() <= 12) {
|
||||
gameHandler.renamePet(newName);
|
||||
}
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::SameLine();
|
||||
if (ImGui::Button("Cancel")) {
|
||||
ImGui::CloseCurrentPopup();
|
||||
}
|
||||
ImGui::EndPopup();
|
||||
}
|
||||
ImGui::PopStyleColor();
|
||||
if (petLevel > 0) {
|
||||
ImGui::SameLine();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue