From 09860e5fc675dbd646fc84d24521f50b5a5d4c71 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 18 Mar 2026 10:22:39 -0700 Subject: [PATCH] feat: add /loc command to show player coordinates Type /loc, /coords, or /whereami in chat to display current position (X, Y, Z) and zone name as a system message. Useful for sharing locations or debugging position issues. --- src/ui/game_screen.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 247df7d2..0b7defa5 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -5879,6 +5879,26 @@ void GameScreen::sendChatMessage(game::GameHandler& gameHandler) { return; } + // /loc command — print player coordinates and zone name + if (cmdLower == "loc" || cmdLower == "coords" || cmdLower == "whereami") { + const auto& pmi = gameHandler.getMovementInfo(); + std::string zoneName; + if (auto* rend = core::Application::getInstance().getRenderer()) + zoneName = rend->getCurrentZoneName(); + char buf[256]; + snprintf(buf, sizeof(buf), "%.1f, %.1f, %.1f%s%s", + pmi.x, pmi.y, pmi.z, + zoneName.empty() ? "" : " — ", + zoneName.c_str()); + game::MessageChatData sysMsg; + sysMsg.type = game::ChatType::SYSTEM; + sysMsg.language = game::ChatLanguage::UNIVERSAL; + sysMsg.message = buf; + gameHandler.addLocalChatMessage(sysMsg); + chatInputBuffer[0] = '\0'; + return; + } + // /zone command — print current zone name if (cmdLower == "zone") { std::string zoneName;