feat: add countdown timer to loot roll popup

Show a color-coded progress bar (green→yellow→pulsing red) in the loot
roll window indicating time remaining to make a roll decision. The
countdown duration is read from SMSG_LOOT_START_ROLL (or defaults to
60s for the SMSG_LOOT_ROLL path). Remaining seconds are displayed on
the bar itself.
This commit is contained in:
Kelsi 2026-03-12 04:57:36 -07:00
parent b34bf39746
commit b682e8c686
3 changed files with 35 additions and 1 deletions

View file

@ -2028,7 +2028,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
/*uint32_t randSuffix =*/ packet.readUInt32();
/*uint32_t randProp =*/ packet.readUInt32();
}
/*uint32_t countdown =*/ packet.readUInt32();
uint32_t countdown = packet.readUInt32();
/*uint8_t voteMask =*/ packet.readUInt8();
// Trigger the roll popup for local player
pendingLootRollActive_ = true;
@ -2038,6 +2038,8 @@ void GameHandler::handlePacket(network::Packet& packet) {
auto* info = getItemInfo(itemId);
pendingLootRoll_.itemName = info ? info->name : std::to_string(itemId);
pendingLootRoll_.itemQuality = info ? static_cast<uint8_t>(info->quality) : 0;
pendingLootRoll_.rollCountdownMs = (countdown > 0 && countdown <= 120000) ? countdown : 60000;
pendingLootRoll_.rollStartedAt = std::chrono::steady_clock::now();
LOG_INFO("SMSG_LOOT_START_ROLL: item=", itemId, " (", pendingLootRoll_.itemName,
") slot=", slot);
break;
@ -19931,6 +19933,8 @@ void GameHandler::handleLootRoll(network::Packet& packet) {
auto* info = getItemInfo(itemId);
pendingLootRoll_.itemName = info ? info->name : std::to_string(itemId);
pendingLootRoll_.itemQuality = info ? static_cast<uint8_t>(info->quality) : 0;
pendingLootRoll_.rollCountdownMs = 60000;
pendingLootRoll_.rollStartedAt = std::chrono::steady_clock::now();
LOG_INFO("SMSG_LOOT_ROLL: need/greed prompt for item=", itemId,
" (", pendingLootRoll_.itemName, ") slot=", slot);
return;