Exemple #1
0
async def lssv(bot, ev: EventInterface):
    parser = ArgumentParser()
    parser.add_argument('-a', '--all', action='store_true')
    parser.add_argument('-i', '--invisible', action='store_true')
    parser.add_argument('-g', '--group', type=int, default=0)
    args = parser.parse_args(ev.get_param().remain)

    verbose_all = args.all
    only_hidden = args.invisible
    if ev.get_author_id() in bot.config.SUPER_USER:
        gid = args.group or ev.get_group_id()
        if not gid:
            await bot.send(ev, 'Usage: -g|--group <group_id> [-a|--all]')
            return
    else:
        gid = ev.get_group_id()

    msg = [f"群{gid}服务一览:"]
    svs = Service.get_loaded_services().values()
    svs = map(lambda sv: (sv, sv.check_enabled(gid)), svs)
    key = cmp_to_key(lambda x, y: (y[1] - x[1]) or (-1 if x[0].name < y[
        0].name else 1 if x[0].name > y[0].name else 0))
    svs = sorted(svs, key=key)
    for sv, on in svs:
        if verbose_all or (sv.visible ^ only_hidden):
            x = '○' if on else '×'
            msg.append(f"|{x}| {sv.name}")
    await bot.send(ev, '\n'.join(msg))
Exemple #2
0
async def set_pool(bot: KokkoroBot, ev: EventInterface):
    if not priv.check_priv(ev, priv.ADMIN):
        await bot.send(ev, '只有群管理才能切换卡池', at_sender=True)
        return
    name = util.normalize_str(param.remain)
    if not name:
        await bot.send(ev, POOL_NAME_TIP)
        return
    elif name in ('国', '国服', 'cn'):
        await bot.send(ev, '请选择以下卡池\n> 选择卡池 b服\n> 选择卡池 台服', at_sender=True)
        return
    elif name in ('b', 'b服', 'bl', 'bilibili'):
        name = 'BL'
    elif name in ('台', '台服', 'tw', 'sonet'):
        name = 'TW'
    elif name in ('日', '日服', 'jp', 'cy', 'cygames'):
        name = 'JP'
    elif name in ('混', '混合', 'mix'):
        name = 'MIX'
    else:
        await bot.send(ev, f'未知服务器地区 {POOL_NAME_TIP}', at_sender=True)
        return
    gid = str(ev.get_group_id())
    _group_pool[gid] = name
    dump_pool_config()
    await bot.send(ev, f'卡池已切换为{name}池', at_sender=True)
Exemple #3
0
async def gacha_10(bot: KokkoroBot, ev: EventInterface):
    SUPER_LUCKY_LINE = 170

    gid = str(ev.get_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.ENABLE_IMAGE:
        res1 = chara.gen_team_pic(result[:5], star_slot_verbose=False)
        res2 = chara.gen_team_pic(result[5:], star_slot_verbose=False)
        img = concat_pic([res1, res2])
        img = discord_adaptor.pil_image(img, filename="gacha10.png")
        await bot.send(ev, img)
        result = [f'{c.name}{"★"*c.star}' for c in result]
        res1 = ' '.join(result[0:5])
        res2 = ' '.join(result[5:])
        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}'

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

    gid = str(ev.get_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))
        img = concat_pic(pics)
        img = discord_adaptor.pil_image(img, filename="gacha300.png")
        await bot.send(ev, img)

    msg = [
        f"\n素敵な仲間が増えますよ!", 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("记忆碎片一大堆!您是托吧?")

    await bot.send(ev, '\n'.join(msg), at_sender=True)
    silence_time = ((100 * up + 50 * (up + s3)) / 3) * 1  #+ 10*s2 + s1) * 1
    if silence_time >= 5 * 60:
        await silence(ev, 5 * 60)
Exemple #5
0
async def gacha_info(bot: KokkoroBot, ev: EventInterface):
    gid = str(ev.get_group_id())
    gacha = Gacha(_group_pool[gid])
    up_chara = gacha.up
    if sv.bot.config.ENABLE_IMAGE:
        up_chara_imgs = map(lambda x: (chara.fromname(x, star=3).icon),
                            up_chara)
    for img in up_chara_imgs:
        await bot.send(ev, img)
    await bot.send(
        ev,
        f"本期卡池主打的角色:\n{up_chara}\nUP角色合计={(gacha.up_prob/10):.1f}% 3★出率={(gacha.s3_prob)/10:.1f}%"
    )
Exemple #6
0
async def gacha_1(bot: KokkoroBot, ev: EventInterface):
    gid = str(ev.get_group_id())
    gacha = Gacha(_group_pool[gid])
    chara, hiishi = gacha.gacha_one(gacha.up_prob, gacha.s3_prob,
                                    gacha.s2_prob)
    #silence_time = hiishi * 60

    res = f'{chara.name} {"★"*chara.star}'
    if sv.bot.config.ENABLE_IMAGE:
        img = chara.icon
        await bot.send(ev, img)
    if chara.star == 3:
        await silence(ev, 60)
    await bot.send(ev, f'素敵な仲間が増えますよ!\n{res}', at_sender=True)
Exemple #7
0
 def _check_all(self, ev: EventInterface):
     gid = ev.get_group_id()
     return self.check_enabled(gid) and not priv.check_block_group(gid) and priv.check_priv(ev, self.use_priv)