When a vote is tied, the system picks the first vote which is a bit less fun. Although this won't usually happen with larger streamers, it happens often with smaller creators.
My understanding is that the vote resolution happens in RoR2-VsTwitch/ItemRoller/VoteStrategy/MaxVoteStrategy.cs in this bit :
winner = default;
int highestVote = -1;
foreach (var tally in totalVotes)
{
if (tally.Value > highestVote)
{
winner = tally.Key;
highestVote = tally.Value;
}
}
return winner;
Instead of this a list should be created to store all the tied votes then a random element of this list picked. I found a solution to this for the previous version of this mod
public int Apply(List options)
{
Debug.Log("start apply strategy");
var votedValue = 0;
List voted = new List() { options.ElementAt(0) };
foreach (var item in voteCounter)
{
if (item.Value > votedValue)
{
votedValue = item.Value;
voted.Clear();
}
else
{
voted.Add(item.Key);
}
}
//Debug.Log("votedKey: " + votedKey);
var votedKey = voted.ElementAt(UnityEngine.Random.Range(0, voted.Count()));
return options.IndexOf(votedKey);
}
But this version seem a bit different, i don't know if it would work right away
When a vote is tied, the system picks the first vote which is a bit less fun. Although this won't usually happen with larger streamers, it happens often with smaller creators. My understanding is that the vote resolution happens in RoR2-VsTwitch/ItemRoller/VoteStrategy/MaxVoteStrategy.cs in this bit :
Instead of this a list should be created to store all the tied votes then a random element of this list picked. I found a solution to this for the previous version of this mod
But this version seem a bit different, i don't know if it would work right away