Add support for buying Promo pack

This commit is contained in:
Cal Corum 2024-05-13 17:03:48 -05:00
parent f0e3b38938
commit d0c3caaf87
2 changed files with 7 additions and 2 deletions

View File

@ -28,6 +28,8 @@ logging.basicConfig(
# 2024, 2018
ranked_cardsets = [17, 18, 13, 14]
LIVE_CARDSET_ID = 17
LIVE_PROMO_CARDSET_ID = 18
CARDSETS = {
'ranked': {
'primary': ranked_cardsets,

View File

@ -10,7 +10,7 @@ from pandas import DataFrame
from ..db_engine import db, Team, model_to_dict, fn, Pack, Card, Player, Paperdex, Notification, PackType, \
Rarity, Current, query_to_csv, complex_data_to_csv, CARDSETS, CardPosition, BattingCardRatings, BattingCard, \
PitchingCard, PitchingCardRatings, StratGame
PitchingCard, PitchingCardRatings, StratGame, LIVE_PROMO_CARDSET_ID
from ..dependencies import oauth2_scheme, valid_token, LOG_DATA, int_timestamp
logging.basicConfig(
@ -849,8 +849,11 @@ async def team_buy_packs(team_id: int, packtype_id: int, ts: str, quantity: Opti
)
all_packs = []
cardset_id = None
if packtype_id == 9:
cardset_id = LIVE_PROMO_CARDSET_ID
for i in range(quantity):
all_packs.append(Pack(team_id=this_team.id, pack_type_id=this_packtype.id))
all_packs.append(Pack(team_id=this_team.id, pack_type_id=this_packtype.id, pack_cardset_id=cardset_id))
# Deduct card cost from team
logging.info(f'{this_team.abbrev} starting wallet: {this_team.wallet}')