diff --git a/include/game/game_handler.hpp b/include/game/game_handler.hpp index 61ee11cc..74e7ed46 100644 --- a/include/game/game_handler.hpp +++ b/include/game/game_handler.hpp @@ -440,6 +440,8 @@ public: uint8_t arenaType = 0; uint32_t statusId = 0; // 0=none, 1=wait_queue, 2=wait_join, 3=in_progress uint32_t inviteTimeout = 80; + uint32_t avgWaitTimeSec = 0; // server-estimated average wait (STATUS_WAIT_QUEUE) + uint32_t timeInQueueSec = 0; // time already spent in queue (STATUS_WAIT_QUEUE) std::chrono::steady_clock::time_point inviteReceivedTime{}; }; diff --git a/src/game/game_handler.cpp b/src/game/game_handler.cpp index 3a56a670..0bc3fac6 100644 --- a/src/game/game_handler.cpp +++ b/src/game/game_handler.cpp @@ -14537,11 +14537,12 @@ void GameHandler::handleBattlefieldStatus(network::Packet& packet) { // Parse status-specific fields uint32_t inviteTimeout = 80; // default WoW BG invite window (seconds) + uint32_t avgWaitSec = 0, timeInQueueSec = 0; if (statusId == 1) { // STATUS_WAIT_QUEUE: avgWaitTime(4) + timeInQueue(4) if (packet.getSize() - packet.getReadPos() >= 8) { - /*uint32_t avgWait =*/ packet.readUInt32(); - /*uint32_t inQueue =*/ packet.readUInt32(); + avgWaitSec = packet.readUInt32() / 1000; // ms → seconds + timeInQueueSec = packet.readUInt32() / 1000; } } else if (statusId == 2) { // STATUS_WAIT_JOIN: timeout(4) + mapId(4) @@ -14566,6 +14567,10 @@ void GameHandler::handleBattlefieldStatus(network::Packet& packet) { bgQueues_[queueSlot].bgTypeId = bgTypeId; bgQueues_[queueSlot].arenaType = arenaType; bgQueues_[queueSlot].statusId = statusId; + if (statusId == 1) { + bgQueues_[queueSlot].avgWaitTimeSec = avgWaitSec; + bgQueues_[queueSlot].timeInQueueSec = timeInQueueSec; + } if (statusId == 2 && !wasInvite) { bgQueues_[queueSlot].inviteTimeout = inviteTimeout; bgQueues_[queueSlot].inviteReceivedTime = std::chrono::steady_clock::now(); diff --git a/src/ui/game_screen.cpp b/src/ui/game_screen.cpp index 0c9ece01..7ff35b72 100644 --- a/src/ui/game_screen.cpp +++ b/src/ui/game_screen.cpp @@ -16630,8 +16630,15 @@ void GameScreen::renderMinimapMarkers(game::GameHandler& gameHandler) { ImGui::SetNextWindowSize(ImVec2(indicatorW, kIndicatorH), ImGuiCond_Always); if (ImGui::Begin("##BgQueueIndicator", nullptr, indicatorFlags)) { float pulse = 0.6f + 0.4f * std::sin(static_cast(ImGui::GetTime()) * 1.5f); - ImGui::TextColored(ImVec4(0.4f, 0.8f, 1.0f, pulse), - "In Queue: %s", bgName.c_str()); + if (slot.avgWaitTimeSec > 0) { + int avgMin = static_cast(slot.avgWaitTimeSec) / 60; + int avgSec = static_cast(slot.avgWaitTimeSec) % 60; + ImGui::TextColored(ImVec4(0.4f, 0.8f, 1.0f, pulse), + "Queue: %s (~%d:%02d)", bgName.c_str(), avgMin, avgSec); + } else { + ImGui::TextColored(ImVec4(0.4f, 0.8f, 1.0f, pulse), + "In Queue: %s", bgName.c_str()); + } } ImGui::End(); nextIndicatorY += kIndicatorH;