mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 01:23:51 +00:00
feat: show estimated BG wait time in queue indicator
This commit is contained in:
parent
c31ab8c8b6
commit
792d8e1cf5
3 changed files with 18 additions and 4 deletions
|
|
@ -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{};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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<float>(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<int>(slot.avgWaitTimeSec) / 60;
|
||||
int avgSec = static_cast<int>(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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue