diff --git a/league_storage.py b/league_storage.py index ff1375f..b3edb4c 100644 --- a/league_storage.py +++ b/league_storage.py @@ -87,6 +87,7 @@ def save_league(league): "series_length" : league.series_length, "games_per_hour" : league.games_per_hour, "owner" : league.owner, + "champions" : league.champions, "historic" : league.historic } with open(os.path.join(data_dir, league_dir, league.name, f"{league.name}.state"), "w") as state_file: diff --git a/leagues.py b/leagues.py index 298b8ab..9a6d268 100644 --- a/leagues.py +++ b/leagues.py @@ -14,6 +14,7 @@ class league_structure(object): self.owner = None self.season = 1 self.autoplay = -1 + self.champions = {} def setup(self, league_dic, division_games = 1, inter_division_games = 1, inter_league_games = 1, games_per_hour = 2): self.league = league_dic # { subleague name : { division name : [team object] } } @@ -460,4 +461,8 @@ def load_league_file(league_name): this_league.games_per_hour = state_dic["games_per_hour"] this_league.historic = state_dic["historic"] this_league.season = state_dic["season"] + try: + this_league.champions = state_dic["champions"] + except: + this_league.champions = {} return this_league \ No newline at end of file diff --git a/the_prestige.py b/the_prestige.py index 10a3b67..54286c2 100644 --- a/the_prestige.py +++ b/the_prestige.py @@ -1914,6 +1914,7 @@ async def league_postseason(channel, league): await channel.send(f"The {league.name} Championship Series is starting in {math.ceil(wait_seconds/60)} minutes!") await asyncio.sleep(wait_seconds) await start_tournament_round(channel, world_series) + league.champions[str(league.season)] = world_series.winner.name