Exemplo n.º 1
0
def ad_hoc():
    multiverse.init()  # New Cards?
    multiverse.set_legal_cards()  # PD current list
    multiverse.update_pd_legality()  # PD previous lists
    reprime_cache.run()  # Update deck legalities
    insert_seasons.run()  # Make sure Season table is up to date
    redis.REDIS.flushdb()  # Clear the redis cache
Exemplo n.º 2
0
async def rotate(ctx: MtgContext) -> None:
    """Perform all necessary post-rotation tasks."""
    await ctx.send('Rotating. This may take a while…')
    multiverse.init() # New Cards?
    multiverse.set_legal_cards() # PD current list
    multiverse.update_pd_legality() # PD previous lists
    if redis.REDIS:
        redis.REDIS.flushdb() # type: ignore, Clear the redis cache
    await ctx.send('Rotation complete. You probably want to restart me.')
Exemplo n.º 3
0
async def update(ctx: MtgContext) -> None:
    """Forces an update to legal cards and bugs."""
    await ctx.send('Begun reloading legal cards and bugs.')
    multiverse.set_legal_cards()
    oracle.legal_cards(force=True)
    multiverse.update_bugged_cards()
    multiverse.rebuild_cache()
    multiverse.reindex()
    oracle.init(force=True)
    await ctx.send('Reloaded legal cards and bugs.')
Exemplo n.º 4
0
def ad_hoc() -> None:
    league.set_status(league.Status.CLOSED)
    multiverse.init()  # New Cards?
    multiverse.set_legal_cards()  # PD current list
    multiverse.update_pd_legality()  # PD previous lists
    reprime_cache.run()  # Update deck legalities
    insert_seasons.run()  # Make sure Season table is up to date
    if redis.REDIS:
        redis.REDIS.flushdb()  # type: ignore, Clear the redis cache
    league.set_status(league.Status.OPEN)
Exemplo n.º 5
0
def init():
    if FORMATS:
        return
    print('Updating Legalities...')
    assert len(oracle.legal_cards()) > 0
    all_known = oracle.load_card('island').legalities

    for s in SEASONS:
        if s == rotation.last_rotation_ex()['code']:
            break
        if not 'Penny Dreadful {s}'.format(s=s) in all_known:
            multiverse.set_legal_cards(season=s)

    FORMATS.clear()
    for v in db().values('SELECT name FROM format'):
        FORMATS.add(v)
Exemplo n.º 6
0
def legal_cards(force: bool = False) -> List[str]:
    if len(LEGAL_CARDS) == 0 or force:
        new_list = multiverse.set_legal_cards(force)
        if not new_list:
            sql = 'SELECT bq.name FROM ({base_query}) AS bq WHERE bq.id IN (SELECT card_id FROM card_legality WHERE format_id = {format_id})'.format(base_query=multiverse.base_query(), format_id=multiverse.get_format_id('Penny Dreadful'))
            new_list = [row['name'] for row in db().select(sql)]
        LEGAL_CARDS.clear()
        for name in new_list:
            LEGAL_CARDS.append(name)
    return LEGAL_CARDS
def ad_hoc():
    multiverse.init()  # New Cards?
    multiverse.set_legal_cards()  # PD current list
    multiverse.update_pd_legality()  # PD previous lists
    reprime_cache.run()  # Update deck legalities
Exemplo n.º 8
0
 def init(self):
     multiverse.set_legal_cards()
     multiverse.update_bugged_cards()
     self.client.run(configuration.get('token'))