Merge pull request #2 from calcorum/major-league-expansion
Major league expansion
This commit is contained in:
commit
c97cb3c5d7
@ -1028,11 +1028,18 @@ class Gameplay(commands.Cog):
|
|||||||
if 'Minor' in league:
|
if 'Minor' in league:
|
||||||
league_name = 'minor-league'
|
league_name = 'minor-league'
|
||||||
elif 'Major' in league:
|
elif 'Major' in league:
|
||||||
await interaction.edit_original_response(
|
can_play = False
|
||||||
content='Major League games are coming soon! For now, you can play an Unlimited Minor League game or '
|
for x in interaction.user.roles:
|
||||||
'against other humans!'
|
if x.name == 'PD - Major League':
|
||||||
)
|
can_play = True
|
||||||
return
|
|
||||||
|
if not can_play:
|
||||||
|
await interaction.edit_original_response(
|
||||||
|
content=f'Ope. Looks like you haven\'t received the **PD - Major League** role, yet!\n\n'
|
||||||
|
f'To play **Major League** games, you need to defeat all 30 MLB teams in the Minor League '
|
||||||
|
f'campaign. You can see your progress with `/record`.\n\n'
|
||||||
|
f'If you have completed the Minor League campaign, go ping Cal to get your new role!')
|
||||||
|
return
|
||||||
league_name = 'major-league'
|
league_name = 'major-league'
|
||||||
else:
|
else:
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
@ -1075,64 +1082,12 @@ class Gameplay(commands.Cog):
|
|||||||
# patch_game(this_game.id, active=False)
|
# patch_game(this_game.id, active=False)
|
||||||
# return
|
# return
|
||||||
|
|
||||||
|
# Get AI Lineup
|
||||||
try:
|
try:
|
||||||
# view = Confirm(responders=[interaction.user], timeout=60, label_type='yes')
|
|
||||||
# view.confirm.label = 'Lefty'
|
|
||||||
# view.confirm.style = discord.ButtonStyle.primary
|
|
||||||
# view.cancel.label = 'Righty'
|
|
||||||
# view.cancel.style = discord.ButtonStyle.blurple
|
|
||||||
# question = await interaction.channel.send(
|
|
||||||
# f'**{ai_team["gmname"]}** asks, "is your starting pitcher a lefty or righty?"',
|
|
||||||
# view=view
|
|
||||||
# )
|
|
||||||
# await view.wait()
|
|
||||||
#
|
|
||||||
# roster_num = 1
|
|
||||||
# if view.value:
|
|
||||||
# lineup_num = 2
|
|
||||||
# else:
|
|
||||||
# lineup_num = 1
|
|
||||||
# await question.delete()
|
|
||||||
|
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f'I am getting a lineup card from the {ai_team["sname"]}...'
|
content=f'I am getting a lineup card from the {ai_team["sname"]}...'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Google Sheets Method #################
|
|
||||||
# lineup_cells = get_roster_lineups(ai_team, self.bot, roster_num, lineup_num)
|
|
||||||
# await asyncio.sleep(1)
|
|
||||||
#
|
|
||||||
# all_lineups = []
|
|
||||||
# all_pos = []
|
|
||||||
# for index, row in enumerate(lineup_cells):
|
|
||||||
# if '' in row:
|
|
||||||
# break
|
|
||||||
#
|
|
||||||
# if row[0].upper() not in all_pos:
|
|
||||||
# all_pos.append(row[0].upper())
|
|
||||||
# else:
|
|
||||||
# raise SyntaxError(f'You have a duplicate card {row[0].upper()} in this lineup. Please '
|
|
||||||
# f'update and set the lineup again.')
|
|
||||||
#
|
|
||||||
# this_card = db_get(f'cards', object_id=int(row[1]))
|
|
||||||
# if this_card['team']['id'] != ai_team['id']:
|
|
||||||
# raise SyntaxError(f'Easy there, champ. Looks like card ID {row[1]} belongs to the '
|
|
||||||
# f'{this_card["team"]["sname"]}. Try again with only cards you own.')
|
|
||||||
# player_id = this_card['player']['player_id']
|
|
||||||
# card_id = row[1]
|
|
||||||
#
|
|
||||||
# this_lineup = {
|
|
||||||
# 'game_id': this_game.id,
|
|
||||||
# 'team_id': ai_team['id'],
|
|
||||||
# 'player_id': player_id,
|
|
||||||
# 'card_id': card_id,
|
|
||||||
# 'position': row[0].upper(),
|
|
||||||
# 'batting_order': index + 1,
|
|
||||||
# 'after_play': 0
|
|
||||||
# }
|
|
||||||
#
|
|
||||||
# all_lineups.append(this_lineup)
|
|
||||||
|
|
||||||
logging.info(f'new-game - calling lineup for {ai_team["abbrev"]}')
|
logging.info(f'new-game - calling lineup for {ai_team["abbrev"]}')
|
||||||
all_lineups = ai_manager.build_lineup(ai_team, this_game.id, league_name)
|
all_lineups = ai_manager.build_lineup(ai_team, this_game.id, league_name)
|
||||||
logging.info(f'new-game - got lineup for {ai_team["abbrev"]}')
|
logging.info(f'new-game - got lineup for {ai_team["abbrev"]}')
|
||||||
@ -1147,6 +1102,7 @@ class Gameplay(commands.Cog):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# Get AI Starting Pitcher
|
||||||
try:
|
try:
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=f'Now to decide on a Starting Pitcher...'
|
content=f'Now to decide on a Starting Pitcher...'
|
||||||
@ -1186,10 +1142,6 @@ class Gameplay(commands.Cog):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# if not this_game.first_message:
|
|
||||||
# logging.debug(f'saving first_message: {interaction.channel_id}')
|
|
||||||
# patch_game(this_game.id, first_message=interaction.channel_id)
|
|
||||||
|
|
||||||
@group_new_game.command(name='ranked', description='Start a new Ranked game against another human')
|
@group_new_game.command(name='ranked', description='Start a new Ranked game against another human')
|
||||||
@commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
@commands.has_any_role(PD_PLAYERS_ROLE_NAME)
|
||||||
async def new_game_command(
|
async def new_game_command(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user