Add movement packed GUID, inventory money display, and character screen buttons

Fix movement packets to include packed player GUID prefix so the server
tracks position. Fix inventory money display being clipped by child panels.
Add Back and Delete Character buttons to character selection screen with
two-step delete confirmation.
This commit is contained in:
Kelsi 2026-02-06 03:24:46 -08:00
parent e327344a9b
commit 20f89b2d4a
9 changed files with 156 additions and 15 deletions

View file

@ -161,10 +161,29 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
ImGui::SameLine();
// Display character GUID
std::stringstream guidStr;
guidStr << "GUID: 0x" << std::hex << std::uppercase << std::setfill('0') << std::setw(16) << character.guid;
ImGui::TextDisabled("%s", guidStr.str().c_str());
// Delete Character button
if (!confirmDelete) {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.1f, 0.1f, 1.0f));
if (ImGui::Button("Delete Character", ImVec2(150, 40))) {
confirmDelete = true;
}
ImGui::PopStyleColor();
} else {
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.8f, 0.0f, 0.0f, 1.0f));
if (ImGui::Button("Confirm Delete?", ImVec2(150, 40))) {
if (onDeleteCharacter) {
onDeleteCharacter(character.guid);
}
confirmDelete = false;
selectedCharacterIndex = -1;
selectedCharacterGuid = 0;
}
ImGui::PopStyleColor();
ImGui::SameLine();
if (ImGui::Button("Cancel", ImVec2(80, 40))) {
confirmDelete = false;
}
}
}
}
@ -173,6 +192,14 @@ void CharacterScreen::render(game::GameHandler& gameHandler) {
ImGui::Spacing();
// Back/Refresh/Create buttons
if (ImGui::Button("Back", ImVec2(120, 0))) {
if (onBack) {
onBack();
}
}
ImGui::SameLine();
if (ImGui::Button("Refresh", ImVec2(120, 0))) {
if (gameHandler.getState() == game::WorldState::READY ||
gameHandler.getState() == game::WorldState::CHAR_LIST_RECEIVED) {

View file

@ -263,18 +263,22 @@ void InventoryScreen::render(game::Inventory& inventory, uint64_t moneyCopper) {
return;
}
// Reserve space for money display at bottom
float moneyHeight = ImGui::GetFrameHeightWithSpacing() + ImGui::GetStyle().ItemSpacing.y;
float panelHeight = ImGui::GetContentRegionAvail().y - moneyHeight;
// Two-column layout: Equipment (left) | Backpack (right)
ImGui::BeginChild("EquipPanel", ImVec2(200.0f, 0.0f), true);
ImGui::BeginChild("EquipPanel", ImVec2(200.0f, panelHeight), true);
renderEquipmentPanel(inventory);
ImGui::EndChild();
ImGui::SameLine();
ImGui::BeginChild("BackpackPanel", ImVec2(0.0f, 0.0f), true);
ImGui::BeginChild("BackpackPanel", ImVec2(0.0f, panelHeight), true);
renderBackpackPanel(inventory);
ImGui::EndChild();
ImGui::Separator();
// Money display
uint64_t gold = moneyCopper / 10000;
uint64_t silver = (moneyCopper / 100) % 100;
uint64_t copper = moneyCopper % 100;