Adding gauntlet 8

Season 9 updates
Uncapped runs scored bug fixed
This commit is contained in:
Cal Corum 2025-05-29 21:54:16 -05:00
parent 6a355def4b
commit e366564bef
3 changed files with 57 additions and 9 deletions

View File

@ -1897,10 +1897,22 @@ async def check_uncapped_advance(session: Session, interaction: discord.Interact
if this_play.on_second == lead_runner: if this_play.on_second == lead_runner:
logger.info(f'setting lead runner on_second_final') 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: elif this_play.on_first == lead_runner:
logger.info(f'setting lead runner on_first') 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: else:
log_exception(LineupsMissingException, f'Could not find lead runner to set final destination') log_exception(LineupsMissingException, f'Could not find lead runner to set final destination')

View File

@ -241,6 +241,32 @@ async def get_opponent(session: Session, this_team, this_event, this_run) -> Tea
t_id = 17 t_id = 17
else: else:
raise KeyError(f'Hmm...I do not know who you should be playing right now.') 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: else:
return None 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_title = f'{main_team.lname} - {this_event['name']} Draft'
embed_description = f'{this_event["name"]}' 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)] 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: else:
logger.error(f'run_draft - Event ID {this_event["id"]} not recognized') logger.error(f'run_draft - Event ID {this_event["id"]} not recognized')
raise KeyError(f'Draft data not found for Gauntlet {this_event["id"]}') 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]: if this_event['id'] in [1, 2]:
max_counts['MVP'] = 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( g_query = await db_get(
'games', 'games',
params=[('season', draft_team.season), ('team1_id', draft_team.id), ('gauntlet_id', this_event['id'])] 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 # Update roster embed
round_num += 1 round_num += 1
await last_message.edit(content=None, embeds=get_embeds(include_links=False)) 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() await draft_loop()
elif this_event['id'] == 7: elif this_event['id'] == 7:
round_num = 1 round_num = 1

View File

@ -23,8 +23,8 @@ from in_game.gameplay_models import Team
SBA_SEASON = 11 SBA_SEASON = 11
PD_SEASON = 9 PD_SEASON = 9
ranked_cardsets = [20, 21, 22, 17, 18, 19] ranked_cardsets = [20, 21, 22, 17, 18, 19]
LIVE_CARDSET_ID = 20 LIVE_CARDSET_ID = 24
LIVE_PROMO_CARDSET_ID = 21 LIVE_PROMO_CARDSET_ID = 25
MAX_CARDSET_ID = 30 MAX_CARDSET_ID = 30
CARDSETS = { CARDSETS = {
'Ranked': { 'Ranked': {
@ -301,7 +301,7 @@ SELECT_CARDSET_OPTIONS = [
discord.SelectOption(label='2013 Season', value='6'), discord.SelectOption(label='2013 Season', value='6'),
discord.SelectOption(label='2012 Season', value='7') 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'] DEFENSE_LITERAL = Literal['Pitcher', 'Catcher', 'First Base', 'Second Base', 'Third Base', 'Shortstop', 'Left Field', 'Center Field', 'Right Field']
COLORS = { COLORS = {
'sba': int('a6ce39', 16), 'sba': int('a6ce39', 16),
@ -2089,9 +2089,14 @@ async def embed_pagination(
await msg.edit(content=None, embed=all_embeds[page_num], view=view) 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 "<"}' \ 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 ">"}' f'{"" if allow_embed else ">"}'