mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
feat: handle SMSG_PET_UNLEARN_CONFIRM with pet talent respec dialog
Parses the pet talent wipe confirm packet (petGuid + cost), shows a confirmation dialog matching the player talent reset UX, and sends CMSG_PET_UNLEARN_TALENTS on confirmation. Completes the pet talent respec flow for Hunters/Warlocks on WotLK servers.
This commit is contained in:
parent
67c8101f67
commit
49ba89dfc3
4 changed files with 103 additions and 1 deletions
|
|
@ -741,6 +741,7 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
|||
renderReclaimCorpseButton(gameHandler);
|
||||
renderResurrectDialog(gameHandler);
|
||||
renderTalentWipeConfirmDialog(gameHandler);
|
||||
renderPetUnlearnConfirmDialog(gameHandler);
|
||||
renderChatBubbles(gameHandler);
|
||||
renderEscapeMenu();
|
||||
renderSettingsWindow();
|
||||
|
|
@ -15568,6 +15569,74 @@ void GameScreen::renderTalentWipeConfirmDialog(game::GameHandler& gameHandler) {
|
|||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
void GameScreen::renderPetUnlearnConfirmDialog(game::GameHandler& gameHandler) {
|
||||
if (!gameHandler.showPetUnlearnDialog()) return;
|
||||
|
||||
auto* window = core::Application::getInstance().getWindow();
|
||||
float screenW = window ? static_cast<float>(window->getWidth()) : 1280.0f;
|
||||
float screenH = window ? static_cast<float>(window->getHeight()) : 720.0f;
|
||||
|
||||
float dlgW = 340.0f;
|
||||
float dlgH = 130.0f;
|
||||
ImGui::SetNextWindowPos(ImVec2(screenW / 2 - dlgW / 2, screenH * 0.3f), ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize(ImVec2(dlgW, dlgH), ImGuiCond_Always);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 8.0f);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.1f, 0.1f, 0.15f, 0.95f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.8f, 0.7f, 0.2f, 1.0f));
|
||||
|
||||
if (ImGui::Begin("##PetUnlearnDialog", nullptr,
|
||||
ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove |
|
||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar)) {
|
||||
|
||||
ImGui::Spacing();
|
||||
uint32_t cost = gameHandler.getPetUnlearnCost();
|
||||
uint32_t gold = cost / 10000;
|
||||
uint32_t silver = (cost % 10000) / 100;
|
||||
uint32_t copper = cost % 100;
|
||||
char costStr[64];
|
||||
if (gold > 0)
|
||||
std::snprintf(costStr, sizeof(costStr), "%ug %us %uc", gold, silver, copper);
|
||||
else if (silver > 0)
|
||||
std::snprintf(costStr, sizeof(costStr), "%us %uc", silver, copper);
|
||||
else
|
||||
std::snprintf(costStr, sizeof(costStr), "%uc", copper);
|
||||
|
||||
std::string text = std::string("Reset your pet's talents for ") + costStr + "?";
|
||||
float textW = ImGui::CalcTextSize(text.c_str()).x;
|
||||
ImGui::SetCursorPosX(std::max(4.0f, (dlgW - textW) / 2));
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.9f, 0.4f, 1.0f), "%s", text.c_str());
|
||||
|
||||
ImGui::Spacing();
|
||||
ImGui::SetCursorPosX(8.0f);
|
||||
ImGui::TextDisabled("All pet talent points will be refunded.");
|
||||
ImGui::Spacing();
|
||||
|
||||
float btnW = 110.0f;
|
||||
float spacing = 20.0f;
|
||||
ImGui::SetCursorPosX((dlgW - btnW * 2 - spacing) / 2);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.2f, 0.5f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.3f, 0.7f, 0.3f, 1.0f));
|
||||
if (ImGui::Button("Confirm##petunlearn", ImVec2(btnW, 30))) {
|
||||
gameHandler.confirmPetUnlearn();
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
ImGui::SameLine(0, spacing);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.5f, 0.2f, 0.2f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.7f, 0.3f, 0.3f, 1.0f));
|
||||
if (ImGui::Button("Cancel##petunlearn", ImVec2(btnW, 30))) {
|
||||
gameHandler.cancelPetUnlearn();
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
}
|
||||
ImGui::End();
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar();
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Settings Window
|
||||
// ============================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue