Core/LFG: Handle vote kick as failed if there cannot be 3 votes agreeing

Port From (https://github.com/TrinityCore/TrinityCore/commit/d1bea3e8b39c53b5427bfef9806e0282624e891f)
This commit is contained in:
hondacrx
2022-05-04 09:43:20 -04:00
parent 1a29e43785
commit 413999de36
+11 -6
View File
@@ -1219,20 +1219,25 @@ namespace Game.DungeonFinding
boot.votes[guid] = (LfgAnswer)Convert.ToInt32(accept);
byte votesNum = 0;
byte agreeNum = 0;
foreach (var itVotes in boot.votes)
byte denyNum = 0;
foreach (var (_, answer) in boot.votes)
{
if (itVotes.Value != LfgAnswer.Pending)
switch (answer)
{
++votesNum;
if (itVotes.Value == LfgAnswer.Agree)
case LfgAnswer.Pending:
break;
case LfgAnswer.Agree:
++agreeNum;
break;
case LfgAnswer.Deny:
++denyNum;
break;
}
}
// if we don't have enough votes (agree or deny) do nothing
if (agreeNum < SharedConst.LFGKickVotesNeeded && (votesNum - agreeNum) < SharedConst.LFGKickVotesNeeded)
if (agreeNum < SharedConst.LFGKickVotesNeeded && (boot.votes.Count - denyNum) >= SharedConst.LFGKickVotesNeeded)
return;
// Send update info to all players