Beispiel #1
0
def draw_hundred_card(user_id):
    """
    百连抽
    :param user_id:
    :return:
    """
    score = select_score(user_id)
    if score < CARD_PRICE * 80:
        return pa
    lv_num = {'UR': 0, "SSR": 0, 'SR': 0, 'R': 0, 'N': 0}
    card_num = {'N': [], 'R': [], 'SR': [], "SSR": [], 'UR': []}
    imgs = {}
    for i in range(100):
        img, str1, lv = get_random_card()
        lv_num[lv] += 1
        if imgs.get(img):
            imgs[img] += 1
        else:
            imgs[img] = 1
        card_num[lv].append(img)
    archive_cards(user_id, imgs, lv_num)
    str1 = f'扣除{CARD_PRICE * 80}积分\n获得UR卡{lv_num["UR"]}张\n获得SSR卡{lv_num["SSR"]}张\n获得SR卡{lv_num["SR"]}张\n' \
        f'获得R卡{lv_num["R"]}张\n获得N卡{lv_num["N"]}张\n详细抽卡结果已私聊发送'
    str3 = ''  # str3 为私聊发送
    for i in card_num:
        if i == 'N':
            str3 += '获得N卡若干\n'
            continue
        if not card_num[i]:
            continue
        for _ in card_num[i]:
            str3 += f'获得{i}——{_}\n'
    return get_return(str1, str3)
Beispiel #2
0
def draw_ten_card(user_id):
    """
    十连抽
    :param user_id:
    :return:
    """
    score = select_score(user_id)
    if score < CARD_PRICE * 9:
        return get_return('爬', code=1)
    add_score(user_id, -9 * CARD_PRICE)
    str1 = f'花费{CARD_PRICE * 9}积分。\n'
    n_NUM = 0
    lv_num = {'UR': 0, "SSR": 0, 'SR': 0, 'R': 0, 'N': 0}
    card_num = {'N': [], 'R': [], 'SR': [], "SSR": [], 'UR': []}
    imgs = {}
    for i in range(10):
        img, str2, lv = get_random_card()
        n_NUM += 1 if lv == 'N' else 0
        if n_NUM == 10:
            while lv == 'N':
                img, str2, lv = get_random_card()
                str1 += '触发保底:\n'
        lv_num[lv] += 1
        if imgs.get(img):
            imgs[img] += 1
        else:
            imgs[img] = 1
        card_num[lv].append(img)
        if str2:
            str1 += str2 + '\n'
    archive_cards(user_id, imgs, lv_num)
    return get_return(str1)
Beispiel #3
0
def get_score(user_id):
    """
    返回纯净可操作性的积分数额
    :param user_id:
    :return:
    """
    score = select_score(user_id)
    return json.dumps({'score': score})
Beispiel #4
0
def search_score(user_id):
    """
    查询用户积分
    :param user_id:
    :return:
    """
    score = select_score(user_id)
    if score:
        return get_return(f'积分:{score}', need={'score': score})
    return '穷鬼爬'
Beispiel #5
0
def draw_card(user_id):
    """
    抽卡
    :param user_id:
    :return:
    """
    score = select_score(user_id)
    if score < CARD_PRICE:
        return get_return('爬', code=1)
    add_score(user_id, -CARD_PRICE)
    img, str1, lv = get_random_card()
    str1 = f'花费{CARD_PRICE}积分,获得{lv}卡:{img}。'
    archive_card(user_id, img, lv, 1)
    return get_return(str1, need={'card': img})