diff --git a/secrethitler/Secret_Hitler_resources/01 - 02 - Yes - No - Back.png b/secrethitler/Secret_Hitler_resources/01 - 02 - Yes - No - Back.png new file mode 100644 index 0000000..f2d3584 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/01 - 02 - Yes - No - Back.png differ diff --git a/secrethitler/Secret_Hitler_resources/01 - Yes.png b/secrethitler/Secret_Hitler_resources/01 - Yes.png new file mode 100644 index 0000000..4b56a8a Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/01 - Yes.png differ diff --git a/secrethitler/Secret_Hitler_resources/02 - No.png b/secrethitler/Secret_Hitler_resources/02 - No.png new file mode 100644 index 0000000..1b61506 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/02 - No.png differ diff --git a/secrethitler/Secret_Hitler_resources/03 - Policy - Liberal.png b/secrethitler/Secret_Hitler_resources/03 - Policy - Liberal.png new file mode 100644 index 0000000..48044fd Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/03 - Policy - Liberal.png differ diff --git a/secrethitler/Secret_Hitler_resources/03-04 - Policy - Back.png b/secrethitler/Secret_Hitler_resources/03-04 - Policy - Back.png new file mode 100644 index 0000000..f5cf588 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/03-04 - Policy - Back.png differ diff --git a/secrethitler/Secret_Hitler_resources/04 - Policy - Fascist.png b/secrethitler/Secret_Hitler_resources/04 - Policy - Fascist.png new file mode 100644 index 0000000..790961f Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/04 - Policy - Fascist.png differ diff --git a/secrethitler/Secret_Hitler_resources/05 - Membership - Liberal.png b/secrethitler/Secret_Hitler_resources/05 - Membership - Liberal.png new file mode 100644 index 0000000..b3db807 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/05 - Membership - Liberal.png differ diff --git a/secrethitler/Secret_Hitler_resources/05-06 - Membership - Back.png b/secrethitler/Secret_Hitler_resources/05-06 - Membership - Back.png new file mode 100644 index 0000000..8aa45c5 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/05-06 - Membership - Back.png differ diff --git a/secrethitler/Secret_Hitler_resources/06 - Membership - Fascist.png b/secrethitler/Secret_Hitler_resources/06 - Membership - Fascist.png new file mode 100644 index 0000000..9023862 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/06 - Membership - Fascist.png differ diff --git a/secrethitler/Secret_Hitler_resources/07 - Board - Liberal.png b/secrethitler/Secret_Hitler_resources/07 - Board - Liberal.png new file mode 100644 index 0000000..074ffbf Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/07 - Board - Liberal.png differ diff --git a/secrethitler/Secret_Hitler_resources/08 - Board - Fascist - 5-6 Players.png b/secrethitler/Secret_Hitler_resources/08 - Board - Fascist - 5-6 Players.png new file mode 100644 index 0000000..c283996 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/08 - Board - Fascist - 5-6 Players.png differ diff --git a/secrethitler/Secret_Hitler_resources/09 - Board - Fascist - 7-8 Players.png b/secrethitler/Secret_Hitler_resources/09 - Board - Fascist - 7-8 Players.png new file mode 100644 index 0000000..0372260 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/09 - Board - Fascist - 7-8 Players.png differ diff --git a/secrethitler/Secret_Hitler_resources/10 - Board - Fascist - 9-10 Players.png b/secrethitler/Secret_Hitler_resources/10 - Board - Fascist - 9-10 Players.png new file mode 100644 index 0000000..a2bdd2a Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/10 - Board - Fascist - 9-10 Players.png differ diff --git a/secrethitler/Secret_Hitler_resources/11 - Role - Liberal 1.png b/secrethitler/Secret_Hitler_resources/11 - Role - Liberal 1.png new file mode 100644 index 0000000..4fb8613 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/11 - Role - Liberal 1.png differ diff --git a/secrethitler/Secret_Hitler_resources/11-18 - Roles - Back.png b/secrethitler/Secret_Hitler_resources/11-18 - Roles - Back.png new file mode 100644 index 0000000..fbe7000 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/11-18 - Roles - Back.png differ diff --git a/secrethitler/Secret_Hitler_resources/12 - Role - Liberal 2.png b/secrethitler/Secret_Hitler_resources/12 - Role - Liberal 2.png new file mode 100644 index 0000000..fa8269a Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/12 - Role - Liberal 2.png differ diff --git a/secrethitler/Secret_Hitler_resources/13 - Role - Liberal 3.png b/secrethitler/Secret_Hitler_resources/13 - Role - Liberal 3.png new file mode 100644 index 0000000..6934012 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/13 - Role - Liberal 3.png differ diff --git a/secrethitler/Secret_Hitler_resources/14 - Role - Liberal 4.png b/secrethitler/Secret_Hitler_resources/14 - Role - Liberal 4.png new file mode 100644 index 0000000..cf5dc1d Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/14 - Role - Liberal 4.png differ diff --git a/secrethitler/Secret_Hitler_resources/15 - Role - Liberal 5.png b/secrethitler/Secret_Hitler_resources/15 - Role - Liberal 5.png new file mode 100644 index 0000000..2640de2 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/15 - Role - Liberal 5.png differ diff --git a/secrethitler/Secret_Hitler_resources/16 - Role - Hitler.png b/secrethitler/Secret_Hitler_resources/16 - Role - Hitler.png new file mode 100644 index 0000000..7a1607a Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/16 - Role - Hitler.png differ diff --git a/secrethitler/Secret_Hitler_resources/17 - Role - Fascist 1.png b/secrethitler/Secret_Hitler_resources/17 - Role - Fascist 1.png new file mode 100644 index 0000000..c45c216 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/17 - Role - Fascist 1.png differ diff --git a/secrethitler/Secret_Hitler_resources/18 - Role - Fascist 2.png b/secrethitler/Secret_Hitler_resources/18 - Role - Fascist 2.png new file mode 100644 index 0000000..72b1d5c Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/18 - Role - Fascist 2.png differ diff --git a/secrethitler/Secret_Hitler_resources/19 - Government - President.png b/secrethitler/Secret_Hitler_resources/19 - Government - President.png new file mode 100644 index 0000000..9d77008 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/19 - Government - President.png differ diff --git a/secrethitler/Secret_Hitler_resources/19 - Government Aid - President.png b/secrethitler/Secret_Hitler_resources/19 - Government Aid - President.png new file mode 100644 index 0000000..9800287 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/19 - Government Aid - President.png differ diff --git a/secrethitler/Secret_Hitler_resources/20 - Government - Chancellor.png b/secrethitler/Secret_Hitler_resources/20 - Government - Chancellor.png new file mode 100644 index 0000000..931c1e2 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/20 - Government - Chancellor.png differ diff --git a/secrethitler/Secret_Hitler_resources/20 - Government Aid - Chancellor.png b/secrethitler/Secret_Hitler_resources/20 - Government Aid - Chancellor.png new file mode 100644 index 0000000..dceb925 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/20 - Government Aid - Chancellor.png differ diff --git a/secrethitler/Secret_Hitler_resources/21 - Government - Previous President.png b/secrethitler/Secret_Hitler_resources/21 - Government - Previous President.png new file mode 100644 index 0000000..528fa8f Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/21 - Government - Previous President.png differ diff --git a/secrethitler/Secret_Hitler_resources/21 - Previous President - Back.png b/secrethitler/Secret_Hitler_resources/21 - Previous President - Back.png new file mode 100644 index 0000000..b6f4e34 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/21 - Previous President - Back.png differ diff --git a/secrethitler/Secret_Hitler_resources/22 - Government - Previous Chancellor.png b/secrethitler/Secret_Hitler_resources/22 - Government - Previous Chancellor.png new file mode 100644 index 0000000..47f62a1 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/22 - Government - Previous Chancellor.png differ diff --git a/secrethitler/Secret_Hitler_resources/22 - Previous Chancellor Back.png b/secrethitler/Secret_Hitler_resources/22 - Previous Chancellor Back.png new file mode 100644 index 0000000..fca2b09 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/22 - Previous Chancellor Back.png differ diff --git a/secrethitler/Secret_Hitler_resources/23 - Discard Pile.png b/secrethitler/Secret_Hitler_resources/23 - Discard Pile.png new file mode 100644 index 0000000..a19ae08 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/23 - Discard Pile.png differ diff --git a/secrethitler/Secret_Hitler_resources/24 - Draw Pile.png b/secrethitler/Secret_Hitler_resources/24 - Draw Pile.png new file mode 100644 index 0000000..c725b80 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/24 - Draw Pile.png differ diff --git a/secrethitler/Secret_Hitler_resources/25 - Special rules 2.png b/secrethitler/Secret_Hitler_resources/25 - Special rules 2.png new file mode 100644 index 0000000..5be34a6 Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/25 - Special rules 2.png differ diff --git a/secrethitler/Secret_Hitler_resources/25 - Special rules.png b/secrethitler/Secret_Hitler_resources/25 - Special rules.png new file mode 100644 index 0000000..d2baeed Binary files /dev/null and b/secrethitler/Secret_Hitler_resources/25 - Special rules.png differ diff --git a/secrethitler/Secret_Hitler_resources/Secret Hitler - Information.txt b/secrethitler/Secret_Hitler_resources/Secret Hitler - Information.txt new file mode 100644 index 0000000..e533f36 --- /dev/null +++ b/secrethitler/Secret_Hitler_resources/Secret Hitler - Information.txt @@ -0,0 +1,42 @@ +The files included here include a "bleeding" area so that they can be printed and cut to a poker-sized deck. + +Type: Poker sized blank cards +Dimensions: 63mm x 88mm, 2.5" x 3.5" + +Number of cards to print: +Yes: 10 +No: 10 +Fascist policy: 11 +Liberal policy: 6 +Membership - Liberal: 6 +Membership - Fascist: 4 +Board liberal: 1 +Board fascist 5-6p: 1 +Board fascist 7-8p: 1 +Board fascist 9-10p: 1 +Role - Liberal 1: 2 +Role - Liberal 2: 1 +Role - Liberal 3: 1 +Role - Liberal 4: 1 +Role - Liberal 5: 1 +Role - Hitler: 1 +Role - Fascist 1: 2 +Role - Fascist 2: 1 +President: 1 +Chancellor: 1 +Previous president 1 +Previous chancellor 1 +Draw pile 1 +Discard pile 1 +Special rules 1 + +You can also make this game in a reduced 54 cards deck by removing the membership cards (and use the Yes-No cards instead) and combining some of the board aids and boards. + +Game is by Max Temkin +https://www.kickstarter.com/projects/maxtemkin/secret-hitler/ + + + + + + diff --git a/secrethitler/__init__.py b/secrethitler/__init__.py new file mode 100644 index 0000000..9430e4a --- /dev/null +++ b/secrethitler/__init__.py @@ -0,0 +1,5 @@ +from .werewolf import Werewolf + + +def setup(bot): + bot.add_cog(Werewolf(bot)) \ No newline at end of file diff --git a/secrethitler/secrethitler.py b/secrethitler/secrethitler.py new file mode 100644 index 0000000..9e98c09 --- /dev/null +++ b/secrethitler/secrethitler.py @@ -0,0 +1,114 @@ +import asyncio + +import discord +from discord.ext import commands + +from redbot.core import Config + +from datetime import datetime, timedelta + +from werewolf.game import Game + + +class Werewolf: + """ + Base to host werewolf on a guild + """ + + def __init__(self, bot): + self.bot = bot + self.config = Config.get_conf(self, identifier=87101114101119111108102, force_registration=True) + default_global = {} + default_guild = { + } + + self.config.register_global(**default_global) + self.config.register_guild(**default_guild) + + self.games = {} # Active games stored here, id is per guild + + @commands.group() + async def ww(self, ctx: commands.Context): + """ + Base command for this cog. Check help for the commands list. + """ + if ctx.invoked_subcommand is None: + await ctx.send_help() + + @ww.command() + async def new(self, ctx, game_code): + """ + Create and join a new game of Werewolf + """ + + game = self._get_game(ctx.guild, game_code) + + if not game: + await ctx.send("Failed to start a new game") + else: + await ctx.send("New game has started") + + + + @ww.command() + async def join(self, ctx): + """ + Joins a game of Werewolf + """ + + game = self._get_game(ctx.guild) + + if not game: + await ctx.send("No game to join!\nCreate a new one with `[p]ww new`") + return + + await game.join(ctx.author, ctx.channel) + + @ww.command() + async def quit(self, ctx): + """ + Quit a game of Werewolf + """ + + game = self._get_game(ctx.guild) + + await game.quit(ctx.author, ctx.channel) + + @ww.command() + async def start(self, ctx): + """ + Checks number of players and attempts to start the game + """ + game = self._get_game(ctx.guild) + if not game: + await ctx.send("No game running, cannot start") + + await game.setup(ctx) + + @ww.command() + async def vote(self, ctx, id): + """ + Vote for a player by ID + """ + game = self._get_game(ctx.guild) + if not game: + await ctx.send("No game running, cannot vote") + + # Game handles response now + channel = ctx.channel + if channel is game.village_channel: + await game.vote(ctx.author, id, channel) + + if channel in (c["channel"] for c in game.p_channels.values()): + await game.vote(ctx.author, id, channel) + + def _get_game(self, guild, game_code=None): + if guild.id not in self.games: + if not game_code: + return None + self.games[guild.id] = Game(guild, game_code) + + return self.games[guild.id] + + async def _game_start(self, game): + await game.start()