def look_for_random_player_card(query):
    r_cards = card_search(query, cards.get_p_cards(), use_pc_keywords)
    card = random.choice(r_cards)
    embed = resolve_search([card])
    if embed:
        return embed, True
    else:
        create_embed(lang.locale('card_not_found')), False
def look_for_list_of_cards(query):
    r_cards = card_search(query, cards.get_p_cards(), use_pc_keywords)
    result = [(c, 1) for c in r_cards[:10]]
    text = ">>> " + format_list_of_cards(result, sort=False)
    title = f"{lang.locale('ahList_title')} {len(result)}"
    embed = create_embed(title, text)
    if r_cards:
        return embed, True
    else:
        create_embed(lang.locale('card_not_found')), False
def look_for_upgrades(code, deck_mode):
    """
    Given a ArkhamDB deckcode, returns a Discord.Embed that contains the upgrade information of that deck if any.
    :param deck_mode:
    :param code: ArkhamDB ID
    :return:
    """
    deck1 = find_deck(code, deck_mode)
    deck2 = find_former_deck(code, deck_mode)
    if not deck1:
        return create_embed(lang.locale('deck_not_found')), False
    elif not deck2:
        return create_embed(lang.locale('upgrade_not_found')), False

    info = check_upgrade_rules(deck2, deck1, cards.get_all_cards())
    return format_upgraded_deck(deck1, info), True
def format_player_card(c):
    name = format_name(c)
    level = taboo.format_xp(c)
    subtext = format_subtext(c)
    faction = format_faction(c)
    type = format_type(c)
    slot = format_slot(c)

    traits = text_if("%s\n", format_traits(c))
    icons = text_if("%s\n", format_skill_icons(c))
    costs = format_costs(c)

    text = text_if("> %s\n", format_card_text(c))
    flavour = text_if("%s\n", format_flavour(c))
    health_sanity = text_if("%s\n", format_health_sanity(c))
    taboo_text = taboo.format_taboo_text(c['code'])
    errata_text = errata.format_errata_text(c['code'])
    victory = text_if("> %s\n", format_victory(c))

    m_title = f"{faction} {name}{subtext}{level}"
    m_description = f"{type} {slot}\n" \
                    f"{traits}" \
                    f"{costs}" \
                    f"{icons}\n" \
                    f"{text}" \
                    f"{victory}" \
                    f"{health_sanity}\n" \
                    f"{flavour}\n" \
                    f"{errata_text}" \
                    f"{taboo_text}"
    m_footnote = format_illus_pack(c)
    return create_embed(m_title, m_description, c, m_footnote)
示例#5
0
 def find_formated_timing(self, query):
     timing = self.timings['framework'][query]
     name, text = next(iter(timing.items()))
     title = f"**{name}**"
     description = ">>> "
     for line in text:
         description += f"{format_text(line)}\n"
     embed = create_embed(title=title, description=description)
     return embed
示例#6
0
def format_location_card_b(c: dict) -> discord.embeds.Embed:
    name = format_name(c)
    back = text_if("> %s", format_card_text(c, 'back_text'))
    flavour = f"_{format_card_text(c, 'back_flavor')}_"

    m_title = name
    m_description = f"{back}\n\n{flavour}"
    m_footnote = format_illus_pack(c)
    embed = create_embed(m_title, m_description, c, m_footnote)
    return embed
def look_for_tarot(query):
    """
    Given a query, returns a embed containing a tarot card of the game.
    If the query is empty, returns a random tarot card.
    :param query:  A query string.
    :return:
    """
    search = tarot.search_for_tarot(query)
    if search:
        return format_tarot(search), True

    return create_embed(lang.locale('card_not_found')), False
示例#8
0
def format_general_card_b(c: dict) -> discord.embeds.Embed:
    name = format_name(c)
    subname = format_subtext(c)
    back = text_if("> %s", format_card_text(c, 'back_text'))
    pack = format_set(c)
    flavour = f"_{format_card_text(c, 'back_flavor')}_"

    m_title = f"{name} {subname}"
    m_description = f"{flavour}\n\n{back}"
    m_footnote = pack
    embed = create_embed(m_title, m_description, c, m_footnote)
    return embed
示例#9
0
def format_faq(c):
    name = format_name(c)
    subtext = format_subtext(c)
    faction = format_faction(c)
    level = taboo.format_xp(c)
    text = f"> {format_card_text(c)}"
    faq = format_faq_text(c['code'], back=False)

    title = f"{faction} {name}{subtext} {level}"
    description = f"{text}\n{faq}"
    m_footnote = format_illus_pack(c)
    return create_embed(title, description, c, m_footnote)
def look_for_mythos_card(query: str):
    """
    Given a query, a list of cards and a keyword function
    returns a embed containing the information of a mythos card.
    :param query: A query string, it can contain an (TYPE) or a ~Subtext~
    :return: a Discord.Embed
    """
    r_cards = card_search(query, cards.get_e_cards(), use_ec_keywords)
    embed = resolve_search(r_cards)
    if embed:
        return embed, True

    return create_embed(lang.locale('card_not_found'), "", {}), False
示例#11
0
def format_inv_card_b(c: dict) -> discord.embeds.Embed:
    faction = format_faction(c)
    name = format_name(c)
    subname = format_subtext(c)
    deck_req = text_if("> %s", format_card_text(c, 'back_text'))
    flavour = f"_{format_card_text(c, 'back_flavor')}_"
    errata_text = errata.format_errata_text(c['code'], back=True)

    m_title = f"{faction} {name} {subname}"
    m_description = f"{deck_req}\n\n{flavour}\n\n{errata_text}"
    m_footnote = format_illus_pack(c)
    embed = create_embed(m_title, m_description, c, m_footnote)
    return embed
def look_for_deck(code, deck_type):
    """
    Given a ArkhamDB deckcode, returns a Discord.Embed that contains the information of that deck.
    :param deck_type:
    :param code: ArkhamDB ID
    :return:
    """
    deck = find_deck(code, deck_type)
    if deck:
        deck_info = extract_deck_info(deck, cards.get_all_cards())
        embed = format_deck(deck, deck_info)
        return embed, True

    return create_embed(lang.locale('deck_not_found'), "", {}), False
def look_for_card_back(query: str):
    """
    Given a query, a list of cards and a keyword function
    returns a embed containing the information of a back of a card.
    :param query: A query string, it can contain an (TYPE) or a ~Subtext~
    :return: a Discord.Embed
    """
    f_cards = [c for c in cards.get_all_cards() if c["double_sided"]]
    r_cards = card_search(query, f_cards, use_ec_keywords)
    embed = resolve_back_search(r_cards)
    if embed:
        return embed, True

    return create_embed(lang.locale('card_not_found'), "", {}), False
示例#14
0
def format_tarot(tarot):
    title = f"**{tarot['name']}**"
    up_text = format_text(tarot['up'])
    down_text = format_text(tarot['down'])
    description = f"**{lang.locale('tarot_title')}**" \
                      f"\n\n***{lang.locale('tarot_up_name')}***" \
                      f"\n> _{up_text}_" \
                      f"\n\n***{lang.locale('tarot_down_name')}***" \
                      f"\n> _{down_text}_" \
                      f"\n"
    footnote = f"🖌{tarot['illustrator']}" \
                   f"\n{tarot['set']} #{tarot['number']}."
    embed = create_embed(title=title,
                         description=description,
                         footnote=footnote)

    return embed
def format_inv_card_f(c):
    faction = format_faction(c)
    name = format_name(c)
    subname = format_subtext(c)
    skills = format_inv_skills(c)
    health_sanity = text_if("%s\n", format_health_sanity(c))
    ability = text_if("> %s", format_card_text(c))
    traits = format_traits(c)
    taboo_text = taboo.format_taboo_text(c['code'])
    errata_text = errata.format_errata_text(c['code'])
    flavour = format_flavour(c)

    m_title = f"{faction} {name}{subname}"
    m_description = f"{skills}\n" \
                    f"{traits}\n\n" \
                    f"{ability}\n" \
                    f"{health_sanity}\n" \
                    f"{flavour}\n" \
                    f"{errata_text}\n" \
                    f"{taboo_text}\n"
    m_footnote = format_illus_pack(c)
    return create_embed(m_title, m_description, c, m_footnote)