Update new-game flow
This commit is contained in:
parent
db52625899
commit
d5f2978b01
@ -380,16 +380,41 @@ class Gameplay(commands.Cog):
|
||||
|
||||
logger.info(f'Pulling and caching full {human_team.abbrev} roster')
|
||||
done = await get_full_roster_from_sheets(session, interaction, self.sheets, this_game, human_team, int(roster.value))
|
||||
if done:
|
||||
sp_view = starting_pitcher_dropdown_view(session, this_game, human_team, this_game.league_name, [interaction.user])
|
||||
await interaction.channel.send(content=f'### {human_team.lname} Starting Pitcher', view=sp_view)
|
||||
|
||||
await final_message.edit(
|
||||
content=f'{away_role.mention} @ {home_role.mention} is set!\n\n'
|
||||
f'Go ahead and set your lineup with the `/set lineup` command!',
|
||||
embed=embed
|
||||
roster_choice = await ask_with_buttons(
|
||||
interaction,
|
||||
['vs Left', 'vs Right'],
|
||||
'Which lineup will you be using?',
|
||||
delete_question=False,
|
||||
confirmation_message='Got it!'
|
||||
)
|
||||
|
||||
sp_view = starting_pitcher_dropdown_view(session, this_game, human_team, this_game.league_name, [interaction.user])
|
||||
await interaction.channel.send(content=f'### {human_team.lname} Starting Pitcher', view=sp_view)
|
||||
|
||||
try:
|
||||
await asyncio.sleep(5)
|
||||
this_play = await read_lineup(
|
||||
session,
|
||||
interaction,
|
||||
this_game=this_game,
|
||||
lineup_team=human_team,
|
||||
sheets_auth=self.sheets,
|
||||
lineup_num=1 if roster_choice == 'vs Right' else 2,
|
||||
league_name=this_game.game_type
|
||||
)
|
||||
except LineupsMissingException as e:
|
||||
logger.error(f'Attempting to start game, pausing for 5 seconds: {e}')
|
||||
await asyncio.sleep(5)
|
||||
|
||||
try:
|
||||
this_play = this_game.current_play_or_none(session)
|
||||
await self.post_play(session, interaction, this_play, buffer_message='Game on!')
|
||||
except LineupsMissingException as e:
|
||||
await interaction.channel.send(
|
||||
content=f'Run `/gamestate` once you have selected a Starting Pitcher to get going!'
|
||||
)
|
||||
|
||||
@group_new_game.command(name='gauntlet', description='Start a new Gauntlet game against an AI')
|
||||
@app_commands.choices(
|
||||
roster=[
|
||||
@ -569,15 +594,49 @@ class Gameplay(commands.Cog):
|
||||
|
||||
# Get pitchers from rosterlinks
|
||||
done = await get_full_roster_from_sheets(session, interaction, self.sheets, this_game, human_team, 1)
|
||||
if done:
|
||||
sp_view = starting_pitcher_dropdown_view(session, this_game, human_team, game_type=this_game.league_name, responders=[interaction.user])
|
||||
sp_message = await interaction.channel.send(content=f'### {human_team.lname} Starting Pitcher', view=sp_view)
|
||||
# if done:
|
||||
# sp_view = starting_pitcher_dropdown_view(session, this_game, human_team, game_type=this_game.league_name, responders=[interaction.user])
|
||||
# sp_message = await interaction.channel.send(content=f'### {human_team.lname} Starting Pitcher', view=sp_view)
|
||||
|
||||
await final_message.edit(
|
||||
content=f'{away_role.mention} @ {home_role.mention} is set!',
|
||||
embed=embed
|
||||
# await final_message.edit(
|
||||
# content=f'{away_role.mention} @ {home_role.mention} is set!',
|
||||
# embed=embed
|
||||
# )
|
||||
|
||||
roster_choice = await ask_with_buttons(
|
||||
interaction,
|
||||
['vs Left', 'vs Right'],
|
||||
'Which lineup will you be using?',
|
||||
delete_question=False,
|
||||
confirmation_message='Got it!'
|
||||
)
|
||||
|
||||
sp_view = starting_pitcher_dropdown_view(session, this_game, human_team, this_game.league_name, [interaction.user])
|
||||
await interaction.channel.send(content=f'### {human_team.lname} Starting Pitcher', view=sp_view)
|
||||
|
||||
try:
|
||||
await asyncio.sleep(5)
|
||||
this_play = await read_lineup(
|
||||
session,
|
||||
interaction,
|
||||
this_game=this_game,
|
||||
lineup_team=human_team,
|
||||
sheets_auth=self.sheets,
|
||||
lineup_num=1 if roster_choice == 'vs Right' else 2,
|
||||
league_name=this_game.game_type
|
||||
)
|
||||
except LineupsMissingException as e:
|
||||
logger.error(f'Attempting to start game, pausing for 5 seconds: {e}')
|
||||
await asyncio.sleep(5)
|
||||
|
||||
try:
|
||||
this_play = this_game.current_play_or_none(session)
|
||||
await self.post_play(session, interaction, this_play, buffer_message='Game on!')
|
||||
except LineupsMissingException as e:
|
||||
await interaction.channel.send(
|
||||
content=f'Run `/gamestate` once you have selected a Starting Pitcher to get going!'
|
||||
)
|
||||
|
||||
@group_new_game.command(name='exhibition', description='Start a new custom game against an AI')
|
||||
@app_commands.choices(
|
||||
roster=[
|
||||
|
||||
@ -902,7 +902,7 @@ class Players(commands.Cog):
|
||||
)
|
||||
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
|
||||
async def gauntlet_run_command(
|
||||
self, interaction: discord.Interaction, event_name: ACTIVE_EVENT_LITERAL,
|
||||
self, interaction: discord.Interaction, event_name: ACTIVE_EVENT_LITERAL, # type: ignore
|
||||
team_abbrev: str = None):
|
||||
await interaction.response.defer()
|
||||
|
||||
@ -1032,7 +1032,7 @@ class Players(commands.Cog):
|
||||
@group_gauntlet.command(name='reset', description='Wipe your current team so you can re-draft')
|
||||
@app_commands.checks.has_any_role(PD_PLAYERS_ROLE_NAME)
|
||||
async def gauntlet_reset_command(
|
||||
self, interaction: discord.Interaction, event_name: ACTIVE_EVENT_LITERAL):
|
||||
self, interaction: discord.Interaction, event_name: ACTIVE_EVENT_LITERAL): # type: ignore
|
||||
await interaction.response.defer()
|
||||
main_team = await get_team_by_owner(interaction.user.id)
|
||||
draft_team = await get_team_by_abbrev(f'Gauntlet-{main_team["abbrev"]}')
|
||||
|
||||
@ -166,7 +166,8 @@ class SelectStartingPitcher(discord.ui.Select):
|
||||
try:
|
||||
# await interaction.delete_original_response()
|
||||
await interaction.edit_original_response(
|
||||
content=f'The {self.team.lname} are starting **{human_sp_card.player.name_with_desc}**!\n\nRun `/set lineup` to import your lineup and `/gamestate` if you are ready to play.',
|
||||
# content=f'The {self.team.lname} are starting **{human_sp_card.player.name_with_desc}**!\n\nRun `/set lineup` to import your lineup and `/gamestate` if you are ready to play.',
|
||||
content=f'The {self.team.lname} are starting **{human_sp_card.player.name_with_desc}**!',
|
||||
view=None
|
||||
)
|
||||
except Exception as e:
|
||||
@ -384,6 +385,9 @@ class SelectBatterSub(discord.ui.Select):
|
||||
self.session.add(last_lineup)
|
||||
logger.info(f'Set {last_lineup.card.player.name_with_desc} as inactive')
|
||||
|
||||
if position not in ['DH', 'PR', 'PH']:
|
||||
pos_rating = await get_position(self.session, human_batter_card, position)
|
||||
|
||||
human_bat_lineup = Lineup(
|
||||
team=self.team,
|
||||
player=human_batter_card.player,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user