mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
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.
This commit is contained in:
parent
dfddc71ebb
commit
09860e5fc6
1 changed files with 20 additions and 0 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue