All-Star TC packs updated
This commit is contained in:
parent
d735466fe3
commit
d15050242a
@ -591,6 +591,8 @@ class Economy(commands.Cog):
|
||||
p_group = f'Premium-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}'
|
||||
elif pack['pack_type']['name'] == 'Team Choice':
|
||||
p_group = f'Team Choice-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}'
|
||||
elif pack['pack_type']['name'] == 'All Star':
|
||||
p_group = f'All Star-Cardset-{pack["pack_cardset"]["id"]}-{pack["pack_cardset"]["name"]}'
|
||||
|
||||
logging.debug(f'p_group: {p_group}')
|
||||
if p_group is not None:
|
||||
|
||||
83
helpers.py
83
helpers.py
@ -574,7 +574,7 @@ class SelectOpenPack(discord.ui.Select):
|
||||
async def callback(self, interaction: discord.Interaction):
|
||||
logging.info(f'SelectPackChoice - selection: {self.values[0]}')
|
||||
pack_vals = self.values[0].split('-')
|
||||
logging.debug(f'pack_vals: {pack_vals}')
|
||||
logging.info(f'pack_vals: {pack_vals}')
|
||||
|
||||
# Get the owner's team
|
||||
owner_team = await get_team_by_owner(interaction.user.id)
|
||||
@ -607,11 +607,10 @@ class SelectOpenPack(discord.ui.Select):
|
||||
raise KeyError(f'Cannot identify pack details: {pack_vals}')
|
||||
|
||||
# If team isn't already set on team choice pack, make team pack selection now
|
||||
cardset_id = None
|
||||
if 'Team Choice' in pack_vals:
|
||||
if 'Cardset' in pack_vals:
|
||||
cardset_id = pack_vals[2]
|
||||
else:
|
||||
cardset_id = None
|
||||
await interaction.response.edit_message(view=None)
|
||||
view = SelectView(
|
||||
[SelectChoicePackTeam('AL', owner_team, cardset_id),
|
||||
@ -627,6 +626,7 @@ class SelectOpenPack(discord.ui.Select):
|
||||
params.append(('pack_team_id', pack_vals[2]))
|
||||
elif 'Cardset' in pack_vals:
|
||||
params.append(('pack_cardset_id', pack_vals[2]))
|
||||
cardset_id = pack_vals[2]
|
||||
|
||||
p_query = await db_get('packs', params=params)
|
||||
if p_query['count'] == 0:
|
||||
@ -639,7 +639,7 @@ class SelectOpenPack(discord.ui.Select):
|
||||
if open_type == 'standard':
|
||||
await open_st_pr_packs(p_query['packs'], owner_team, interaction)
|
||||
elif open_type == 'choice':
|
||||
await open_choice_pack(p_query['packs'][0], owner_team, interaction)
|
||||
await open_choice_pack(p_query['packs'][0], owner_team, interaction, cardset_id)
|
||||
|
||||
|
||||
class SelectPaperdexCardset(discord.ui.Select):
|
||||
@ -1619,16 +1619,10 @@ async def get_card_embeds(card, include_stats=False) -> list:
|
||||
embed.set_author(name=card['team']['lname'], url=IMAGES['logo'], icon_url=card['team']['logo'])
|
||||
embed.set_footer(text=f'Paper Dynasty Season {card["team"]["season"]}', icon_url=IMAGES['logo'])
|
||||
|
||||
# if include_stats:
|
||||
# b_query = await db_get('plays/batting', params=[('player_id', card['player']['player_id'])])
|
||||
# p_query = await db_get('plays/pitching', params=[('player_id', card['player']['player_id'])])
|
||||
if include_stats:
|
||||
b_query = await db_get('plays/batting', params=[('player_id', card['player']['player_id'])])
|
||||
p_query = await db_get('plays/pitching', params=[('player_id', card['player']['player_id'])])
|
||||
|
||||
# embed.add_field(
|
||||
# name='Cardset',
|
||||
# value=f'{card["player"]["cardset"]["name"]} '
|
||||
# f'({card["player"]["set_num"]}/{card["player"]["cardset"]["total_cards"]})',
|
||||
# inline=False
|
||||
# )
|
||||
embed.add_field(name='Player ID', value=f'{card["player"]["player_id"]}')
|
||||
embed.add_field(name='Rarity', value=f'{card["player"]["rarity"]["name"]}')
|
||||
embed.add_field(name='Cost', value=f'{card["player"]["cost"]}₼')
|
||||
@ -1670,35 +1664,38 @@ async def get_card_embeds(card, include_stats=False) -> list:
|
||||
else:
|
||||
embed.set_thumbnail(url=IMAGES['logo'])
|
||||
|
||||
# if include_stats:
|
||||
# if b_query['count'] > 0:
|
||||
# b = b_query['stats'][0]
|
||||
# batting_string = f'```\n' \
|
||||
# f' AVG OBP SLG\n' \
|
||||
# f' {b["avg"]:.3f} {b["obp"]:.3f} {b["slg"]:.3f}\n``````\n' \
|
||||
# f' OPS wOBA\n' \
|
||||
# f' {b["ops"]:.3f} {b["woba"]:.3f}\n``````\n' \
|
||||
# f' PA H RBI 2B 3B HR SB\n' \
|
||||
# f'{b["pa"]: >3} {b["hit"]: ^3} {b["rbi"]: ^3} {b["double"]: >2} {b["triple"]: >2} ' \
|
||||
# f'{b["hr"]: >2} {b["sb"]: >2}```\n'
|
||||
# embed.add_field(name='Batting Stats', value=batting_string, inline=False)
|
||||
# if p_query['count'] > 0:
|
||||
# p = p_query['stats'][0]
|
||||
#
|
||||
# ip_whole = math.floor(p['outs'] / 3)
|
||||
# ip_denom = p['outs'] % 3
|
||||
# ips = ip_whole + (ip_denom * 0.1)
|
||||
#
|
||||
# kpbb = f'{p["k/bb"]:.1f}'
|
||||
# era = f'{p["era"]:.2f}'
|
||||
# whip = f'{p["whip"]:.2f}'
|
||||
#
|
||||
# pitching_string = f'```\n' \
|
||||
# f' W-L SV ERA WHIP\n' \
|
||||
# f'{p["win"]: >2}-{p["loss"]: <2} {p["save"]: >2} {era: >5} {whip: >4}\n``````\n' \
|
||||
# f' IP SO K/BB\n' \
|
||||
# f'{ips: >5} {p["so"]: ^3} {kpbb: ^4}\n```'
|
||||
# embed.add_field(name='Pitching Stats', value=pitching_string, inline=False)
|
||||
if include_stats:
|
||||
if b_query['count'] > 0:
|
||||
b = b_query['stats'][0]
|
||||
|
||||
re24 = f'{b["re24"]:.2f}'
|
||||
batting_string = f'```\n' \
|
||||
f' AVG OBP SLG\n' \
|
||||
f' {b["avg"]:.3f} {b["obp"]:.3f} {b["slg"]:.3f}\n``````\n' \
|
||||
f' OPS wOBA RE24\n' \
|
||||
f' {b["ops"]:.3f} {b["woba"]:.3f} {re24: ^5}\n``````\n' \
|
||||
f' PA H RBI 2B 3B HR SB\n' \
|
||||
f'{b["pa"]: >3} {b["hit"]: ^3} {b["rbi"]: ^3} {b["double"]: >2} {b["triple"]: >2} ' \
|
||||
f'{b["hr"]: >2} {b["sb"]: >2}```\n'
|
||||
embed.add_field(name='Batting Stats', value=batting_string, inline=False)
|
||||
if p_query['count'] > 0:
|
||||
p = p_query['stats'][0]
|
||||
|
||||
ip_whole = math.floor(p['outs'] / 3)
|
||||
ip_denom = p['outs'] % 3
|
||||
ips = ip_whole + (ip_denom * 0.1)
|
||||
|
||||
kpbb = f'{p["k/bb"]:.1f}'
|
||||
era = f'{p["era"]:.2f}'
|
||||
whip = f'{p["whip"]:.2f}'
|
||||
re24 = f'{p["re24"]:.2f}'
|
||||
|
||||
pitching_string = f'```\n' \
|
||||
f' W-L SV ERA WHIP\n' \
|
||||
f'{p["win"]: >2}-{p["loss"]: <2} {p["save"]: >2} {era: >5} {whip: >4}\n``````\n' \
|
||||
f' IP SO K/BB RE24\n' \
|
||||
f'{ips: >5} {p["so"]: ^3} {kpbb: ^4} {re24: ^5}\n```'
|
||||
embed.add_field(name='Pitching Stats', value=pitching_string, inline=False)
|
||||
|
||||
if not card['player']['image2']:
|
||||
return [embed]
|
||||
@ -2988,6 +2985,7 @@ async def open_choice_pack(this_pack, team: dict, context, cardset_id: Optional[
|
||||
)
|
||||
if pl['count'] >= 0:
|
||||
players.extend(pl['players'])
|
||||
if len(players) < 4:
|
||||
rarity_id += 3
|
||||
else:
|
||||
# Get 4 MVP cards
|
||||
@ -3008,6 +3006,7 @@ async def open_choice_pack(this_pack, team: dict, context, cardset_id: Optional[
|
||||
|
||||
if pl['count'] > 0:
|
||||
players.extend(pl['players'])
|
||||
if len(players) < 4:
|
||||
rarity_id += 3
|
||||
|
||||
if len(players) == 0:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user