Customvote now shows number of votes for each option

This commit is contained in:
rhailrake
2023-04-27 21:02:35 +06:00
committed by Remuchi
parent d2b52acee3
commit 976b6788a8

View File

@@ -164,11 +164,13 @@ namespace Content.Server.Voting
var ties = string.Join(", ", eventArgs.Winners.Select(c => args[(int) c]));
_adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Custom vote {options.Title} finished as tie: {ties}");
chatMgr.DispatchServerAnnouncement(Loc.GetString("cmd-customvote-on-finished-tie",("ties", ties)));
DisplayVoteResult(vote, chatMgr, args);
}
else
{
_adminLogger.Add(LogType.Vote, LogImpact.Medium, $"Custom vote {options.Title} finished: {args[(int) eventArgs.Winner]}");
chatMgr.DispatchServerAnnouncement(Loc.GetString("cmd-customvote-on-finished-win",("winner", args[(int) eventArgs.Winner])));
DisplayVoteResult(vote, chatMgr, args);
}
for (int i = 0; i < eventArgs.Votes.Count - 1; i++)
@@ -185,6 +187,17 @@ namespace Content.Server.Voting
};
}
private void DisplayVoteResult(IVoteHandle vote, IChatManager chatMgr, string[] args)
{
chatMgr.DispatchServerAnnouncement(Loc.GetString("cmd-customvote-on-finished-votes", ("title", vote.Title)));
for (var x = 1; x < args.Length; x++)
{
var option = args[x];
var votes = vote.VotesPerOption[x];
chatMgr.DispatchServerAnnouncement(Loc.GetString("cmd-customvote-option-votes",("option", option), ("votes", votes)));
}
}
public CompletionResult GetCompletion(IConsoleShell shell, string[] args)
{
if (args.Length == 1)