diff --git a/games.py b/games.py index be84067..a4f2a08 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 @@ -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", "Torrential Downpour"]: if self.teams["home"].score == 16: this_xvi_team = self.teams["home"] elif self.teams["away"].score == 16: diff --git a/gametext.py b/gametext.py index 593ec7e..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 @@ -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) @@ -285,15 +286,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 +303,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]] 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 b89d68b..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: @@ -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()) @@ -1623,7 +1626,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: @@ -2418,6 +2424,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())