Skip to content

Feat: Votemap rework, multiple votes per player, player can add map to selection#1064

Open
Dorfieeee wants to merge 28 commits intomasterfrom
feat/votemap_v2
Open

Feat: Votemap rework, multiple votes per player, player can add map to selection#1064
Dorfieeee wants to merge 28 commits intomasterfrom
feat/votemap_v2

Conversation

@Dorfieeee
Copy link
Copy Markdown
Collaborator

@Dorfieeee Dorfieeee commented Jul 18, 2025

UI Changes

  • After successful vote, player can now see map's pretty name
  • Show selection !vm|!votemap displays only list of maps and which map the player voted
  • Map reminder contains the same as "show selection" and additional instruction text as of now
  • Map selection index starts from 1. 0 is reserved for the new feature.

TODO

  • - API permission migration

New features

  • - Send reminder to vote manually
  • - User can choose whether to send the reminder on match start, end or both
  • - Add new map to selection
  • - Remove map from selection
  • - Guarantee the next map and thus pausing the voting for that round
  • - Allow voting for VIP players only
  • - Allow voting based on white-list or ban-list flags
  • - Add vote - this feature is mainly meant for 3rd party apps - the vote can count as given vote_count or based on flags or vip if valid player_id and the player is in the database
  • - Players can add one more map to the selection. This map will be on the top of the list at index 0 and it will say "<player>'s pick: <map_name>". Only players with a specified flag will be able to use this feature. If no flags are set, all players can use this command. Once a player picked a map, it cannot be picked again until votemap restart. If there is any reward system ever introduced, the players might be able to rewrite the pick for reward points doubling with each change.
    • New command !vm add help
    • New command !vm add <map_tag> [game_mode] [attackers | only if game_mode=offensive] [environment] where game_mode, environment and attackers respectively default to warfare, day and allies
  • - Player's vote can have different vote count based on his flags. The flag with the lowest count will be used. Defaults to 1 count as of now. What does that mean? Players with flags and their respective vote counts:
    • set to 0 will practically disable player's ability to vote and the player will be informed in such a case with message "Player banned from voting"
    • set to 2+ will give players more decisions power
    • set to max value 100 may be given to admin users to outvote others.
image

API Changes

  • GET get_votemap_status returns the following object and is in the same order as when seen in the game message.
{
  enabled: bool
  paused: bool
  winning_map: str
  last_reminder: datetime
  results: { 
    map: MapLayer,
    votes_count: int,
    voters: { 
      player_name: str,
      player_id: str,
      vote_count: int 
    }[]
  }[]
}
  • GET get_votemap_config and set_votemap_config contains new field
vote_flags = {
  flag: string
  vote_count: int
}[]
  • GET get_votemap_results returns up to 100 historical votemap results
result = {
  ts: int
  map: MapLayer
  results: {
    map: MapLayer,
    votes_count: int
  }
}[]
  • POST add_map_to_votemap, remove_map_from_votemap and set_votemap_winner
payload = {
  map_name: string
}
  • POST add_votemap_vote
payload = {
  map_name: string
  player_id: string
  player_name: string
  vote_count: int | null
}
  • POST send_votemap_reminder forces reminder to vote that is displayed to all players except the ones who have voted and/or have reminders disabled

Internal changes

  • - Write new tests
  • unified all redis keys names used by votemap as votemap:<key>
  • VoteMap's state and command handling moved to separate classes
  • New getters and setters for others to easily implement some custom features on their forks

@Dorfieeee Dorfieeee marked this pull request as ready for review July 25, 2025 13:46
@Dorfieeee Dorfieeee changed the title Votemap rework Feat: Votemap rework, multiple votes per player, player can add map to selection Jul 26, 2025
Copy link
Copy Markdown
Collaborator

@timraay timraay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For native Python types (list, dict, ...) you do not have to use their typing equivalent anymore for type annotations. foo: typing.List[str] therefore becomes foo: list[str].

Comment thread rcon/api_commands.py Outdated
Comment thread rcon/user_config/vote_map.py
Comment thread rcon/utils.py
Comment thread rcon/vote_map.py Outdated
Comment thread rcon/vote_map.py
Comment thread rcon/vote_map.py Outdated
Comment thread rcon/vote_map.py Outdated
Comment thread rcon/vote_map.py
Comment thread rcon/vote_map.py
Comment thread rcon/vote_map.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants