From a7cf96824e73d71fbc3922ca05fb9ba4bf9df090 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 16:19:40 -0400 Subject: [PATCH 1/8] fixed #249 --- the_prestige.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/the_prestige.py b/the_prestige.py index b89d68b..bd5dd16 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -2418,6 +2418,9 @@ async def league_day_watcher(channel, league, games_list, filter_url, last = Fal next_start = (now + delta).replace(second=0, microsecond=0) wait_seconds = (next_start - now).seconds + + if wait_seconds > 3601: #there's never a situation to wait longer than an hour so hoo ray bugfixes the easy way + wait_seconds = 60 leagues.save_league(league) active_standings[league] = await channel.send(embed=league.standings_embed()) From af27e1a2536fae8d608236bcb931823ff416c725 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 16:22:03 -0400 Subject: [PATCH 2/8] fixes #248 --- the_prestige.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/the_prestige.py b/the_prestige.py index bd5dd16..01c41df 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -1623,7 +1623,10 @@ async def on_message(msg): flags.append((flag.split(" ")[0][0].lower(), flag.split(" ",1)[1].strip())) except IndexError: flags.append((flag.split(" ")[0][0].lower(), None)) - await comm.execute(msg, send_text, flags) + + if comm.isauthorized(msg.author): #only execute command if authorized + await comm.execute(msg, send_text, flags) + except StopIteration: await msg.channel.send("Can't find that command, boss; try checking the list with `m;help`.") except CommandError as ce: From 2415f1fdb38dc5251b6a762825218c6672bcbcae Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 16:28:11 -0400 Subject: [PATCH 3/8] fixes #247 --- gametext.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gametext.py b/gametext.py index 593ec7e..17940c3 100644 --- a/gametext.py +++ b/gametext.py @@ -285,15 +285,15 @@ class TheNewGuy(game_strings_base): "whacks the ball onto the ground reeeally far away. {} gets to it eventually, but not in time to stop ANYONE from making it home!!", "hits a quadruple home run!"] - steal_success = ["runs to the next base too early!! You can do that??", - "is cheating!! They just ran to the next base and nobody even hit the ball!", - "gets bored of waiting and takes off, narrowly making it to the next base!"] + steal_success = ["{} runs to the next base too early!! You can do that??", + "{} is cheating!! They just ran to the next base and nobody even hit the ball!", + "{} gets bored of waiting and takes off, narrowly making it to the next base!"] - steal_caught = ["tries to run to the next base too early, and gets caught cheating!", - "sees if they can get away with dashing over to the next base. They can’t, turns out.", - "tries running to the next base, but {}’s ready for them. Out!"] + steal_caught = ["{} tries to run to the next base too early, and gets caught cheating!", + "{} sees if they can get away with dashing over to the next base. They can’t, turns out.", + "{} tries running to the next base, but {}’s ready for them. Out!"] - no_formats = strikeoutlooking + strikeoutswinging + walk + double + triple + steal_success + steal_caught[:2] + [flyout[2][0], flyout[4][0], fielderschoice[1][0], single[0][1], single[1], walk[1][0], walk[1][1], + no_formats = strikeoutlooking + strikeoutswinging + walk + double + triple + [flyout[2][0], flyout[4][0], fielderschoice[1][0], single[0][1], single[1], walk[1][0], walk[1][1], homerun[0], homerun[1][0], homerun[1][1], homerun[2], grandslam[0], grandslam[2]] diff_formats = {groundout[2]: ("defender", "batter"), groundout[3]: ("defender", "batter"), @@ -302,7 +302,8 @@ class TheNewGuy(game_strings_base): doubleplay[0][1]: ("batter",), sacrifice[0][1]: ("runner",), sacrifice[1]: ("defender", "runner"), single[2]: ("batter",), - steal_caught[2]: ("defender",)} + steal_success[0]: ("runner",), steal_success[1]: ("runner",), steal_success[2]: ("runner",), + steal_caught[0]: ("runner",), steal_caught[1]: ("runner",), steal_caught[2]: ("runner", "defender")} twoparts = [flyout[0], flyout[2], flyout[4], doubleplay[0], sacrifice[0], walk[1], single[0], homerun[1]] From 5e7ec9c2f5a81b43a917c14969b1d47fc4bd85a3 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 16:31:26 -0400 Subject: [PATCH 4/8] fixes #245 --- games.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games.py b/games.py index be84067..73fb8dd 100644 --- a/games.py +++ b/games.py @@ -690,7 +690,7 @@ class game(object): self.inning += 1 if self.inning > self.max_innings and self.teams["home"].score != self.teams["away"].score: #game over self.over = True - if self.max_innings >= 9: + if self.max_innings >= 9 or self.weather.name in ["Leaf Eddies"]: if self.teams["home"].score == 16: this_xvi_team = self.teams["home"] elif self.teams["away"].score == 16: From cd4127cba8d4557f2445ba40d57aedf003c74948 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 16:34:44 -0400 Subject: [PATCH 5/8] fixes #244 --- the_prestige.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/the_prestige.py b/the_prestige.py index 01c41df..3381fdc 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -545,6 +545,8 @@ class StartTournamentCommand(Command): rand_seed = True pre_seeded = False + list_of_team_names = command.split("\n")[2:] + if config()["game_freeze"]: raise CommandError("Patch incoming. We're not allowing new games right now.") @@ -565,6 +567,8 @@ class StartTournamentCommand(Command): raise CommandError("Series length has to be an odd positive integer.") if msg.author.id not in config()["owners"] and series_length > 21: raise CommandError("That's too long, boss. We have to run patches *some* time.") + if len(list_of_team_names) == 2: + raise CommandError("--bestof is only for non-finals matches! You probably want --finalsbestof, boss. -f works too, if you want to pay respects.") elif flag[0] == "f": #pay respects (finalsbestof) try: finals_series_length = int(flag[1]) @@ -588,7 +592,6 @@ class StartTournamentCommand(Command): raise CommandError("One or more of those flags wasn't right. Try and fix that for us and we'll see about sorting you out.") tourney_name = command.split("\n")[1] - list_of_team_names = command.split("\n")[2:] team_dic = {} for name in list_of_team_names: team = get_team_fuzzy_search(name.strip()) From a136a940bd7184701073a191e55d61625ac403c3 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 16:55:24 -0400 Subject: [PATCH 6/8] probable fix for #240 and #241 --- games.py | 2 +- gametext.py | 1 + main_controller.py | 2 +- the_prestige.py | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/games.py b/games.py index 73fb8dd..76f303d 100644 --- a/games.py +++ b/games.py @@ -550,7 +550,7 @@ class game(object): else: result = {} - self.voice.activate(self.last_update[0], result, self) + result = self.voice.activate(self.last_update[0], result, self) if "twopart" not in result: self.weather.activate(self, result) # possibly modify result in-place diff --git a/gametext.py b/gametext.py index 17940c3..45f6595 100644 --- a/gametext.py +++ b/gametext.py @@ -66,6 +66,7 @@ class game_strings_base(object): }) else: currentupdate["displaytext"] = f"{currentupdate['batter']} {self.format_gamestring(getattr(self, currentupdate['outcome'].name)[currentupdate['voiceindex']], currentupdate)}" + return currentupdate except: game_strings_base().activate(lastupdate, currentupdate, game) diff --git a/main_controller.py b/main_controller.py index 6b92b5c..95d4f82 100644 --- a/main_controller.py +++ b/main_controller.py @@ -256,4 +256,4 @@ def update_loop(): socket_thread = threading.Thread(target=socketio.emit, args=("states_update", game_states)) socket_thread.start() #socketio.emit("states_update", game_states) - time.sleep(3) \ No newline at end of file + time.sleep(8) \ No newline at end of file diff --git a/the_prestige.py b/the_prestige.py index 3381fdc..9728df8 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -147,7 +147,7 @@ class StartGameCommand(Command): weather_name = flag[1] if weather_name not in weather.all_weathers(): raise CommandError("We can't find that weather, chief. Try again.") - elif flag[0] == "v": + elif flag[0] == "v" or flag[0] == "a": if flag[1] in gametext.all_voices(): voice = gametext.all_voices()[flag[1]] else: From ace64febdca2e92653ceeed48fa1916e04bff017 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 17:07:53 -0400 Subject: [PATCH 7/8] fixes #260 --- gametext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gametext.py b/gametext.py index 45f6595..7e8146a 100644 --- a/gametext.py +++ b/gametext.py @@ -45,7 +45,7 @@ class game_strings_base(object): twoparts = [] - diff_formats = {fielderschoice[0]: ("defender", "base_string"), + diff_formats = {fielderschoice[0]: ("batter", "base_string"), steal_success[0]: ("runner", "base_string"), steal_caught[0]: ("runner", "base_string", "defender")} no_formats = strikeoutlooking + strikeoutswinging + doubleplay + walk + single + double + triple + homerun + grandslam From 2ab02ae495286db02a165c827908240d54b3ab07 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 27 Jun 2021 17:09:41 -0400 Subject: [PATCH 8/8] fixes #257 --- games.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/games.py b/games.py index 76f303d..a4f2a08 100644 --- a/games.py +++ b/games.py @@ -690,7 +690,7 @@ class game(object): self.inning += 1 if self.inning > self.max_innings and self.teams["home"].score != self.teams["away"].score: #game over self.over = True - if self.max_innings >= 9 or self.weather.name in ["Leaf Eddies"]: + if self.max_innings >= 9 or self.weather.name in ["Leaf Eddies", "Torrential Downpour"]: if self.teams["home"].score == 16: this_xvi_team = self.teams["home"] elif self.teams["away"].score == 16: