Gameplay bug fixes
This commit is contained in:
parent
f5bf7df166
commit
4b59919d57
@ -244,11 +244,12 @@ async def build_lineup(team_object: dict, game_id: int, league_name: str, vs_han
|
|||||||
('pos_include', 'RF'), ('pos_include', 'DH'), ('inc_dex', False), ('sort_by', 'cost-desc')
|
('pos_include', 'RF'), ('pos_include', 'DH'), ('inc_dex', False), ('sort_by', 'cost-desc')
|
||||||
]
|
]
|
||||||
params.extend(set_params)
|
params.extend(set_params)
|
||||||
all_players = await db_get(
|
p_query = await db_get(
|
||||||
endpoint='players',
|
endpoint='players',
|
||||||
params=params,
|
params=params,
|
||||||
timeout=10
|
timeout=10
|
||||||
)['players']
|
)
|
||||||
|
all_players = p_query['players']
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
raise ConnectionError(f'Error pulling batters for the {team_object["lname"]}. Cal help plz.')
|
raise ConnectionError(f'Error pulling batters for the {team_object["lname"]}. Cal help plz.')
|
||||||
|
|
||||||
@ -416,8 +417,10 @@ async def get_starting_pitcher(team_object: dict, game_id: int, is_home: bool, l
|
|||||||
|
|
||||||
|
|
||||||
async def get_relief_pitcher(this_play: StratPlay, ai_team: dict, used_pitchers: list, league_name: str = None) -> dict:
|
async def get_relief_pitcher(this_play: StratPlay, ai_team: dict, used_pitchers: list, league_name: str = None) -> dict:
|
||||||
c_query = await db_get('cards', object_id=x.card_id)
|
used_codes = []
|
||||||
used_codes = [c_query["player"]["strat_code"] for x in used_pitchers]
|
for x in used_pitchers:
|
||||||
|
c_query = await db_get('cards', object_id=x.card_id)
|
||||||
|
used_codes.append(c_query["player"]["strat_code"])
|
||||||
logging.info(f'get_rp - used_pitchers: {used_codes}')
|
logging.info(f'get_rp - used_pitchers: {used_codes}')
|
||||||
|
|
||||||
reliever = None
|
reliever = None
|
||||||
@ -532,7 +535,7 @@ async def pitching_ai_note(this_play: StratPlay, this_pitcher: dict):
|
|||||||
logging.debug(f'{this_pitcher["team"]["sname"]} going the to pen.')
|
logging.debug(f'{this_pitcher["team"]["sname"]} going the to pen.')
|
||||||
|
|
||||||
if len(used_pitchers) < 8:
|
if len(used_pitchers) < 8:
|
||||||
make_sub(get_relief_pitcher(
|
make_sub(await get_relief_pitcher(
|
||||||
this_play, this_pitcher['team'], used_pitchers, this_play.game.game_type
|
this_play, this_pitcher['team'], used_pitchers, this_play.game.game_type
|
||||||
))
|
))
|
||||||
pitcher = await get_player(this_play.game, get_pitcher(this_play.game, this_play))
|
pitcher = await get_player(this_play.game, get_pitcher(this_play.game, this_play))
|
||||||
|
|||||||
@ -2333,7 +2333,7 @@ class Gameplay(commands.Cog):
|
|||||||
used_pitchers = await get_team_lineups(
|
used_pitchers = await get_team_lineups(
|
||||||
game_id=this_play.game.id, team_id=ai_team['id'], inc_inactive=True, pitchers_only=True, as_string=False
|
game_id=this_play.game.id, team_id=ai_team['id'], inc_inactive=True, pitchers_only=True, as_string=False
|
||||||
)
|
)
|
||||||
make_sub(ai_manager.get_relief_pitcher(this_play, ai_team, used_pitchers, this_game.game_type))
|
make_sub(await ai_manager.get_relief_pitcher(this_play, ai_team, used_pitchers, this_game.game_type))
|
||||||
await interaction.edit_original_response(
|
await interaction.edit_original_response(
|
||||||
content=None,
|
content=None,
|
||||||
embed=await self.get_game_state_embed(this_game)
|
embed=await self.get_game_state_embed(this_game)
|
||||||
|
|||||||
@ -485,11 +485,13 @@ async def get_game_team(game: StratGame, gm_id: int = None, team_abbrev: str = N
|
|||||||
f'tm_abbrev: {team_abbrev} / team_id: {team_id} / game: {game}')
|
f'tm_abbrev: {team_abbrev} / team_id: {team_id} / game: {game}')
|
||||||
if game.is_pd:
|
if game.is_pd:
|
||||||
if gm_id:
|
if gm_id:
|
||||||
return await db_get('teams', params=[('season', PD_SEASON), ('gm_id', gm_id)])['teams'][0]
|
t_query = await db_get('teams', params=[('season', PD_SEASON), ('gm_id', gm_id)])
|
||||||
|
return t_query['teams'][0]
|
||||||
elif team_id:
|
elif team_id:
|
||||||
return await db_get('teams', object_id=team_id)
|
return await db_get('teams', object_id=team_id)
|
||||||
else:
|
else:
|
||||||
return await db_get('teams', params=[('season', PD_SEASON), ('abbrev', team_abbrev)])['teams'][0]
|
t_query = await db_get('teams', params=[('season', PD_SEASON), ('abbrev', team_abbrev)])
|
||||||
|
return t_query['teams'][0]
|
||||||
else:
|
else:
|
||||||
if gm_id:
|
if gm_id:
|
||||||
return get_sba_team_by_owner(season=SBA_SEASON, owner_id=gm_id)
|
return get_sba_team_by_owner(season=SBA_SEASON, owner_id=gm_id)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user