fix: correct LFG vote kick result logic and show item names in dungeon rewards

- handleLfgBootProposalUpdate: was using myAnswer (player's own vote) to determine
  if the boot passed — should use bootVotes >= votesNeeded instead. Player who voted
  yes would see "passed" even if the vote failed, and vice versa.
- handleLfgPlayerReward: look up item name from item cache instead of showing
  raw "item #12345" for dungeon reward items
This commit is contained in:
Kelsi 2026-03-13 06:56:37 -07:00
parent cf88a960f4
commit 20b59c9d63

View file

@ -14786,7 +14786,10 @@ void GameHandler::handleLfgPlayerReward(network::Packet& packet) {
uint32_t itemCount = packet.readUInt32();
packet.readUInt8(); // unk
if (i == 0) {
rewardMsg += ", item #" + std::to_string(itemId);
std::string itemLabel = "item #" + std::to_string(itemId);
if (const ItemQueryResponseData* info = getItemInfo(itemId))
if (!info->name.empty()) itemLabel = info->name;
rewardMsg += ", " + itemLabel;
if (itemCount > 1) rewardMsg += " x" + std::to_string(itemCount);
}
}
@ -14802,15 +14805,13 @@ void GameHandler::handleLfgBootProposalUpdate(network::Packet& packet) {
if (remaining < 7 + 4 + 4 + 4 + 4) return;
bool inProgress = packet.readUInt8() != 0;
bool myVote = packet.readUInt8() != 0;
bool myAnswer = packet.readUInt8() != 0;
/*bool myVote =*/ packet.readUInt8(); // whether local player has voted
/*bool myAnswer =*/ packet.readUInt8(); // local player's vote (yes/no) — unused; result derived from counts
uint32_t totalVotes = packet.readUInt32();
uint32_t bootVotes = packet.readUInt32();
uint32_t timeLeft = packet.readUInt32();
uint32_t votesNeeded = packet.readUInt32();
(void)myVote;
lfgBootVotes_ = bootVotes;
lfgBootTotal_ = totalVotes;
lfgBootTimeLeft_ = timeLeft;
@ -14825,12 +14826,14 @@ void GameHandler::handleLfgBootProposalUpdate(network::Packet& packet) {
if (inProgress) {
lfgState_ = LfgState::Boot;
} else {
// Boot vote ended — return to InDungeon state regardless of outcome
// Boot vote ended — pass/fail determined by whether enough yes votes were cast,
// not by the local player's own vote (myAnswer = what *I* voted, not the result).
const bool bootPassed = (bootVotes >= votesNeeded);
lfgBootVotes_ = lfgBootTotal_ = lfgBootTimeLeft_ = lfgBootNeeded_ = 0;
lfgBootTargetName_.clear();
lfgBootReason_.clear();
lfgState_ = LfgState::InDungeon;
if (myAnswer) {
if (bootPassed) {
addSystemChatMessage("Dungeon Finder: Vote kick passed — member removed.");
} else {
addSystemChatMessage("Dungeon Finder: Vote kick failed.");