mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-02 15:53:51 +00:00
feat: respect loot roll voteMask for button visibility
Store the voteMask from SMSG_LOOT_START_ROLL and use it to conditionally show Need/Greed/Disenchant/Pass buttons. Previously all four buttons were always shown regardless of the server's allowed roll types.
This commit is contained in:
parent
02a1b5cbf3
commit
209f60031e
3 changed files with 25 additions and 13 deletions
|
|
@ -1458,6 +1458,7 @@ public:
|
||||||
std::string itemName;
|
std::string itemName;
|
||||||
uint8_t itemQuality = 0;
|
uint8_t itemQuality = 0;
|
||||||
uint32_t rollCountdownMs = 60000; // Duration of roll window in ms
|
uint32_t rollCountdownMs = 60000; // Duration of roll window in ms
|
||||||
|
uint8_t voteMask = 0xFF; // Bitmask: 0x01=pass, 0x02=need, 0x04=greed, 0x08=disenchant
|
||||||
std::chrono::steady_clock::time_point rollStartedAt{};
|
std::chrono::steady_clock::time_point rollStartedAt{};
|
||||||
|
|
||||||
struct PlayerRollResult {
|
struct PlayerRollResult {
|
||||||
|
|
|
||||||
|
|
@ -2344,7 +2344,7 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
/*uint32_t randProp =*/ packet.readUInt32();
|
/*uint32_t randProp =*/ packet.readUInt32();
|
||||||
}
|
}
|
||||||
uint32_t countdown = packet.readUInt32();
|
uint32_t countdown = packet.readUInt32();
|
||||||
/*uint8_t voteMask =*/ packet.readUInt8();
|
uint8_t voteMask = packet.readUInt8();
|
||||||
// Trigger the roll popup for local player
|
// Trigger the roll popup for local player
|
||||||
pendingLootRollActive_ = true;
|
pendingLootRollActive_ = true;
|
||||||
pendingLootRoll_.objectGuid = objectGuid;
|
pendingLootRoll_.objectGuid = objectGuid;
|
||||||
|
|
@ -2358,9 +2358,10 @@ void GameHandler::handlePacket(network::Packet& packet) {
|
||||||
pendingLootRoll_.itemName = info ? info->name : std::to_string(itemId);
|
pendingLootRoll_.itemName = info ? info->name : std::to_string(itemId);
|
||||||
pendingLootRoll_.itemQuality = info ? static_cast<uint8_t>(info->quality) : 0;
|
pendingLootRoll_.itemQuality = info ? static_cast<uint8_t>(info->quality) : 0;
|
||||||
pendingLootRoll_.rollCountdownMs = (countdown > 0 && countdown <= 120000) ? countdown : 60000;
|
pendingLootRoll_.rollCountdownMs = (countdown > 0 && countdown <= 120000) ? countdown : 60000;
|
||||||
|
pendingLootRoll_.voteMask = voteMask;
|
||||||
pendingLootRoll_.rollStartedAt = std::chrono::steady_clock::now();
|
pendingLootRoll_.rollStartedAt = std::chrono::steady_clock::now();
|
||||||
LOG_INFO("SMSG_LOOT_START_ROLL: item=", itemId, " (", pendingLootRoll_.itemName,
|
LOG_INFO("SMSG_LOOT_START_ROLL: item=", itemId, " (", pendingLootRoll_.itemName,
|
||||||
") slot=", slot);
|
") slot=", slot, " voteMask=0x", std::hex, (int)voteMask, std::dec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13198,20 +13198,30 @@ void GameScreen::renderLootRollPopup(game::GameHandler& gameHandler) {
|
||||||
}
|
}
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
if (ImGui::Button("Need", ImVec2(80, 30))) {
|
// voteMask bits: 0x01=pass, 0x02=need, 0x04=greed, 0x08=disenchant
|
||||||
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 0);
|
const uint8_t vm = roll.voteMask;
|
||||||
|
bool first = true;
|
||||||
|
if (vm & 0x02) {
|
||||||
|
if (ImGui::Button("Need", ImVec2(80, 30)))
|
||||||
|
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 0);
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
if (vm & 0x04) {
|
||||||
if (ImGui::Button("Greed", ImVec2(80, 30))) {
|
if (!first) ImGui::SameLine();
|
||||||
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 1);
|
if (ImGui::Button("Greed", ImVec2(80, 30)))
|
||||||
|
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 1);
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
if (vm & 0x08) {
|
||||||
if (ImGui::Button("Disenchant", ImVec2(95, 30))) {
|
if (!first) ImGui::SameLine();
|
||||||
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 2);
|
if (ImGui::Button("Disenchant", ImVec2(95, 30)))
|
||||||
|
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 2);
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
if (vm & 0x01) {
|
||||||
if (ImGui::Button("Pass", ImVec2(70, 30))) {
|
if (!first) ImGui::SameLine();
|
||||||
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 96);
|
if (ImGui::Button("Pass", ImVec2(70, 30)))
|
||||||
|
gameHandler.sendLootRoll(roll.objectGuid, roll.slot, 96);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Live roll results from group members
|
// Live roll results from group members
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue