hooked weather forecast into league games

This commit is contained in:
Sakimori 2021-03-07 18:39:20 -05:00
parent 16fffb4401
commit b9be2a481f
2 changed files with 5 additions and 2 deletions

View file

@ -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):

View file

@ -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"])