Add Ctrl+click minimap ping sending

Ctrl+clicking on the minimap converts screen position to world coordinates
and sends MSG_MINIMAP_PING to the server. A local ping is also added
immediately so the sender sees their own ping.
This commit is contained in:
Kelsi 2026-03-11 23:00:03 -07:00
parent 97662800d5
commit ae8f900410
3 changed files with 48 additions and 0 deletions

View file

@ -7710,6 +7710,29 @@ void GameHandler::sendPing() {
socket->send(packet);
}
void GameHandler::sendMinimapPing(float wowX, float wowY) {
if (state != WorldState::IN_WORLD) return;
// MSG_MINIMAP_PING (CMSG direction): float posX + float posY
// Server convention: posX = east/west axis = canonical Y (west)
// posY = north/south axis = canonical X (north)
const float serverX = wowY; // canonical Y (west) → server posX
const float serverY = wowX; // canonical X (north) → server posY
network::Packet pkt(wireOpcode(Opcode::MSG_MINIMAP_PING));
pkt.writeFloat(serverX);
pkt.writeFloat(serverY);
socket->send(pkt);
// Add ping locally so the sender sees their own ping immediately
MinimapPing localPing;
localPing.senderGuid = activeCharacterGuid_;
localPing.wowX = wowX;
localPing.wowY = wowY;
localPing.age = 0.0f;
minimapPings_.push_back(localPing);
}
void GameHandler::handlePong(network::Packet& packet) {
LOG_DEBUG("Handling SMSG_PONG");