Announcement

Collapse
No announcement yet.

!shufflevote

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • !shufflevote

    Problem: teams in pub get imbalanced and a shuffle is required. There is a shuffle system but it never seems to happen, I don't even know how to work it, it isn't discoverable.
    Rab> ?help how do u shuffle the teams
    Bosshawk> its !shufflevote right at the end of the round but its a small window to request it

    Solution: create a command !shufflevote (also create !voteshuffle for the same thing)

    put this command in !helpall

    what it does:

    - add 1 to shuffle counter
    Code:
    List<DateTime> shuffleVotes = new List<DateTime>();
    ...
    shuffleVotes.Items.Add(DateTime.UtcNow);
    - at end of round, if counter >= 3 then shuffle:
    Code:
    int shuffleVoteRequirement = 3;
    
    if (shuffleVotes.Items.Count >= shuffleVoteRequirement)
    {
        shuffle();
        shuffleVotes.Items.Clear();
    }
    - at end of round, expire shuffle votes older than 10 mins:
    Code:
    int shuffleVoteExpirationMinutes = 10;
    
    List<DateTime> votesToKeep = new List<DateTime>();
    
    foreach (DateTime vote in shuffleVotes)
    {
        if (vote > DateTime.UtcNow.AddMinutes(-1 * shuffleVoteExpirationMinutes) )
        {
            votesToKeep.Items.Add(vote);
        }
    }
    
    shuffleVotes.Items.Clear();
    
    foreach (DateTime vote in votesToKeep)
    {
        shuffleVotes.Items.Add(vote);
    }
    
    votesToKeep.Items.Clear();

  • #2
    i vote 2
    Leland

    Comment


    • #3
      Everyday I'm shuffling
      Trench Wars Player

      “To live is the rarest thing in the world. Most people exist, that is all.” ― Oscar Wilde

      Comment

      Working...
      X