From b9be2a481f0fb3558063da8e1ea1fee13d3a8146 Mon Sep 17 00:00:00 2001 From: Sakimori Date: Sun, 7 Mar 2021 18:39:20 -0500 Subject: [PATCH] hooked weather forecast into league games --- leagues.py | 3 +++ the_prestige.py | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/leagues.py b/leagues.py index 0cfc04c..828aea5 100644 --- a/leagues.py +++ b/leagues.py @@ -465,6 +465,9 @@ class league_structure(object): this_embed.add_field(name=player_name, value=content_string, inline=False) return this_embed + def get_weather_now(self, team_name): + return all_weathers()[self.weather_forecast[team_name][self.day - 1]] + class tournament(object): def __init__(self, name, team_dic, series_length = 5, finals_series_length = 7, max_innings = 9, id = None, secs_between_games = 300, secs_between_rounds = 600): diff --git a/the_prestige.py b/the_prestige.py index 6ed8399..836a39f 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -2154,6 +2154,7 @@ async def start_league_day(channel, league, partial = False): home.set_pitcher(rotation_slot=league.day) this_game = games.game(away.finalize(), home.finalize(), length = game_length) + this_game.weather = league.get_weather_now(home.name)(this_game) this_game, state_init = prepare_game(this_game) state_init["is_league"] = True @@ -2356,6 +2357,7 @@ async def continue_league_series(league, queue, games_list, series_results, miss home_team = games.get_team(oldgame.teams["home"].name) home_team.set_pitcher(rotation_slot=league.day) this_game = games.game(away_team.finalize(), home_team.finalize(), length = league.game_length) + this_game.weather = league.get_weather_now(home_team.name)(this_game) this_game, state_init = prepare_game(this_game) state_init["is_league"] = True @@ -2449,6 +2451,4 @@ async def league_postseason(channel, league): season_save(league) league.season_reset() - -weather.WeatherChains.debug_weathers() client.run(config()["token"]) \ No newline at end of file