From a40c1c9e937ef3d328fa6eb3998f1d079d64f46f Mon Sep 17 00:00:00 2001 From: Cal Corum Date: Sun, 21 Apr 2024 17:49:10 -0500 Subject: [PATCH] 2024 Updates --- ai_manager.py | 8 ++++---- cogs/economy.py | 6 +++--- cogs/players.py | 26 +++++++++++++++++++++++++- helpers.py | 8 ++++++++ 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/ai_manager.py b/ai_manager.py index 34f01c7..3cb4be1 100644 --- a/ai_manager.py +++ b/ai_manager.py @@ -18,12 +18,12 @@ db = SqliteDatabase( } ) -# 2018, Mario -MINOR_CARDSET_PARAMS = [('cardset_id', 8), ('cardset_id', 13)] +# 2024, Mario +MINOR_CARDSET_PARAMS = [('cardset_id', 17), ('cardset_id', 8)] -# 2018, 2023, Mario, 2013 +# 2018, 2024, Mario, MAJOR_CARDSET_PARAMS = [ - ('cardset_id', 9), ('cardset_id', 8), ('cardset_id', 6), ('cardset_id', 13) + ('cardset_id', 13), ('cardset_id', 14), ('cardset_id', 17), ('cardset_id', 18), ('cardset_id', 8) ] # 2008, 2012, 2013, 2016, 2019, 2021, 2022, 2023, Mario diff --git a/cogs/economy.py b/cogs/economy.py index ffe28b8..3b4c368 100644 --- a/cogs/economy.py +++ b/cogs/economy.py @@ -423,17 +423,17 @@ class Economy(commands.Cog): embed.description = 'Cardset Requirements' embed.add_field( name='Ranked Legal', - value='2018 Season, 2023 Season, 2023 Promos', + value='2024 Season + Promos, 2018 Season + Promos', inline=False ) embed.add_field( name='Minor League', - value='Humans: Unlimited\nAI: 2018 Season / 2023 & 2022 Seasons as backup', + value='Humans: Unlimited\nAI: 2024 Season / 2018 Season as backup', inline=False ) embed.add_field( name='Major League', - value='Humans: Ranked Legal\nAI: 2023, 2018, 2013, 2008 Seasons / 2022 & 2019 as backup', + value='Humans: Ranked Legal\nAI: 2024, 2018, 2016, 2008 Seasons / 2023 & 2022 as backup', inline=False ) embed.add_field( diff --git a/cogs/players.py b/cogs/players.py index f6e0d30..be7bbab 100644 --- a/cogs/players.py +++ b/cogs/players.py @@ -290,8 +290,31 @@ class Players(commands.Cog): self.sheets = pygsheets.authorize(service_file='storage/paper-dynasty-service-creds.json', retries=1) self.player_list = [] self.cardset_list = [] + self.freeze = False self.build_player_list.start() + self.weekly_loop.start() + + @tasks.loop(hours=1) + async def weekly_loop(self): + current = await db_get('current') + now = datetime.datetime.now() + logging.debug(f'Datetime: {now} / weekday: {now.weekday()}') + + # Begin Freeze + # if now.weekday() == 0 and now.hour == 5 and not current['freeze']: # Spring/Summer + if now.weekday() == 0 and now.hour == 0 and not current['freeze']: # Fall/Winter + current['week'] += 1 + await db_patch('current', object_id=current['id'], params=[('week', current['week'])]) + + # End Freeze + # elif now.weekday() == 5 and now.hour == 5 and current['freeze']: # Spring/Summer + # elif now.weekday() == 5 and now.hour == 0 and current['freeze']: # Fall/Winter + # await db_patch('current', object_id=current['id'], params=[('freeze', False)]) + + @weekly_loop.before_loop + async def before_notif_check(self): + await self.bot.wait_until_ready() async def cog_command_error(self, ctx, error): await ctx.send(f'{error}') @@ -418,7 +441,8 @@ class Players(commands.Cog): self, interaction: discord.Interaction, player_name: str, cardset: Literal['All', '2008 Season', '2012 Season', '2013 Season', '2016 Season', '2018 Season', '2019 Season', '2021 Season', '2022 Season', '2022 Promos', '2023 Season', '2023 Promos', - 'Backyard Baseball', 'Mario Super Sluggers', 'Sams Choice'] = 'All'): + '2024 Live', '2024 Promos','Backyard Baseball', 'Mario Super Sluggers', + 'Sams Choice'] = 'All'): # min_rarity: Literal['Replacement', 'Reserve', 'Starter', 'All-Star', 'MVP'] = None): ephemeral = False if interaction.channel.name in ['paper-dynasty-chat', 'pd-news-ticker']: diff --git a/helpers.py b/helpers.py index c0c5be8..e02e4b8 100644 --- a/helpers.py +++ b/helpers.py @@ -643,6 +643,7 @@ class SelectOpenPack(discord.ui.Select): class SelectPaperdexCardset(discord.ui.Select): def __init__(self): options = [ + discord.SelectOption(label='2024 Live'), discord.SelectOption(label='2023 Season'), discord.SelectOption(label='2022 Season'), discord.SelectOption(label='2022 Promos'), @@ -682,6 +683,10 @@ class SelectPaperdexCardset(discord.ui.Select): cardset_id = 12 elif self.values[0] == '2018 Season': cardset_id = 13 + elif self.values[0] == '2024 Live': + cardset_id = 17 + elif self.values[0] == '2024 Promos': + cardset_id = 18 c_query = await db_get('cardsets', object_id=cardset_id, none_okay=False) await interaction.response.edit_message(content=f'Okay, sifting through your cards...', view=None) @@ -809,6 +814,7 @@ class SelectPaperdexTeam(discord.ui.Select): class SelectBuyPacksCardset(discord.ui.Select): def __init__(self, team: dict, quantity: int, pack_type_id: int, pack_embed: discord.Embed, cost: int): options = [ + discord.SelectOption(label='2024 Live'), discord.SelectOption(label='2023 Season'), discord.SelectOption(label='2022 Season'), discord.SelectOption(label='2021 Season'), @@ -847,6 +853,8 @@ class SelectBuyPacksCardset(discord.ui.Select): cardset_id = 12 elif self.values[0] == '2018 Season': cardset_id = 13 + elif self.values[0] == '2024 Live': + cardset_id = 13 self.pack_embed.description = f'{self.pack_embed.description} - {self.values[0]}' view = Confirm(responders=[interaction.user], timeout=30)