From 5f5ee9e1f075df1e3a54c3f0be6f4b026f70f729 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Mon, 4 Jan 2021 15:24:19 -0500 Subject: [PATCH 1/6] fixed bug in game_watcher, added game_freeze check to tournament and randomgame --- the_prestige.py | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 07c2e14..b322a2a 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -184,6 +184,10 @@ class StartRandomGameCommand(Command): description = "Starts a 9-inning game between 2 entirely random teams. Embrace chaos." async def execute(self, msg, command): + if config()["game_freeze"]: + await msg.channel.send("Patch incoming. We're not allowing new games right now.") + return + channel = msg.channel await msg.delete() await channel.send("Rolling the bones...") @@ -485,6 +489,10 @@ class StartTournamentCommand(Command): description = "Starts a tournament with the teams given. Byes will be given to teams to allow for numbers other than powers of two. The current tournament format is:\nBest of 5 until the finals, which are Best of 7" async def execute(self, msg, command): + if config()["game_freeze"]: + await msg.channel.send("Patch incoming. We're not allowing new games right now.") + return + to_parse = command.split("\n")[0] if "--rounddelay " in to_parse: try: @@ -1104,7 +1112,9 @@ async def game_watcher(): game, channel, user, key = this_array[i] if game.over and main_controller.master_games_dic[key][1]["end_delay"] <= 9: final_embed = game_over_embed(game) - if user is not None: + if user is isinstance(user, str): + await channel.send(f"A game started by {user} just ended.") + elif user is not None: await channel.send(f"{user.mention}'s game just ended.") else: await channel.send("A game started from this channel just ended.") @@ -1143,24 +1153,5 @@ def get_team_fuzzy_search(team_name): if len(teams) == 1: team = teams[0] return team - - -#test_bracket = { -# "Milwaukee Lockpicks" : {"wins": 4, "rd": 0}, -# "Madagascar Penguins" : {"wins": 2, "rd": 0}, -# "Twin Cities Evening" : {"wins": 1, "rd": 0}, -# "Washington State Houses" : {"wins": 9, "rd": 0}, -# "Appalachian Underground" : {"wins": 8, "rd": 0}, -# "Pacific2 Rams" : {"wins": 3, "rd": 0}, -# "New Jersey Radio" : {"wins": 11, "rd": 0}, -# "Moline Jolenes" : {"wins": 6, "rd": 0}, -# "California Commissioners" : {"wins": 10, "rd": 0}, -# "Pigeon’s Reckoning" : {"wins": 7, "rd": 0}, -# "Kernow Technologists" : {"wins": 5, "rd": 0} -# } -#tourney = leagues.tournament("Test Tourney", test_bracket, max_innings=3) -#tourney.build_bracket(by_wins=True) -#tourney.bracket.set_winners_dive(['Twin Cities Evening','Madagascar Penguins', 'Pacific2 Rams']) -#print(tourney.bracket.this_bracket) client.run(config()["token"]) \ No newline at end of file From b4202a1a460e68353adfa6c148cf2bcb12a829e6 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Mon, 4 Jan 2021 15:37:53 -0500 Subject: [PATCH 2/6] fixes bug #118 --- games.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games.py b/games.py index f990724..8724f01 100644 --- a/games.py +++ b/games.py @@ -139,7 +139,7 @@ class team(object): def slide_player(self, name, new_spot): this_player, index, roster = self.find_player(name) - if this_player is not None and new_spot < len(roster): + if this_player is not None and new_spot <= len(roster): roster.pop(index) roster.insert(new_spot-1, this_player) return True From 32136b51dceb7418572bd02dbcfaf2aedb94c8ad Mon Sep 17 00:00:00 2001 From: Sakimori Date: Mon, 4 Jan 2021 15:45:30 -0500 Subject: [PATCH 3/6] added error message to addplayer if pitcher/batter is not specified --- the_prestige.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index 2199bad..94b48bc 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -386,14 +386,17 @@ class AddPlayerCommand(Command): new_player = games.player(ono.get_stats(player_name)) - if "batter" in command.split("\n")[0]: + if "batter" in command.split("\n")[0].lower(): if not team.add_lineup(new_player)[0]: await msg.channel.send("Too many batters 🎶") return - elif "pitcher" in command.split("\n")[0]: + elif "pitcher" in command.split("\n")[0].lower(): if not team.add_pitcher(new_player): await msg.channel.send("8 pitchers is quite enough, we think.") return + else: + await msg.channel.send("You have to tell us if you want a pitcher or a batter, boss. Just say so in the first line, with the command.") + return await msg.channel.send(embed=build_team_embed(team)) games.update_team(team) From 772aa2f7709520581f1cfc3b0033862fce5fbef4 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Mon, 4 Jan 2021 16:17:55 -0500 Subject: [PATCH 4/6] deletes tournament setup message, ensures more than 1 team in a tournament --- the_prestige.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/the_prestige.py b/the_prestige.py index 94b48bc..f40eaaa 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -518,12 +518,20 @@ class StartTournamentCommand(Command): return team_dic[team] = {"wins": 0} + channel = msg.channel + await msg.delete() + + if len(team_dic) < 2: + await msg.channel.send("One team does not a tournament make.") + return + id = random.randint(1111,9999) tourney = leagues.tournament(tourney_name, team_dic, id=id, secs_between_rounds = round_delay * 60) tourney.build_bracket(random_sort = True) - await start_tournament_round(msg.channel, tourney) + + await start_tournament_round(channel, tourney) commands = [ From 808712a7c7431907b1eff7c6935a4f34f8f4dadc Mon Sep 17 00:00:00 2001 From: Elijah Steres Date: Mon, 4 Jan 2021 17:57:13 -0500 Subject: [PATCH 5/6] fix safari display, maybe --- static/css/game.css | 26 +++++++------------------- static/css/games_page.css | 15 ++------------- 2 files changed, 9 insertions(+), 32 deletions(-) diff --git a/static/css/game.css b/static/css/game.css index 01624c2..2b0aa55 100644 --- a/static/css/game.css +++ b/static/css/game.css @@ -19,7 +19,7 @@ border-top: none; border-right: none; border-bottom: none; - height: max-content; + height: min-content; } .header { @@ -41,7 +41,7 @@ grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: "teams teams info" "players players info" "update update update"; - grid-template-rows: 5.5rem auto auto; + grid-template-rows: minmax(5.75rem, min-content) minmax(4rem, min-content) minmax(4rem, min-content); grid-row-gap: 0.5rem; grid-column-gap: 0.75rem; } @@ -196,33 +196,21 @@ } @media only screen and (max-device-width: 800px) { - .batting { + .game { font-size: 15pt; - text-align: left; - height: max-content; - padding: 5px; } - .leagueoruser { - font-size: 15pt; - text-align: right; - height: max-content; - padding: 5px; + .batting, .leagueoruser { + font-size: 14pt; + padding: 3px; } .team_name, .score { - font-size: 23px + font-size: 25px } .players { font-size: 20px; - grid-area: players; - display: flex; - flex-direction: column; - justify-content: space-around; - align-items: center; - height: 100%; - padding-right: 50px; } .update_emoji, .update_text { diff --git a/static/css/games_page.css b/static/css/games_page.css index f95f077..213fde7 100644 --- a/static/css/games_page.css +++ b/static/css/games_page.css @@ -7,7 +7,7 @@ grid-auto-flow: row; } -.container > div { +.emptyslot, .game { min-height: 298px; } @@ -68,12 +68,6 @@ .container { display: grid; grid-template-columns: repeat(1, minmax(700px, 90%)); - grid-template-rows: 400px; - grid-gap: 50px 30px; /*space between rows, then columns*/ - align-items: center; - justify-items: center; - grid-auto-rows: 400px; - grid-auto-flow: row; position: absolute; left: 50%; transform: translate(-50%, 0); @@ -81,11 +75,6 @@ .emptyslot { border: none; - border-radius: 15px; - align-self: stretch; - justify-self: stretch; - text-align: center; - color: white; - flex: 1; + min-height: 0px; } } \ No newline at end of file From 5cb23c87dfbf81de233920975eca0a7032e92d22 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Mon, 4 Jan 2021 19:42:42 -0500 Subject: [PATCH 6/6] games will stay on "play blall" for a shorter time --- the_prestige.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/the_prestige.py b/the_prestige.py index f40eaaa..b32c25d 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -803,8 +803,8 @@ def prepare_game(newgame, league = None, weather_name = None): "victory_lap" : False, "weather_emoji" : newgame.weather.emoji, "weather_text" : newgame.weather.name, - "start_delay" : 5, - "end_delay" : 10 + "start_delay" : 3, + "end_delay" : 9 } if league is None: