Exemple #1
0
async def gacha_10(bot, ev: CQEvent):
    SUPER_LUCKY_LINE = 170
    SUPER_BAD_LUCK = 19

    await check_jewel_num(bot, ev)
    jewel_limit.increase(ev.user_id, 1500)

    gid = str(ev.group_id)
    gacha = Gacha(_group_pool[gid])
    result, hiishi = gacha.gacha_ten()
    silence_time = 240 if hiishi < SUPER_LUCKY_LINE else 400

    if sv.bot.config.USE_CQPRO:
        res1 = chara.gen_team_pic(result[:5], star_slot_verbose=False)
        res2 = chara.gen_team_pic(result[5:], star_slot_verbose=False)
        res = concat_pic([res1, res2])
        res = pic2b64(res)
        res = MessageSegment.image(res)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res}\n{res1}\n{res2}'
    else:
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res1}\n{res2}'

    if hiishi >= SUPER_LUCKY_LINE:
        await bot.send(ev, '恭喜海豹!')
    elif hiishi <= SUPER_BAD_LUCK:
        await bot.send(ev, '世 界 名 画')
    await bot.send(ev, f'优秀的伙伴增加了!\n{res}\n', at_sender=True)
Exemple #2
0
async def gacha_10(session:CommandSession):
    SUPER_LUCKY_LINE = 170

    await check_jewel_num(session)
    uid = session.ctx['user_id']
    jewel_limit.increase(uid, 1500)

    gid = str(session.ctx['group_id'])
    gacha = Gacha(_group_pool[gid])
    result, hiishi = gacha.gacha_ten()
    silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60

    if sv.bot.config.IS_CQPRO:
        res1 = Chara.gen_team_pic(result[:5], star_slot_verbose=False)
        res2 = Chara.gen_team_pic(result[5:], star_slot_verbose=False)
        res = concat_pic([res1, res2])
        res = pic2b64(res)
        res = MessageSegment.image(res)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res}\n{res1}\n{res2}'
    else:
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res1}\n{res2}'

    if hiishi >= SUPER_LUCKY_LINE:
        await session.send('恭喜海豹!おめでとうございます!')
    await session.send(f'素敵な仲間が増えますよ!\n{res}\n{SWITCH_POOL_TIP}', at_sender=True)
    await silence(session.ctx, silence_time)
Exemple #3
0
async def gacha_300(bot, ev: CQEvent):

    await check_tenjo_num(bot, ev)
    tenjo_limit.increase(ev.user_id)

    gid = str(ev.group_id)
    gacha = Gacha(_group_pool[gid])
    result = gacha.gacha_tenjou()
    up = len(result['up'])
    s3 = len(result['s3'])
    s2 = len(result['s2'])
    s1 = len(result['s1'])

    res = [*(result['up']), *(result['s3'])]
    random.shuffle(res)
    lenth = len(res)
    if lenth <= 0:
        res = "竟...竟然没有3★?!"
    else:
        step = 4
        pics = []
        for i in range(0, lenth, step):
            j = min(lenth, i + step)
            pics.append(chara.gen_team_pic(res[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)

    msg = [
        f"\n素敵な仲間が増えますよ! {res}", f"★★★×{up+s3} ★★×{s2} ★×{s1}",
        f"\n发送"选择卡池"可以切换卡池\n管理员发送"氪金+@你本人",可以再抽一次",
        f"获得记忆碎片×{100*up}与女神秘石×{50*(up+s3) + 10*s2 + s1}!\n第{result['first_up_pos']}抽首次获得up角色"
        if up else f"获得女神秘石{50*(up+s3) + 10*s2 + s1}个!"
    ]

    if up == 0 and s3 == 0:
        msg.append("太惨了,咱们还是退款删游吧...")
    elif up == 0 and s3 > 7:
        msg.append("up呢?我的up呢?")
    elif up == 0 and s3 <= 3:
        msg.append("这位酋长,梦幻包考虑一下?")
    elif up == 0:
        msg.append("据说天井的概率只有12.16%")
    elif up <= 2:
        if result['first_up_pos'] < 50:
            msg.append("你的喜悦我收到了,滚去喂鲨鱼吧!")
        elif result['first_up_pos'] < 100:
            msg.append("已经可以了,您已经很欧了")
        elif result['first_up_pos'] > 290:
            msg.append("标 准 结 局")
        elif result['first_up_pos'] > 250:
            msg.append("补井还是不补井,这是一个问题...")
        else:
            msg.append("期望之内,亚洲水平")
    elif up == 3:
        msg.append("抽井母五一气呵成!多出30等专武~")
    elif up >= 4:
        msg.append("记忆碎片一大堆!您是托吧?")

    await bot.send(ev, '\n'.join(msg), at_sender=True)
Exemple #4
0
async def gacha_10(session: CommandSession):
    SUPER_LUCKY_LINE = 170
    uid = session.ctx['user_id']
    at = str(MessageSegment.at(session.ctx['user_id']))

    if not check_gacha_num(uid):
        await session.finish(f'{at} {GACHA_EXCEED_NOTICE}')
    _user_gacha_count[uid] += 1

    gacha = Gacha()
    result, hiishi = gacha.gacha_ten()
    silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60

    if get_bot().config.IS_CQPRO:
        res1 = Chara.gen_team_pic(result[:5], star_slot_verbose=False)
        res2 = Chara.gen_team_pic(result[5:], star_slot_verbose=False)
        res = concat_pic([res1, res2])
        res = pic2b64(res)
        res = MessageSegment.image(res)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = res + f'{res1}\n{res2}'
    else:
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res1}\n{res2}'

    await silence(session.ctx, silence_time)
    msg = f'{at}\n素敵な仲間が増えますよ!\n{res}'
    await session.send(msg)
    if hiishi >= SUPER_LUCKY_LINE:
        await session.send('恭喜海豹!おめでとうございます!')
Exemple #5
0
async def gacha_10(bot, ev: CQEvent):

    await check_jewel_num(bot, ev)
    jewel_limit.increase(ev.user_id, 1500)

    gid = str(ev.group_id)
    gacha = Gacha(_group_pool[gid])
    result = gacha.gacha_ten()

    uid = str(ev.user_id)
    if _colle_enable[uid]:
        await modify_colle(bot, ev, result)

    res1 = chara.gen_team_pic(result[:5], star_slot_verbose=False)
    res2 = chara.gen_team_pic(result[5:], star_slot_verbose=False)
    res = concat_pic([res1, res2])
    res = pic2b64(res)
    res = MessageSegment.image(res)
    result = [f'{c.name}{"★"*c.star}' for c in result]
    res1 = ' '.join(result[0:5])
    res2 = ' '.join(result[5:])
    res = f'{res}\n{res1}\n{res2}'
    # 纯文字版
    # result = [f'{c.name}{"★"*c.star}' for c in result]
    # res1 = ' '.join(result[0:5])
    # res2 = ' '.join(result[5:])
    # res = f'{res1}\n{res2}'

    await bot.send(ev, f'素敵な仲間が増えますよ!\n{res}', at_sender=True)
Exemple #6
0
async def pcr_comp(bot, ev: CQEvent):
    global g_result, g_uid
    uid = ev.user_id
    if not lmt.check(uid):
        await bot.send(ev, '今天已经赛过5次力', at_sender=True)
        return
    if g_result != []:
        await bot.send(ev,
                       '上一场比赛尚未结束,请等待\n※管理员发送“@bot赛跑重置”可重置比赛',
                       at_sender=True)
        return
    lmt.increase(uid)
    await bot.send(ev, f'第○届兰德索尔杯比赛开始!', at_sender=True)
    gid = str(ev.group_id)
    palyer = Palyer(_group_pool[gid])
    result = palyer.get_chara()
    result_number = palyer.get_num()
    res2 = chara.gen_team_pic(result, star_slot_verbose=False)
    res1 = chara.gen_team_pic(result_number, star_slot_verbose=False)
    res = concat_pic([res1, res2])
    res = pic2b64(res)
    res = MessageSegment.image(res)
    result_name = [f'{c.name}' for c in result]
    res_name = ' '.join(result_name)
    if sv.bot.config.USE_CQPRO:
        await bot.send(ev,
                       f'比赛选手:\n{res}\n{res_name}\n※发送“选中+角色名称”开始比赛',
                       at_sender=False)
    else:
        await bot.send(ev, f'error:CQpro is required')
    save_player(result_name)
    g_uid = uid
Exemple #7
0
async def gacha_10(bot, ev: CQEvent):
    SUPER_LUCKY_LINE = 170

    await check_jewel_num(bot, ev)
    jewel_limit.increase(ev.user_id, 1500)

    gid = str(ev.group_id)
    gacha = Gacha(_group_pool[gid])
    result, hiishi = gacha.gacha_ten()
    silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60

    res1 = chara.gen_team_pic(result[:5], star_slot_verbose=False)
    res2 = chara.gen_team_pic(result[5:], star_slot_verbose=False)
    res = concat_pic([res1, res2])
    res = pic2b64(res)
    res = MessageSegment.image(res)
    result = [f'{c.name}{"★"*c.star}' for c in result]
    res1 = ' '.join(result[0:5])
    res2 = ' '.join(result[5:])
    res = f'{res}\n{res1}\n{res2}'
    # 纯文字版
    # result = [f'{c.name}{"★"*c.star}' for c in result]
    # res1 = ' '.join(result[0:5])
    # res2 = ' '.join(result[5:])
    # res = f'{res1}\n{res2}'

    if hiishi >= SUPER_LUCKY_LINE:
        await bot.send(ev, '恭喜海豹!おめでとうございます!')
    await bot.send(ev, f'素敵な仲間が増えますよ!\n{res}\n', at_sender=True)
    await silence(ev, silence_time)
Exemple #8
0
async def inquire_noble(bot, ev: CQEvent):

    gid = ev.group_id
    uid = ev.user_id
    duel = DuelCounter()
    score_counter = ScoreCounter2()
    if duel._get_level(gid, uid) == 0:
        msg = '您还未在本群创建过贵族,请发送 创建贵族 开始您的贵族之旅。'
        await bot.send(ev, msg, at_sender=True)
        return
    level = duel._get_level(gid, uid)
    noblename = get_noblename(level)
    girlnum = get_girlnum(level)
    score = score_counter._get_score(gid, uid)
    charalist = []

    cidlist = duel._get_cards(gid, uid)
    cidnum = len(cidlist)
    if cidnum == 0:
        msg = f'''
╔                          ╗
  您的爵位为{noblename}
  您的金币为{score}
  您共可拥有{girlnum}名女友
  您目前没有女友。
  发送[贵族约会]
  可以招募女友哦。
  
╚                          ╝
'''
        await bot.send(ev, msg, at_sender=True)

    else:
        for cid in cidlist:
            charalist.append(chara.Chara(cid, 0, 0))
        if cidnum <= 7:

            res = chara.gen_team_pic(charalist, star_slot_verbose=False)
        else:
            res1 = chara.gen_team_pic(charalist[:7], star_slot_verbose=False)
            res2 = chara.gen_team_pic(charalist[7:], star_slot_verbose=False)
            res = concat_pic([res1, res2])
        bio = BytesIO()
        res.save(bio, format='PNG')
        base64_str = 'base64://' + base64.b64encode(bio.getvalue()).decode()
        mes = f"[CQ:image,file={base64_str}]"

        msg = f'''
╔                          ╗
  您的爵位为{noblename}
  您的金币为{score}
  您共可拥有{girlnum}名女友
  您已拥有{cidnum}名女友
  她们是:
    {mes}   
╚                          ╝
'''
        await bot.send(ev, msg, at_sender=True)
Exemple #9
0
async def gacha_300(bot, ev: CQEvent):

    await check_tenjo_num(bot, ev)
    tenjo_limit.increase(ev.user_id)

    gid = str(ev.group_id)
    gacha = Gacha(_group_pool[gid])
    result = gacha.gacha_tenjou()
    up = len(result['up'])
    s3 = len(result['s3'])
    s2 = len(result['s2'])
    s1 = len(result['s1'])
    res = result['res']

    lenth = len(res)
    if lenth <= 0:
        res = "竟...竟然没有3★?!"
    else:
        step = 4
        pics = []
        for i in range(0, lenth, step):
            j = min(lenth, i + step)
            pics.append(chara.gen_team_pic(res[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)

    msg = [
        f"\n优秀的伙伴增加了! {res}", f"★★★×{up+s3} ★★×{s2} ★×{s1}",
        f"获得女神秘石×{50*(up+s3) + 10*s2 + s1}!\n第{result['first_up_pos']}抽首次获得up角色"
        if up else f"获得女神秘石{50*(up+s3) + 10*s2 + s1}个!"
    ]

    if up == 0 and s3 == 0:
        msg.append("太惨了,咱们还是退款删游吧...")
    elif up == 0 and s3 > 7:
        msg.append("up呢?我的up呢?")
    elif up == 0 and s3 <= 3:
        msg.append("这位酋长,梦幻包考虑一下?")
    elif up == 0:
        msg.append("据说天井的概率只有12.16%")
    else:
        if result['first_up_pos'] < 50:
            msg.append("你的喜悦我收到了,滚去喂鲨鱼吧!")
        elif result['first_up_pos'] < 100:
            msg.append("已经可以了,您已经很欧了")
        elif result['first_up_pos'] > 290:
            msg.append("标 准 结 局")
        elif result['first_up_pos'] > 250:
            msg.append("补井还是不补井,这是一个问题...")
        else:
            msg.append("期望之内,亚洲水平")

    await bot.send(ev, '\n'.join(msg), at_sender=True)
    silence_time = 1200
Exemple #10
0
async def upload(ss: CommandSession):
    atk_team = ss.get('atk_team', prompt='请输入进攻队+5个表示星级的数字+5个表示专武的0/1 无需空格')
    def_team = ss.get('def_team', prompt='请输入防守队+5个表示星级的数字+5个表示专武的0/1 无需空格')
    if 'pic' not in ss.state:
        ss.state['pic'] = MessageSegment.image(pic2b64(concat_pic([
            chara.gen_team_pic(atk_team),
            chara.gen_team_pic(def_team),
        ])))
    confirm = ss.get('confirm', prompt=f'{ss.state["pic"]}\n{MessageSegment.at(ss.event.user_id)}确认上传?\n> 确认\n> 取消')
    # TODO: upload
    await ss.send('假装上传成功了...')
Exemple #11
0
async def gacha_10(session:CommandSession):
    SUPER_LUCKY_LINE = 170

    await check_jewel_num(session)
    uid = session.ctx['user_id']
    jewel_limit.increase(uid, 1500)
    
    gid=session.ctx['group_id']
    gacha = Gacha(_group_pool[gid])
    result, hiishi = gacha.gacha_ten()
    silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60

    cardo = [cardram(),cardram(),cardram(),cardram(),cardram(),cardram(),cardram(),cardram(),cardram(),cardram()]
    if (cardo[0] + cardo[1] + cardo[2] + cardo[3] + cardo[4] + cardo[5] + cardo[6] + cardo[7] + cardo[8] + cardo[9]) == 60:
        cardo[9] = 5
    cardu = [Chara.cardimg(cardo[0]),Chara.cardimg(cardo[1]),Chara.cardimg(cardo[2]),Chara.cardimg(cardo[3]),Chara.cardimg(cardo[4]),Chara.cardimg(cardo[5]),Chara.cardimg(cardo[6]),Chara.cardimg(cardo[7]),Chara.cardimg(cardo[8]),Chara.cardimg(cardo[9])]
    card = Chara.gen_card_pic(cardu, star_slot_verbose=False)
    card = pic2b64(card)
    card = MessageSegment.image(card)

    cardm1 = cardmjs(cardo[0])[0] + cardmjs(cardo[1])[0] + cardmjs(cardo[2])[0] + cardmjs(cardo[3])[0] + cardmjs(cardo[4])[0] + cardmjs(cardo[5])[0] + cardmjs(cardo[6])[0] + cardmjs(cardo[7])[0] + cardmjs(cardo[8])[0] + cardmjs(cardo[9])[0]
    cardm2 = cardmjs(cardo[0])[1] + cardmjs(cardo[1])[1] + cardmjs(cardo[2])[1] + cardmjs(cardo[3])[1] + cardmjs(cardo[4])[1] + cardmjs(cardo[5])[1] + cardmjs(cardo[6])[1] + cardmjs(cardo[7])[1] + cardmjs(cardo[8])[1] + cardmjs(cardo[9])[1]
    cardm3 = cardmjs(cardo[0])[2] + cardmjs(cardo[1])[2] + cardmjs(cardo[2])[2] + cardmjs(cardo[3])[2] + cardmjs(cardo[4])[2] + cardmjs(cardo[5])[2] + cardmjs(cardo[6])[2] + cardmjs(cardo[7])[2] + cardmjs(cardo[8])[2] + cardmjs(cardo[9])[2]
    cardmax = f'获得角色碎片x{cardm1},母猪石x{cardm2},公主之心碎片x{cardm3}'

    if sv.bot.config.IS_CQPRO:
        res1 = Chara.gen_team_pic(result[ :5], star_slot_verbose=False)
        res2 = Chara.gen_team_pic(result[5: ], star_slot_verbose=False)
        res = concat_pic([res1, res2])
        res = pic2b64(res)
        res = MessageSegment.image(res)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res}\n{res1}\n{res2}'
    else:
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res1}\n{res2}'

    if hiishi >= SUPER_LUCKY_LINE:
        await session.send('恭喜海豹!おめでとうございます!')
    await session.send(f'素敵な仲間が増えますよ!\n{res}\n{card}\n{cardmax}', at_sender=True)
    await silence(session.ctx, silence_time)
Exemple #12
0
async def gacha_10(bot, ev: CQEvent):

    arg = str(ev.raw_message)
    rex = re.compile(BOT_NICKNAME)
    m = rex.search(arg)
    if m:
        await check_limit_num(bot, ev)
    if m:
        SUPER_LUCKY_LINE = 170

        await check_jewel_num(bot, ev)
        uid = ev.user_id
        jewel_limit.increase(uid, 1500)

        gid = str(ev.group_id)
        gacha = Gacha(_group_pool[gid])
        result, hiishi = gacha.gacha_ten()
        silence_time = hiishi * 0 if hiishi < SUPER_LUCKY_LINE else hiishi * 6

        if sv.bot.config.USE_CQPRO:
            res1 = chara.gen_team_pic(result[:5], star_slot_verbose=False)
            res2 = chara.gen_team_pic(result[5:], star_slot_verbose=False)
            res = concat_pic([res1, res2])
            res = pic2b64(res)
            res = MessageSegment.image(res)
            result = [f'{c.name}{"★"*c.star}' for c in result]
            res1 = ' '.join(result[0:5])
            res2 = ' '.join(result[5:])
            res = f'{res}\n{res1}\n{res2}'
        else:
            result = [f'{c.name}{"★"*c.star}' for c in result]
            res1 = ' '.join(result[0:5])
            res2 = ' '.join(result[5:])
            res = f'{res1}\n{res2}'






        if hiishi >= SUPER_LUCKY_LINE:
            await bot.send(ev, '恭喜海豹!おめでとうございます!')
        await bot.send(ev, f'素敵な仲間が増えますよ!\n{res}\n{SWITCH_POOL_TIP}\n※发送“@bot宝石”可以查看还剩多少宝石', at_sender=True)
        await silence(ev, silence_time)
Exemple #13
0
async def bang_gacha(bot, ev):
    
    uid = ev['user_id']
    poolid = str(ev.message)
    
    if poolid in pool_dict:
        poolinfo = pool_dict[poolid]
        name = poolinfo[1]
        banner = pic2b64(Image.open(os.path.join(picpath,"pool",f"{poolid}.png")))
        banner = MessageSegment.image(banner)
        
        type = poolinfo[2]
        if type=="恒久的":
            type="普通"
        if type=="ドリームフェスティバル":
            type="Fes"
        
        start = poolinfo[3]
        end = poolinfo[4]
        uplist = poolinfo[5:]
        while "" in uplist:
            uplist.remove("")

        step = 3 if len(uplist)>=3 else 2
        pics=[]
        for i in range(0, len(uplist), step):
            size=180
            j = min(len(uplist), i + step)
            des = Image.new('RGBA', (step*size, size), (255, 255, 255, 255))
            for k, card in enumerate(uplist[i:j]):
                src = Image.open(os.path.join(picpath,"card",f"{card}_0.png"))
                des.paste(src, (k * size, 0))
            pics.append(des)
        res = concat_pic(pics)
        up=MessageSegment.image(pic2b64(res))

        msg=f"卡池[{name}]\n{banner}\n{type}池,开始于{start},结束于{end}\nPickUp列表:{up}"
        await bot.finish(ev, msg)
    else:
        await bot.finish(ev, '没有对应的卡池哦')
Exemple #14
0
async def show_collection(session:CommandSession):
    uid = str(session.ctx['user_id'])
    uset=load_user_collection(uid)[uid]
    length = len(uset)
    if length <= 0:
        session.finish('您的仓库为空,请多多抽卡哦~',at_sender=True)
    else:
        result=list(map(lambda x:Chara.fromname(x),uset))
        step = 6
        pics = []
        for i in range(0, length, step):
            j = min(length, i + step)
            pics.append(Chara.gen_team_pic(result[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)
    msg=[
    f'仅展示三星角色~',
    f'{res}',
    f'您共有{length}个三星角色~'
    ]
    await session.send('\n'.join(msg), at_sender=True)
Exemple #15
0
async def gacha_10(session):
    SUPER_LUCKY_LINE = 170
    await check_jewel_num(session)
    uid = session.ctx['user_id']
    jewel_limit.increase(uid, 1500)
    uid = str(session.ctx['user_id'])
    ucollection = load_user_collection(uid)
    uset = set(ucollection[uid])
    gid = session.ctx.get('group_id', 0)
    gacha = Gacha(_group_pool[str(gid)]) if gid != 0 else Gacha('MIX')
    result, hiishi = gacha.gacha_ten()
    silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60
    for c in result:
        if 3 == c.star:
            uset.add(c.name)
    ucollection[uid] = list(uset)
    if sv.bot.config.IS_CQPRO:
        res1 = Chara.gen_team_pic(result[:5], star_slot_verbose=False)
        res2 = Chara.gen_team_pic(result[5:], star_slot_verbose=False)
        res = concat_pic([res1, res2])
        res = pic2b64(res)
        res = MessageSegment.image(res)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res}\n{res1}\n{res2}'
    else:
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res1}\n{res2}'
    dump_user_collection(uid, ucollection)
    if hiishi >= SUPER_LUCKY_LINE:
        await session.send('恭喜海豹!おめでとうございます!')
    await session.send(f'素敵な仲間が増えますよ!\n{res}', at_sender=True)
    if gid != 0:
        await silence(session.ctx, silence_time)
Exemple #16
0
async def gacha_wai(session: CommandSession):
    SUPER_LUCKY_LINE = 170
    uid = session.ctx['user_id']
    gid = str(session.ctx['group_id'])
    gacha = Gacha(_group_pool[gid])
    result, hiishi = gacha.gacha_wai()
    silence_time = hiishi * 6 if hiishi < SUPER_LUCKY_LINE else hiishi * 60
    if sv.bot.config.IS_CQPRO:
        res1 = Chara.gen_team_pic(result[:5], star_slot_verbose=False)
        res2 = Chara.gen_team_pic(result[5:], star_slot_verbose=False)
        res = concat_pic([res1, res2])
        res = pic2b64(res)
        res = MessageSegment.image(res)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res}\n{res1}\n{res2}'
    else:
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        res = f'{res1}\n{res2}'

    await session.send(f'听说喜欢常驻等歪~~\n{res}\n{SWITCH_POOL_TIP}', at_sender=True)
Exemple #17
0
async def _arena_query(bot, ev: CQEvent, region: int):

    arena.refresh_quick_key_dic()
    uid = ev.user_id

    if not lmt.check(uid):
        await bot.finish(ev, '您查询得过于频繁,请稍等片刻', at_sender=True)
    lmt.start_cd(uid)

    # 处理输入数据
    defen = ev.message.extract_plain_text()
    defen = re.sub(r'[??,,_]', '', defen)
    defen, unknown = chara.roster.parse_team(defen)

    if unknown:
        _, name, score = chara.guess_id(unknown)
        if score < 70 and not defen:
            return  # 忽略无关对话
        msg = f'无法识别"{unknown}"' if score < 70 else f'无法识别"{unknown}" 您说的有{score}%可能是{name}'
        await bot.finish(ev, msg)
    if not defen:
        await bot.finish(ev, '查询请发送"怎么拆+防守队伍",无需+号', at_sender=True)
    if len(defen) > 5:
        await bot.finish(ev, '编队不能多于5名角色', at_sender=True)
    if len(defen) != len(set(defen)):
        await bot.finish(ev, '编队中含重复角色', at_sender=True)
    if any(chara.is_npc(i) for i in defen):
        await bot.finish(ev, '编队中含未实装角色', at_sender=True)
    if 1004 in defen:
        await bot.send(ev,
                       '\n⚠️您正在查询普通版炸弹人\n※万圣版可用万圣炸弹人/瓜炸等别称',
                       at_sender=True)

    # 执行查询
    sv.logger.info('Doing query...')
    res = await arena.do_query(defen, uid, region)
    sv.logger.info('Got response!')

    # 处理查询结果
    if res is None:
        await bot.finish(ev,
                         '查询出错,请联系维护组调教\n请先移步pcrdfans.com进行查询',
                         at_sender=True)
    if not len(res):
        await bot.finish(
            ev,
            '抱歉没有查询到解法\n※没有作业说明随便拆 发挥你的想象力~★\n作业上传请前往pcrdfans.com',
            at_sender=True)
    res = res[:min(6, len(res))]  # 限制显示数量,截断结果

    # 发送回复
    if hoshino.config.USE_CQPRO:
        sv.logger.info('Arena generating picture...')
        atk_team = [chara.gen_team_pic(entry['atk']) for entry in res]
        atk_team = concat_pic(atk_team)
        atk_team = pic2b64(atk_team)
        atk_team = str(MessageSegment.image(atk_team))
        sv.logger.info('Arena picture ready!')
    else:
        atk_team = '\n'.join(
            map(
                lambda entry: ' '.join(
                    map(
                        lambda x:
                        f"{x.name}{x.star if x.star else ''}{'专' if x.equip else ''}",
                        entry['atk'])), res))

    details = [
        " ".join([
            f"赞{e['up']}+{e['my_up']}" if e['my_up'] else f"赞{e['up']}",
            f"踩{e['down']}+{e['my_down']}"
            if e['my_down'] else f"踩{e['down']}", e['qkey'], "你赞过"
            if e['user_like'] > 0 else "你踩过" if e['user_like'] < 0 else ""
        ]) for e in res
    ]

    defen = [chara.fromid(x).name for x in defen]
    defen = f"防守方【{' '.join(defen)}】"
    at = str(MessageSegment.at(ev.user_id))

    msg = [
        defen, f'已为骑士{at}查询到以下进攻方案:',
        str(atk_team), f'作业评价:', *details, '※发送"点赞/点踩"可进行评价'
    ]
    if region == 1:
        msg.append('※使用"b怎么拆"或"台怎么拆"可按服过滤')
    msg.append('Support by pcrdfans_com')

    sv.logger.debug('Arena sending result...')
    await bot.send(ev, '\n'.join(msg))
    sv.logger.debug('Arena result sent!')
Exemple #18
0
async def gacha_300(session):
    await check_tenjo_num(session)
    uid = session.ctx['user_id']
    tenjo_limit.increase(uid)
    uid = str(session.ctx['user_id'])
    ucollection = load_user_collection(uid)
    uset = set(ucollection[uid])
    gid = session.ctx.get('group_id', 0)
    gacha = Gacha(_group_pool[str(gid)]) if gid != 0 else Gacha('MIX')
    result, up = gacha.gacha_tenjou()
    s3 = len(result['s3'])
    s2 = len(result['s2'])
    s1 = len(result['s1'])
    res = result['s3']
    for c in res:
        uset.add(c.name)
    ucollection[uid] = list(uset)
    dump_user_collection(uid, ucollection)
    lenth = len(res)
    if lenth <= 0:
        res = "竟...竟然没有3★?!"
    else:
        step = 4
        pics = []
        for i in range(0, lenth, step):
            j = min(lenth, i + step)
            pics.append(Chara.gen_team_pic(res[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)

    msg = [
        f"\n素敵な仲間が増えますよ! {res}", f"★★★×{s3} ★★×{s2} ★×{s1}",
        f"获得{up}个up角色与女神秘石×{50*(s3) + 10*s2 + s1}!\n第{result['first_up_pos']}抽首次获得up角色"
        if up else f"获得女神秘石{50*(up+s3) + 10*s2 + s1}个!"
    ]

    if up == 0 and s3 == 0:
        msg.append("太惨了,咱们还是退款删游吧...")
    elif up == 0 and s3 > 7:
        msg.append("up呢?我的up呢?")
    elif up == 0 and s3 <= 3:
        msg.append("这位酋长,大月卡考虑一下?")
    elif up == 0:
        msg.append("据说天井的概率只有12.16%")
    elif up <= 2:
        if result['first_up_pos'] < 50:
            msg.append("你的喜悦我收到了,滚去喂鲨鱼吧!")
        elif result['first_up_pos'] < 100:
            msg.append("已经可以了,您已经很欧了")
        elif result['first_up_pos'] > 290:
            msg.append("标 准 结 局")
        elif result['first_up_pos'] > 250:
            msg.append("补井还是不补井,这是一个问题...")
        else:
            msg.append("期望之内,亚洲水平")
    elif up == 3:
        msg.append("抽井母五一气呵成!您就是欧洲人?")
    elif up >= 4:
        msg.append("记忆碎片一大堆!您是托吧?")
    await session.send('\n'.join(msg), at_sender=True)
    silence_time = (100 * up + 50 * s3 + 10 * s2 + s1) * 1
    if gid != 0:
        await silence(session.ctx, silence_time)
Exemple #19
0
async def _arena_query(bot, ev: CQEvent, region: int):

    arena.refresh_quick_key_dic()
    uid = ev.user_id

    if not lmt.check(uid):
        await bot.finish(ev, '您查询得过于频繁,请稍等片刻', at_sender=True)
    lmt.start_cd(uid)

    # 处理输入数据
    defen = ev.message.extract_plain_text()
    defen = re.sub(r'[??,,_]', '', defen)
    defen, unknown = chara.roster.parse_team(defen)

    if unknown:
        _, name, score = chara.guess_id(unknown)
        if score < 70 and not defen:
            return  # 忽略无关对话
        msg = f'无法识别"{unknown}"' if score < 70 else f'无法识别"{unknown}" 您说的有{score}%可能是{name}'
        await bot.finish(ev, msg)
    if not defen:
        await bot.finish(ev, '查询请发送"怎么拆+防守队伍",无需+号', at_sender=True)
    if len(defen) > 5:
        await bot.finish(ev, '编队不能多于5名角色', at_sender=True)
    if len(defen) < 5:
        await bot.finish(ev, '编队不能少于5名角色', at_sender=True)
    if len(defen) != len(set(defen)):
        await bot.finish(ev, '编队中含重复角色', at_sender=True)
    if any(chara.is_npc(i) for i in defen):
        await bot.finish(ev, '编队中含未实装角色', at_sender=True)
    if 1004 in defen:
        await bot.send(ev,
                       '\n⚠️您正在查询普通版炸弹人\n※万圣版可用万圣炸弹人/瓜炸等别称',
                       at_sender=True)

    defen.sort()

    # 执行查询
    # sv.logger.info('Doing query...')
    res = await arena.do_query(defen, uid, region)
    # sv.logger.info('Got response!')

    # 处理查询结果
    if isinstance(res, str):
        await bot.finish(ev, f'查询出错,{res}', at_sender=True)
    if not len(res):
        await bot.finish(
            ev,
            '抱歉没有查询到解法\n※没有作业说明随便拆 发挥你的想象力~★\n作业上传请前往pcrdfans.com',
            at_sender=True)
    res = res[:min(6, len(res))]  # 限制显示数量,截断结果

    atk_team = []
    absPath = "/root/HoshinoBot/hoshino/modules/priconne/arena"  # 这里是该hoshino模组的绝对路径
    font_path = f'{absPath}/font/seguiemj.ttf'
    for v in res:
        atk = v['atk']
        team_pic = chara.gen_team_pic(atk)
        up = v['up'] + v['my_up']
        down = v['down'] + v['my_down']
        qkey = v['qkey']
        pingjia = f'{qkey}\n\U0001F44D{up}\n\U0001F44E{down}'
        target = Image.new('RGBA', (64 * 6, 64), (255, 255, 255, 255))
        draw = ImageDraw.Draw(target)
        ttffont = ImageFont.truetype(font_path, 18)
        draw.text((64 * 5, 0), pingjia, font=ttffont, fill='#000000')
        target.paste(team_pic, (0, 0))
        atk_team.append(target)
    atk_team = concat_pic(atk_team)
    atk_team = pic2b64(atk_team)
    atk_team = str(MessageSegment.image(atk_team))

    defen = [chara.fromid(x).name for x in defen]
    defen = f"防守方【{' '.join(defen)}】"
    at = str(MessageSegment.at(ev.user_id))

    msg = [defen, f'已为骑士{at}查询到以下进攻方案:', str(atk_team), '※发送"点赞/点踩"可进行评价']
    if region == 1:
        msg.append('※使用"b怎么拆"或"台怎么拆"可按服过滤')
    msg.append('Support by pcrdfans_com')

    # sv.logger.debug('Arena sending result...')
    await bot.send(ev, '\n'.join(msg))
Exemple #20
0
async def _arena_query(session: CommandSession, region: int):

    refresh_quick_key_dic()
    uid = session.ctx['user_id']

    if not lmt.check(uid):
        session.finish('您查询得过于频繁,请稍等片刻', at_sender=True)
    lmt.start_cd(uid)

    # 处理输入数据
    argv = session.current_arg_text.strip()
    argv = re.sub(r'[??,,_]', '', argv)
    defen, unknown = Chara.parse_team(argv)

    if not defen:
        session.finish('请输入防守方角色', at_sender=True)
    if 5 < len(defen):
        session.finish('编队不能多于5名角色', at_sender=True)
    if len(defen) < 5:
        session.finish('由于pcrdfans.com的限制,编队必须为5个角色', at_sender=True)
    if len(defen) != len(set(defen)):
        await session.finish('编队中出现重复角色', at_sender=True)
    if 1004 in defen:
        await session.send('\n⚠️您正在查询普通版炸弹人\n※万圣版可用万圣炸弹人/瓜炸等别称',
                           at_sender=True)
    # 执行查询
    sv.logger.info('Doing query...')
    try:
        res = await do_query(defen, uid, region)
    except TypeError:
        session.finish('查询出错,请再次查询\n如果多次查询失败,请先移步pcrdfans.com进行查询,并可联系维护组',
                       at_sender=True)
    sv.logger.info('Got response!')

    # 处理查询结果
    if res == 117:
        session.finish('高峰期bot限流,请移步pcrdfans.com查询。', at_sender=True)
    if res is None:
        session.finish('查询出错,请再次查询\n如果多次查询失败,请先移步pcrdfans.com进行查询,并可联系维护组',
                       at_sender=True)
    if not len(res):
        session.finish('抱歉没有查询到解法\n※没有作业说明随便拆 发挥你的想象力~★\n作业上传请前往pcrdfans.com',
                       at_sender=True)
    res = res[:min(6, len(res))]  # 限制显示数量,截断结果

    # 发送回复

    sv.logger.info('Arena generating picture...')
    atk_team = [
        Chara.gen_team_pic(team=entry['atk'],
                           text="\n".join([
                               f"赞  {entry['up']}",
                               f"踩  {entry['down']}",
                           ])) for entry in res
    ]
    atk_team = concat_pic(atk_team)
    atk_team = pic2b64(atk_team)
    atk_team = str(MessageSegment.image(atk_team))
    sv.logger.info('Arena picture ready!')

    defen = [Chara.fromid(x).name for x in defen]
    defen = f"防守方【{' '.join(defen)}】"

    msg = [
        defen,
        str(atk_team),
    ]
    msg.append('Support by pcrdfans_com')
    sv.logger.debug('Arena sending result...')
    if unknown:
        await session.send(f'无法识别"{unknown}",请仅输入角色名规范查询')
    await session.send('\n'.join(msg), at_sender=1)
    sv.logger.debug('Arena result sent!')
Exemple #21
0
async def gacha_300(session:CommandSession):

    await check_tenjo_num(session)
    uid = session.ctx['user_id']
    tenjo_limit.increase(uid)

    gid=session.ctx['group_id']
    gacha = Gacha(_group_pool[gid])
    result = gacha.gacha_tenjou()
    up = len(result['up'])
    s3 = len(result['s3'])
    s2 = len(result['s2'])
    s1 = len(result['s1'])

    d1 = 0
    d2 = 0
    d3 = 0
    d4 = 0
    d5 = 0
    d6 = 0
    cardm1 = 0
    for i in range(30):
        if cardm1 < 145:
            card10 = cardram10()
            d1 = d1 + card10[0]
            d2 = d2 + card10[1]
            d3 = d3 + card10[2]
            d4 = d4 + card10[3]
            d5 = d5 + card10[4]
            d6 = d6 + card10[5]
            cardm1 = d1 * 40 + d2 * 20 + d3 * 5 + d4
            cardp = i + 1
            cardpsp = f',你在第{cardp}发十连获得可拼角色的碎片数量'
        else:
            card10 = cardram10()
            d1 = d1 + card10[0]
            d2 = d2 + card10[1]
            d3 = d3 + card10[2]
            d4 = d4 + card10[3]
            d5 = d5 + card10[4]
            d6 = d6 + card10[5]
            cardm1 = d1 * 40 + d2 * 20 + d3 * 5 + d4

    cardm2 = d1 * 5 + d2 * 5 + d3 + d4 + d5 + d6
    cardm3 = d1 * 5 + d2 * 3 + d3 * 3 + d4 * 2 + d5
    cardmax = f'累计获得一等{d1}次,二等{d2}次,三等{d3}次{cardpsp}\n获得角色碎片x{cardm1},母猪石x{cardm2},公主之心碎片x{cardm3}'

    res = [*(result['up']), *(result['s3'])]
    random.shuffle(res)
    lenth = len(res)
    if lenth <= 0:
        res = "竟...竟然没有3★?!"
    else:
        step = 4
        pics = []
        for i in range(0, lenth, step):
            j = min(lenth, i + step)
            pics.append(Chara.gen_team_pic(res[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)

    msg1 = [
        f"\n素敵な仲間が増えますよ! {res}\n{cardmax}"
    ]
    msg = [
        f"\n★★★×{up+s3} ★★×{s2} ★×{s1}",
        f"获得记忆碎片×{100*up}与女神秘石×{50*(up+s3) + 10*s2 + s1}!\n第{result['first_up_pos']}抽首次获得up角色" if up else f"获得女神秘石{50*(up+s3) + 10*s2 + s1}个!"
    ]

    if up == 0 and s3 == 0:
        msg.append("太惨了,咱们还是退款删游吧...")
    elif up == 0 and s3 > 7:
        msg.append("up呢?我的up呢?")
    elif up == 0 and s3 <= 3:
        msg.append("这位酋长,梦幻包考虑一下?")
    elif up == 0:
        msg.append("据说天井的概率只有12.16%")
    elif up <= 2:
        if result['first_up_pos'] < 50:
            msg.append("你的喜悦我收到了,滚去喂鲨鱼吧!")
        elif result['first_up_pos'] < 100:
            msg.append("已经可以了,您已经很欧了")
        elif result['first_up_pos'] > 290:
            msg.append("标 准 结 局")
        elif result['first_up_pos'] > 250:
            msg.append("补井还是不补井,这是一个问题...")
        else:
            msg.append("期望之内,亚洲水平")
    elif up == 3:
        msg.append("抽井母五一气呵成!多出30等专武~")
    elif up >= 4:
        msg.append("记忆碎片一大堆!您是托吧?")
    # msg.append(SWITCH_POOL_TIP)

    await session.send('\n'.join(msg1), at_sender=True)
    await session.send('\n'.join(msg), at_sender=True)
    silence_time = (100*up + 50*(up+s3) + 10*s2 + s1) * 1
    await silence(session.ctx, silence_time)
Exemple #22
0
async def gacha_300(session: CommandSession):
    if random.random() < 0.20:
        pic = R.img('gacha.jpg').cqcode
        await session.send(f'\n{pic}', at_sender=True)
        return

    await check_tenjo_num(session)
    uid = session.ctx['user_id']
    tenjo_limit.increase(uid)

    gid = str(session.ctx['group_id'])
    gacha = Gacha(_group_pool[gid])
    result = gacha.gacha_tenjou()
    up = len(result['up'])
    s3 = len(result['s3'])
    s2 = len(result['s2'])
    s1 = len(result['s1'])

    res = [*(result['up']), *(result['s3'])]
    random.shuffle(res)
    lenth = len(res)
    if lenth <= 0:
        res = "竟...竟然没有3★?!"
    else:
        step = 4
        pics = []
        for i in range(0, lenth, step):
            j = min(lenth, i + step)
            pics.append(Chara.gen_team_pic(res[i:j], star_slot_verbose=False))
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)

    msg = [
        f"\n素敵な仲間が増えますよ! {res}", f"★★★×{up+s3} ★★×{s2} ★×{s1}",
        f"获得记忆碎片×{100*up}与女神秘石×{50*(up+s3) + 10*s2 + s1}!\n第{result['first_up_pos']}抽首次获得up角色"
        if up else f"获得女神秘石{50*(up+s3) + 10*s2 + s1}个!"
    ]

    if up == 0 and s3 == 0:
        msg.append("太惨了,咱们还是退款删游吧...")
    elif up == 0 and s3 > 7:
        msg.append("up呢?我的up呢?")
    elif up == 0 and s3 <= 3:
        msg.append("这位酋长,梦幻包考虑一下?")
    elif up == 0:
        msg.append("据说天井的概率只有12.16%")
    elif up <= 2:
        if result['first_up_pos'] < 50:
            msg.append("你的喜悦我收到了,滚去喂鲨鱼吧!")
        elif result['first_up_pos'] < 100:
            msg.append("已经可以了,您已经很欧了")
        elif result['first_up_pos'] > 290:
            msg.append("标 准 结 局")
        elif result['first_up_pos'] > 250:
            msg.append("补井还是不补井,这是一个问题...")
        else:
            msg.append("期望之内,亚洲水平")
    elif up == 3:
        msg.append("抽井母五一气呵成!多出30等专武~")
    elif up >= 4:
        msg.append("记忆碎片一大堆!您是托吧?")
    msg.append(SWITCH_POOL_TIP)
    await session.send('\n'.join(msg), at_sender=True)
    silence_time = (100 * up + 50 * (up + s3) + 10 * s2 + s1) * 1
    await silence(session.ctx, silence_time)
Exemple #23
0
async def _arena_query(session:CommandSession, region:int):

    arena.refresh_quick_key_dic()
    uid = session.ctx['user_id']

    if not lmt.check(uid):
        session.finish('您查询得过于频繁,请稍等片刻', at_sender=True)
    lmt.start_cd(uid)

    # 处理输入数据
    argv = session.current_arg_text.strip()
    argv = re.sub(r'[??,,_]', ' ', argv)
    argv = argv.split()
    if 0 >= len(argv):
        session.finish('请输入防守方角色,用空格隔开', at_sender=True)
    if 5 < len(argv):
        session.finish('编队不能多于5名角色', at_sender=True)

    defen = [ Chara.name2id(name) for name in argv ]
    for i, id_ in enumerate(defen):
        if Chara.UNKNOWN == id_:
            await session.finish(f'编队中含未知角色"{argv[i]}",请尝试使用官方译名\n您可@bot来杯咖啡+反馈未收录别称\n或前往 github.com/Ice-Cirno/HoshinoBot/issues/5 回帖补充', at_sender=True)
    if len(defen) != len(set(defen)):
        await session.finish('编队中出现重复角色', at_sender=True)
    if 1004 in defen:
        await session.send('\n⚠️您正在查询普通版炸弹人\n※万圣版可用万圣炸弹人/瓜炸等别称', at_sender=True)

    # 执行查询
    sv.logger.info('Doing query...')
    res = await arena.do_query(defen, uid, region)
    sv.logger.info('Got response!')

    # 处理查询结果
    if res is None:
        session.finish('查询出错,请联系维护组调教\n请先移步pcrdfans.com进行查询', at_sender=True)
    if not len(res):
        session.finish('抱歉没有查询到解法\n※没有作业说明随便拆 发挥你的想象力~★\n作业上传请前往pcrdfans.com', at_sender=True)
    res = res[:min(6, len(res))]    # 限制显示数量,截断结果

    # 发送回复
    if get_bot().config.IS_CQPRO:
        sv.logger.info('Arena generating picture...')
        atk_team = [ Chara.gen_team_pic(entry['atk']) for entry in res ]
        atk_team = concat_pic(atk_team)
        atk_team = pic2b64(atk_team)
        atk_team = str(MessageSegment.image(atk_team))
        sv.logger.info('Arena picture ready!')
    else:
        atk_team = '\n'.join(map(lambda entry: ' '.join(map(lambda x: f"{x.name}{x.star if x.star else ''}{'专' if x.equip else ''}" , entry['atk'])) , res))

    details = [ " ".join([
        f"赞{e['up']}+{e['my_up']}" if e['my_up'] else f"赞{e['up']}",
        f"踩{e['down']}+{e['my_down']}" if e['my_down'] else f"踩{e['down']}",
        e['qkey']
    ]) for e in res ]

    defen = [ Chara.fromid(x).name for x in defen ]
    defen = f"防守方【{' '.join(defen)}】"
    at = str(MessageSegment.at(session.ctx["user_id"]))

    msg1 = [
        defen,
        f'已为骑士{at}查询到以下进攻方案:',
        f'{atk_team}Support by pcrdfans_com'
    ]
    msg2 = [
        f'为骑士{at}查询到作业评价👍&👎:', 
        *details,
        '※发送"点赞/点踩"可进行评价',
        '※手机QQ无法正常显示图片故分条发送 如有刷屏还请谅解',
    ]
    if region == 1:
        msg2.append('※使用"b怎么拆"或"台怎么拆"可按服过滤')

    sv.logger.debug('Arena sending result...')
    await session.send('\n'.join(msg1))
    await session.send('\n'.join(msg2))
    sv.logger.debug('Arena result sent!')
Exemple #24
0
async def _arena_query(session: CommandSession, region: int):

    arena.refresh_quick_key_dic()
    uid = session.ctx['user_id']
    now = time.time()

    if now - cd_time < _last_query_time[uid]:
        await session.finish('您查询得过于频繁,请稍等片刻', at_sender=True)
    _last_query_time[uid] = now

    # 处理输入数据
    argv = session.current_arg_text.strip()
    argv = re.sub(r'[??呀啊哇,,_]', ' ', argv)
    argv = argv.split()
    sv.logger.debug(f'竞技场查询:{argv}')

    if 0 >= len(argv):
        await session.finish('请输入防守方角色,用空格隔开')
    if 5 < len(argv):
        await session.finish('编队不能多于5名角色')

    # 执行查询
    defen = [Chara.name2id(name) for name in argv]
    for i, id_ in enumerate(defen):
        if Chara.UNKNOWN == id_:
            await session.finish(
                f'编队中含未知角色"{argv[i]}",请尝试使用官方译名\n您可@bot来杯咖啡+反馈未收录别称\n或前往 github.com/Ice-Cirno/HoshinoBot/issues/5 回帖补充'
            )
    if len(defen) != len(set(defen)):
        await session.finish('编队中出现重复角色')
    if 1004 in defen:
        await session.send('⚠️您正在查询普通版炸弹人\n※万圣版可用万圣炸弹人/瓜炸等别称')

    sv.logger.info('Arena doing query...')
    res = await arena.do_query(defen, uid, region)
    sv.logger.info('Arena got response!')

    # 处理查询结果
    if res is None:
        await session.finish('查询出错,请联系维护组调教\n请先移步pcrdfans.com进行查询')
    if not len(res):
        await session.finish('抱歉没有查询到解法\n※没有作业说明随便拆 发挥你的想象力~★')
    res = res[:min(6, len(res))]  # 限制显示数量,截断结果

    # 发送回复
    if get_bot().config.IS_CQPRO:
        sv.logger.info('Arena generating picture...')
        atk_team_pic = [Chara.gen_team_pic(entry['atk']) for entry in res]
        atk_team_pic = concat_pic(atk_team_pic)
        atk_team_pic = pic2b64(atk_team_pic)
        atk_team_pic = str(MessageSegment.image(atk_team_pic))
        sv.logger.info('Arena picture ready!')
    # else:
    atk_team_txt = '\n'.join(
        map(
            lambda entry: ' '.join(
                map(
                    lambda x:
                    f"{x.name}{x.star if x.star else ''}{'专' if x.equip else ''}",
                    entry['atk'])), res))

    details = [
        " ".join([
            f"赞{e['up']}+{e['my_up']}" if e['my_up'] else f"赞{e['up']}",
            f"踩{e['down']}+{e['my_down']}"
            if e['my_down'] else f"踩{e['down']}", e['qkey']
        ]) for e in res
    ]
    defen = [Chara.fromid(x).name for x in defen]
    defen = ' '.join(defen)
    defen = f'防守方【{defen}】'
    header = f'已为骑士君{MessageSegment.at(session.ctx["user_id"])}查询到以下进攻方案:'

    msg = [
        defen,
        header,
        atk_team_txt,  # atk_team_pic if get_bot().config.IS_CQPRO else atk_team_txt,
        '👍&👎:',
        *details,
        '发送"点赞/点踩+作业id"可进行评价,如"点赞 ABCDE" 不分大小写,空格隔开',
        '手机QQ更新后无法正常显示图片,故分条发送,如有刷屏还请谅解',
        'Support by pcrdfans_com'
    ]

    if region == 1:
        msg.append('【NEW】使用"b怎么拆"和"台怎么拆"可按服过滤')

    sv.logger.debug('Arena sending result...')
    await session.send('\n'.join(msg))
    if sv.bot.config.IS_CQPRO:
        await session.send(atk_team_pic, at_sender=True)
    sv.logger.debug('Arena result sent!')
Exemple #25
0
async def list_colle(bot, ev: CQEvent):
    if not priv.check_priv(ev, priv.SUPERUSER):
        await bot.finish(ev, '测试功能,仅限主人使用哦', at_sender=True)

    uid = str(ev.user_id)
    name = ev.sender['nickname']
    if not _colle_enable[uid]:
        await bot.finish(ev, f'{name}君你还没有开启仓库功能,请使用\"启用仓库\"开启功能')

    gm = GachaMaster(ev.user_id)
    try:
        db = gm.get_colle()
    except DatabaseError as e:
        await bot.finish(ev,
                         f'DatabaseError: {e.message}\nごめんなさい!嘤嘤嘤(〒︿〒)',
                         at_sender=True)
    if db:
        colle = pickle.loads(db['colle'])
        jewel = db['jewel']
        hiishi = db['hiishi']

        result = []
        pics = []
        collelen = len(colle)
        charalen = len(_pcr_data.CHARA_NAME) - 4

        if collelen <= 20:
            for k, v in colle.items():
                c = chara.fromname(k, v)
                result.append(c)

        else:
            for k, v in colle.items():
                if v >= 3:
                    c = chara.fromname(k, v)
                    result.append(c)

        if len(result):
            lenth = len(result)
            random.shuffle(result)
            for i in range(0, lenth, 5):
                j = min(lenth, i + 5)
                pics.append(
                    chara.gen_team_pic(result[i:j], star_slot_verbose=False))
            result = concat_pic(pics)
            result = pic2b64(result)
            result = MessageSegment.image(result)

            msg = [
                f"{name}君的仓库为", f"{result}", f"图鉴完成度:{collelen}/{charalen}",
                f"宝石:{jewel}, 女神的秘石:{hiishi}"
            ]
            await bot.send(ev, '\n'.join(msg))
        else:
            msg = [
                f"やばいですね☆, {name}君的仓库一个三星都没有", f"图鉴完成度:{collelen}/{charalen}",
                f"宝石:{jewel}, 女神的秘石:{hiishi}"
            ]
            await bot.send(ev, '\n'.join(msg))
    else:
        await bot.send(ev, f'{name}君你还没有仓库,请使用\"建立仓库\"进行初始化')
Exemple #26
0
def card_300(poolid="1"):
        
    uplist, nlist = get_pool_by_date(poolid)

    #fes池与普池概率确定
    poolinfo = pool_dict[poolid]
    pooltype = poolinfo[2]
    
    if pooltype=="ドリームフェスティバル":
        pup4 = 20
        pn4 = 40 + pup4 
        pup3 = 12 + pn4
        pn3 = 73 + pup3
        pup2 = 96 + pn3
        pn2 = 1000
    else:
        pup4 = 10
        pn4 = 20 + pup4 
        pup3 = 12 + pn4
        pn3 = 73 + pup3
        pup2 = 96 + pn3
        pn2 = 1000
        
    if uplist[2]==[]:
        pup4=0
    if uplist[1]==[]:
        pup3=pn4
    if uplist[0]==[]:
        pup2=pn3
    
    result = []
    upcount = 0
    count = 0
    first_up_pos = 999999

    for k in range(30):

        for i in range(9):
            ran = random.uniform(0, 1000)
            if ran <= pup4:
                result.append(random.choice(uplist[2]))
                upcount += 1
                count += 1
                first_up_pos = min(first_up_pos, 10 * k + i+1)
            elif ran <= pn4:
                result.append(random.choice(nlist[2]))
                count += 1
            else:
                pass

        ran = random.uniform(0, 1000)
        if ran <= pup4:
            result.append(random.choice(uplist[2]))
            upcount += 1
            count += 1
            first_up_pos = min(first_up_pos, 10 * (k + 1))
        elif ran <= pn4:
            result.append(random.choice(nlist[2]))
            count += 1
        else:
            pass
        
    lenth = len(result)

    if lenth <= 0:
        res = "竟...竟然没有4★?!"
    else:
        step = 3 if lenth <= 9 else 4
        pics=[]
        for i in range(0, lenth, step):
            size=180
            j = min(lenth, i + step)
            des = Image.new('RGBA', (step*size, size), (255, 255, 255, 255))
            for k, card in enumerate(result[i:j]):
                src = Image.open(os.path.join(picpath,"card",f"{card}_0.png"))
                des.paste(src, (k * size, 0))
            pics.append(des)
        res = concat_pic(pics)
        res = pic2b64(res)
        res = MessageSegment.image(res)
    
    return res, count, first_up_pos