From f5a834b543f5e3fa3fcb821e63eeb6bf51c227f6 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 13 Mar 2026 09:38:39 -0700 Subject: [PATCH] feat: add /clear chat command and movement speed display in stats - /clear slash command empties the chat history (was listed in autocomplete but never handled) - Stats panel shows run/flight/swim speed as percentage of base only when non-default (e.g. mounted or speed-buffed), under a new Movement section --- include/game/game_handler.hpp | 1 + src/ui/game_screen.cpp | 6 ++++++ src/ui/inventory_screen.cpp | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 86c8a43a..e380d196 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -283,6 +283,7 @@ public: * @return Vector of chat messages */ const std::deque& getChatHistory() const { return chatHistory; } + void clearChatHistory() { chatHistory.clear(); } /** * Add a locally-generated chat message (e.g., emote feedback) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 857f903d..08694921 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -4669,6 +4669,12 @@ void GameScreen::sendChatMessage(game::GameHandler& gameHandler) { return; } + if (cmdLower == "clear") { + gameHandler.clearChatHistory(); + chatInputBuffer[0] = '\0'; + return; + } + // /invite command if (cmdLower == "invite" && spacePos != std::string::npos) { std::string targetName = command.substr(spacePos + 1); diff --git a/src/ui/inventory_screen.cpp b/src/ui/inventory_screen.cpp index e5493cc5..aa6c6c75 100644 --- a/src/ui/inventory_screen.cpp +++ b/src/ui/inventory_screen.cpp @@ -1931,6 +1931,38 @@ void InventoryScreen::renderStatsPanel(game::Inventory& inventory, uint32_t play ImGui::TextColored(cyan, "Resilience: %d", resilR); } } + + // Movement speeds (always show when non-default) + { + constexpr float kBaseRun = 7.0f; + constexpr float kBaseFlight = 7.0f; + float runSpeed = gh->getServerRunSpeed(); + float flightSpeed = gh->getServerFlightSpeed(); + float swimSpeed = gh->getServerSwimSpeed(); + + bool showRun = runSpeed > 0.0f && std::fabs(runSpeed - kBaseRun) > 0.05f; + bool showFlight = flightSpeed > 0.0f && std::fabs(flightSpeed - kBaseFlight) > 0.05f; + bool showSwim = swimSpeed > 0.0f && std::fabs(swimSpeed - 4.722f) > 0.05f; + + if (showRun || showFlight || showSwim) { + ImGui::Spacing(); + ImGui::Separator(); + ImGui::TextColored(ImVec4(1.0f, 0.84f, 0.0f, 1.0f), "Movement"); + ImVec4 speedColor(0.6f, 1.0f, 0.8f, 1.0f); + if (showRun) { + float pct = (runSpeed / kBaseRun) * 100.0f; + ImGui::TextColored(speedColor, "Run Speed: %.1f%%", pct); + } + if (showFlight) { + float pct = (flightSpeed / kBaseFlight) * 100.0f; + ImGui::TextColored(speedColor, "Flight Speed: %.1f%%", pct); + } + if (showSwim) { + float pct = (swimSpeed / 4.722f) * 100.0f; + ImGui::TextColored(speedColor, "Swim Speed: %.1f%%", pct); + } + } + } } }