From e366564bef9a8782280c1dfc30a7e11d5be292ca Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Thu, 29 May 2025 21:54:16 -0500 Subject: [PATCH] Adding gauntlet 8 Season 9 updates Uncapped runs scored bug fixed --- command_logic/logic_gameplay.py | 16 +++++++++++++-- gauntlets.py | 35 +++++++++++++++++++++++++++++++-- helpers.py | 15 +++++++++----- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/command_logic/logic_gameplay.py b/command_logic/logic_gameplay.py index d035e85..fd15825 100644 --- a/command_logic/logic_gameplay.py +++ b/command_logic/logic_gameplay.py @@ -1897,10 +1897,22 @@ async def check_uncapped_advance(session: Session, interaction: discord.Interact if this_play.on_second == lead_runner: logger.info(f'setting lead runner on_second_final') - this_play.on_second_final = None if runner_thrown_out else lead_base + if runner_thrown_out: + this_play.on_second_final = None + else: + this_play.on_second_final = lead_base + if lead_base == 4: + log_run_scored(session, this_play.on_second, this_play) + elif this_play.on_first == lead_runner: logger.info(f'setting lead runner on_first') - this_play.on_first_final = None if runner_thrown_out else lead_base + + if runner_thrown_out: + this_play.on_first_final = None + else: + this_play.on_first_final = lead_base + if lead_base == 4: + log_run_scored(session, this_play.on_second, this_play) else: log_exception(LineupsMissingException, f'Could not find lead runner to set final destination') diff --git a/gauntlets.py b/gauntlets.py index e7ee6ac..674d64d 100644 --- a/gauntlets.py +++ b/gauntlets.py @@ -241,6 +241,32 @@ async def get_opponent(session: Session, this_team, this_event, this_run) -> Tea t_id = 17 else: raise KeyError(f'Hmm...I do not know who you should be playing right now.') + elif this_event['id'] == 8: + if gp == 0: + teams = [6, 13] + elif gp == 1: + teams = [11, 12, 22, 28] + elif gp == 2: + teams = [12, 27, 29] + elif gp == 3: + teams = [16, 18, 25] + elif gp == 4: + teams = [10, 18, 26] + elif gp == 5: + teams = [8, 24] + elif gp == 6: + teams = [1, 3, 8] + elif gp == 7: + teams = [4, 10, 21, 23, 30] + elif gp == 8: + teams = [4, 10, 21, 23, 30] + elif gp == 9: + teams = [2, 20] + elif gp == 10: + teams = [13, 14] + else: + teams = [19, 5] + t_id = teams[random.randint(0, len(teams)-1)] else: return None @@ -315,6 +341,11 @@ async def run_draft(interaction: discord.Interaction, main_team: Team, this_even embed_title = f'{main_team.lname} - {this_event['name']} Draft' embed_description = f'{this_event["name"]}' base_params = [('cardset_id', 5), ('cardset_id', 1), ('cardset_id', 3), ('cardset_id', 4), ('cardset_id', 23), ('cardset_id', 22), ('limit', 4)] + elif this_event['id'] == 8: + embed_title = f'{main_team.lname} - {this_event['name']} Draft' + embed_description = f'{this_event["name"]}' + base_params = [('cardset_id', 24), ('cardset_id', 25), ('cardset_id', 22), ('cardset_id', 23), + ('limit', 8)] else: logger.error(f'run_draft - Event ID {this_event["id"]} not recognized') raise KeyError(f'Draft data not found for Gauntlet {this_event["id"]}') @@ -369,7 +400,7 @@ async def run_draft(interaction: discord.Interaction, main_team: Team, this_even } if this_event['id'] in [1, 2]: max_counts['MVP'] = 2 - elif this_event['id'] in [5, 6]: + elif this_event['id'] in [5, 6, 8]: g_query = await db_get( 'games', params=[('season', draft_team.season), ('team1_id', draft_team.id), ('gauntlet_id', this_event['id'])] @@ -1499,7 +1530,7 @@ async def run_draft(interaction: discord.Interaction, main_team: Team, this_even # Update roster embed round_num += 1 await last_message.edit(content=None, embeds=get_embeds(include_links=False)) - elif this_event['id'] in [5, 6]: + elif this_event['id'] in [5, 6, 8]: await draft_loop() elif this_event['id'] == 7: round_num = 1 diff --git a/helpers.py b/helpers.py index 1540f2e..325c451 100644 --- a/helpers.py +++ b/helpers.py @@ -23,8 +23,8 @@ from in_game.gameplay_models import Team SBA_SEASON = 11 PD_SEASON = 9 ranked_cardsets = [20, 21, 22, 17, 18, 19] -LIVE_CARDSET_ID = 20 -LIVE_PROMO_CARDSET_ID = 21 +LIVE_CARDSET_ID = 24 +LIVE_PROMO_CARDSET_ID = 25 MAX_CARDSET_ID = 30 CARDSETS = { 'Ranked': { @@ -301,7 +301,7 @@ SELECT_CARDSET_OPTIONS = [ discord.SelectOption(label='2013 Season', value='6'), discord.SelectOption(label='2012 Season', value='7') ] -ACTIVE_EVENT_LITERAL = Literal['1998 Season', 'Brilliant Stars'] +ACTIVE_EVENT_LITERAL = Literal['2025 Season'] DEFENSE_LITERAL = Literal['Pitcher', 'Catcher', 'First Base', 'Second Base', 'Third Base', 'Shortstop', 'Left Field', 'Center Field', 'Right Field'] COLORS = { 'sba': int('a6ce39', 16), @@ -2089,9 +2089,14 @@ async def embed_pagination( await msg.edit(content=None, embed=all_embeds[page_num], view=view) -def get_roster_sheet(team, allow_embed: bool = False): +def get_roster_sheet(team: Team, allow_embed: bool = False): + try: + sheet_url = team.gsheet + except AttributeError: + sheet_url = team['gsheet'] + return f'{"" if allow_embed else "<"}' \ - f'https://docs.google.com/spreadsheets/d/{team["gsheet"]}/edit' \ + f'https://docs.google.com/spreadsheets/d/{sheet_url}/edit' \ f'{"" if allow_embed else ">"}'