コード例 #1
0
ファイル: main.py プロジェクト: fengshuofenlgi/djc_helper
def try_take_xinyue_team_award(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("尝试领取心悦组队奖励")

    # 所有账号运行完毕后,尝试领取一次心悦组队奖励,避免出现前面角色还没完成,后面的完成了,前面的却没领奖励
    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.info("")
        logger.warning(
            color("fg_bold_green") +
            "------------开始尝试为第{}个账户({})领取心悦组队奖励------------".format(
                idx, account_config.name))

        if len(account_config.xinyue_operations) == 0:
            logger.warning("未设置心悦相关操作信息,将跳过")
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        xinyue_info = djcHelper.query_xinyue_info("获取心悦信息", print_res=False)

        op_cfgs = [("513818", "查询小队信息"), ("514385", "领取组队奖励")]

        xinyue_operations = []
        for opcfg in op_cfgs:
            op = XinYueOperationConfig()
            op.iFlowId, op.sFlowName = opcfg
            op.count = 1
            xinyue_operations.append(op)

        for op in xinyue_operations:
            djcHelper.do_xinyue_op(xinyue_info.xytype, op)

        if cfg.common._debug_run_first_only:
            logger.warning("调试开关打开,不再处理后续账户")
            break
コード例 #2
0
ファイル: main.py プロジェクト: fengshuofenlgi/djc_helper
def check_djc_role_binding():
    load_config("config.toml", "config.toml.local")
    cfg = config()

    if not has_any_account_in_normal_run(cfg):
        logger.warning("未发现任何有效的账户配置,请检查配置文件")
        os.system("PAUSE")
        exit(-1)

    _show_head_line("启动时检查各账号是否在道聚城绑定了dnf账号和任意手游账号")

    while True:
        all_binded = True

        for _idx, account_config in enumerate(cfg.account_configs):
            idx = _idx + 1
            if not account_config.is_enabled():
                # 未启用的账户的账户不走该流程
                continue

            logger.warning(
                color("fg_bold_yellow") +
                "------------检查第{}个账户({})------------".format(
                    idx, account_config.name))
            djcHelper = DjcHelper(account_config, cfg.common)
            if not djcHelper.check_djc_role_binding():
                all_binded = False

        if all_binded:
            break
        else:
            logger.warning(
                color("fg_bold_yellow") +
                "请前往道聚城将上述提示的未绑定dnf或任意手游的账号进行绑定,具体操作流程可以参考使用文档或者教学视频。")
            logger.warning(color("fg_bold_cyan") + "操作完成后点击任意键即可再次进行检查流程...")
            os.system("PAUSE")

            # 这时候重新读取一遍用户修改过后的配置文件(比如把手游设为了 无 )
            load_config("config.toml", "config.toml.local")
            cfg = config()
コード例 #3
0
ファイル: main.py プロジェクト: fengshuofenlgi/djc_helper
def try_join_xinyue_team(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("尝试加入心悦固定队")

    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.info("")
        logger.warning(
            color("fg_bold_yellow") +
            "------------尝试第{}个账户({})------------".format(
                idx, account_config.name))

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        # 尝试加入固定心悦队伍
        djcHelper.try_join_fixed_xinyue_team()

        if cfg.common._debug_run_first_only:
            logger.warning("调试开关打开,不再处理后续账户")
            break
コード例 #4
0
def check_djc_role_binding():
    load_config("config.toml", "config.toml.local")
    cfg = config()

    if not has_any_account_in_normal_run(cfg):
        logger.warning("未发现任何有效的账户配置,请检查配置文件")
        os.system("PAUSE")
        exit(-1)

    _show_head_line("启动时检查各账号是否在道聚城绑定了dnf账号和任意手游账号")

    while True:
        all_binded = True
        not_binded_accounts = []

        for _idx, account_config in enumerate(cfg.account_configs):
            idx = _idx + 1
            if not account_config.is_enabled():
                # 未启用的账户的账户不走该流程
                continue

            logger.warning(color("fg_bold_yellow") + f"------------检查第{idx}个账户({account_config.name})------------")
            djcHelper = DjcHelper(account_config, cfg.common)
            if not djcHelper.check_djc_role_binding():
                all_binded = False
                not_binded_accounts.append(account_config.name)

        if all_binded:
            break
        else:
            logger.warning(color("yellow") + f"请前往道聚城将上述提示的未绑定dnf或任意手游的账号【{not_binded_accounts}】进行绑定,具体操作流程可以参考使用文档或者教学视频。")
            logger.warning(color("green") + "如果本账号不需要道聚城相关操作,可以打开配置表,将该账号的cannot_bind_dnf设为true,game_name设为无,即可跳过道聚城相关操作")
            logger.warning(color("green") + "  ps: 上面这个cannot_bind_dnf之前笔误写成了cannot_band_dnf,如果之前填过,请手动把配置名称改成cannot_bind_dnf~")
            logger.warning(color("fg_bold_cyan") + "操作完成后点击任意键即可再次进行检查流程...")
            os.system("PAUSE")

            # 这时候重新读取一遍用户修改过后的配置文件(比如把手游设为了 无 )
            load_config("config.toml", "config.toml.local")
            cfg = config()
コード例 #5
0
def check_all_skey_and_pskey(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("启动时检查各账号skey/pskey/openid是否过期")

    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.warning(color("fg_bold_yellow") + "------------检查第{}个账户({})------------".format(idx, account_config.name))
        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)
        djcHelper.fetch_pskey()
コード例 #6
0
ファイル: main_def.py プロジェクト: loveisaxin/djc_helper
def show_accounts_status(cfg, ctx):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line(ctx)

    heads = ["序号", "账号名", "启用状态", "聚豆余额", "聚豆历史总数", "成就点", "心悦组队", "闪光杯出货数"]
    colSizes = [4, 12, 8, 8, 12, 6, 8, 12]

    logger.info(tableify(heads, colSizes))
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()

        status = "启用" if account_config.is_enabled() else "未启用"

        djc_info = djcHelper.query_balance("查询聚豆概览", print_res=False)["data"]
        djc_allin, djc_balance = int(djc_info['allin']), int(
            djc_info['balance'])

        xinyue_info = djcHelper.query_xinyue_info("查询心悦成就点概览", print_res=False)
        teaminfo = djcHelper.query_xinyue_teaminfo(print_res=False)
        team_score = "无队伍"
        if teaminfo.id != "":
            team_score = "{}/20".format(teaminfo.score)
            fixed_team = djcHelper.get_fixed_team()
            if fixed_team is not None:
                team_score = "[{}]{}".format(fixed_team.id, team_score)

        shanguang_equip_count = djcHelper.query_dnf_shanguang_equip_count(
            print_warning=False)

        cols = [
            idx, account_config.name, status, djc_balance, djc_allin,
            xinyue_info.score, team_score, shanguang_equip_count
        ]

        logger.info(color("fg_bold_green") + tableify(cols, colSizes))
コード例 #7
0
ファイル: main_def.py プロジェクト: yang512117616/djc_helper
def try_take_xinyue_team_award(cfg: Config):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("尝试领取心悦组队奖励")

    # 所有账号运行完毕后,尝试领取一次心悦组队奖励,避免出现前面角色还没完成,后面的完成了,前面的却没领奖励
    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.info("")
        logger.warning(
            color("fg_bold_green") +
            f"------------开始尝试为第{idx}个账户({account_config.name})领取心悦组队奖励------------"
        )

        if not account_config.function_switches.get_xinyue:
            logger.warning("未启用领取心悦特权专区功能,将跳过")
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.xinyue_battle_ground_op("领取默契奖励点", "749229")
コード例 #8
0
def query_account_ark_lottery_info(idx: int, total_account: int, account_config: AccountConfig, common_config: CommonConfig) -> (Dict[str, int], Dict[str, int], DjcHelper):
    djcHelper = DjcHelper(account_config, common_config)
    lr = djcHelper.fetch_pskey()
    if lr is None:
        return
    djcHelper.check_skey_expired()
    djcHelper.get_bind_role_list(print_warning=False)

    qa = QzoneActivity(djcHelper, lr)

    card_name_to_counts = qa.get_card_counts()
    prize_counts = qa.get_prize_counts()

    logger.info(f"{idx:2d}/{total_account} 账号 {padLeftRight(account_config.name, 12)} 的数据拉取完毕")

    return card_name_to_counts, prize_counts, djcHelper
コード例 #9
0
def try_join_xinyue_team(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("尝试加入心悦固定队")

    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.info("")
        logger.warning(color("fg_bold_yellow") + f"------------尝试第{idx}个账户({account_config.name})------------")

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        # 尝试加入固定心悦队伍
        djcHelper.try_join_fixed_xinyue_team()
コード例 #10
0
def try_xinyue_sailiyam_start_work(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("尝试派赛利亚出去打工")

    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.info("")
        logger.warning(color("fg_bold_green") + "------------开始尝试派第{}个账户({})的赛利亚出去打工------------".format(idx, account_config.name))

        djcHelper = DjcHelper(account_config, cfg.common)
        if account_config.function_switches.get_xinyue_sailiyam:
            djcHelper.xinyue_sailiyam_op("出去打工", "714255")
        logger.info(color("fg_bold_cyan") + djcHelper.get_xinyue_sailiyam_workinfo())
        logger.info(color("fg_bold_cyan") + djcHelper.get_xinyue_sailiyam_status())
コード例 #11
0
def auto_send_cards(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("运行完毕自动赠送卡片")

    target_qqs = cfg.common.auto_send_card_target_qqs
    if len(target_qqs) == 0:
        logger.warning("未定义自动赠送卡片的对象QQ数组,将跳过本阶段")
        return

    # 统计各账号卡片数目
    logger.info("拉取各账号的卡片数据中,请耐心等待...")
    qq_to_card_name_to_counts = {}
    qq_to_prize_counts = {}
    qq_to_djcHelper = {}
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        lr = djcHelper.fetch_pskey()
        if lr is None:
            continue
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)

        qq = uin2qq(lr.uin)
        qa = QzoneActivity(djcHelper, lr)

        qq_to_card_name_to_counts[qq] = qa.get_card_counts()
        qq_to_prize_counts[qq] = qa.get_prize_counts()
        qq_to_djcHelper[qq] = djcHelper

        logger.info(
            f"{idx:2d}/{len(cfg.account_configs)} 账号 {padLeftRight(account_config.name, 12)} 的数据拉取完毕"
        )

    # 赠送卡片
    for idx, target_qq in enumerate(target_qqs):
        if target_qq in qq_to_djcHelper:
            left_times = qq_to_djcHelper[
                target_qq].ark_lottery_query_left_times(target_qq)
            name = qq_to_djcHelper[target_qq].cfg.name
            logger.warning(
                color("fg_bold_green") +
                f"第{idx + 1}/{len(target_qqs)}个赠送目标账号 {name}({target_qq}) 今日仍可被赠送 {left_times} 次卡片"
            )
            # 最多赠送目标账号今日仍可接收的卡片数
            for i in range(left_times):
                send_card(target_qq, qq_to_card_name_to_counts,
                          qq_to_prize_counts, qq_to_djcHelper, target_qqs)

            # 赠送卡片完毕后尝试领取奖励和抽奖
            djcHelper = qq_to_djcHelper[target_qq]
            lr = djcHelper.fetch_pskey()
            if lr is not None:
                logger.info("赠送完毕,尝试领取奖励和抽奖")
                qa = QzoneActivity(djcHelper, lr)
                qa.take_ark_lottery_awards(print_warning=False)
                qa.try_lottery_using_cards(print_warning=False)
コード例 #12
0
def show_lottery_status(ctx, cfg, need_show_tips=False):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line(ctx)

    logger.info(get_not_ams_act_desc("集卡"))

    lottery_zzconfig = zzconfig()
    card_info_map = parse_card_group_info_map(lottery_zzconfig)
    order_map = {}
    # 卡片编码 => 名称
    for name, card_info in card_info_map.items():
        order_map[card_info.index] = name

    # 奖励展示名称 => 实际名称
    groups = [
        lottery_zzconfig.prizeGroups.group1,
        lottery_zzconfig.prizeGroups.group2,
        lottery_zzconfig.prizeGroups.group3,
        lottery_zzconfig.prizeGroups.group4,
    ]
    prizeDisplayTitles = []
    for group in groups:
        displayTitle = group.title
        if len(displayTitle) > 4 and "礼包" in displayTitle:
            # 将 全民竞速礼包 这种名称替换为 全民竞速
            displayTitle = displayTitle.replace("礼包", "")

        order_map[displayTitle] = group.title
        prizeDisplayTitles.append(displayTitle)

    heads = []
    colSizes = []

    baseHeads = ["序号", "账号名"]
    baseColSizes = [4, 12]
    heads.extend(baseHeads)
    colSizes.extend(baseColSizes)

    card_indexes = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "2-4", "3-1", "3-2", "3-3", "3-4"]
    card_width = 3
    heads.extend(card_indexes)
    colSizes.extend([card_width for i in card_indexes])

    prize_indexes = [*prizeDisplayTitles]
    heads.extend(prize_indexes)
    colSizes.extend([printed_width(name) for name in prize_indexes])

    accounts_that_should_enable_cost_card_to_lottery = []

    logger.info(tableify(heads, colSizes))
    summaryCols = [1, "总计", *[0 for card in card_indexes], *[count_with_color(0, "bold_green", show_width=printed_width(prize_index)) for prize_index in prize_indexes]]
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        if not account_config.ark_lottery.show_status:
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        lr = djcHelper.fetch_pskey()
        if lr is None:
            continue
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)

        qa = QzoneActivity(djcHelper, lr)

        card_counts = qa.get_card_counts()
        prize_counts = qa.get_prize_counts()

        summaryCols[0] += 1

        cols = [idx, account_config.name]
        has_any_card = False
        has_any_left_gift = False
        # 处理各个卡片数目
        for card_position, card_index in enumerate(card_indexes):
            card_count = card_counts[order_map[card_index]]

            cols.append(colored_count(idx, card_count, account_config.ark_lottery.show_color))

            # 更新统计信息
            summaryCols[len(baseHeads) + card_position] += card_count

            if card_count > 0:
                has_any_card = True

        # 处理各个奖励剩余领取次数
        for prize_index in prize_indexes:
            prize_count = prize_counts[order_map[prize_index]]
            cols.append(count_with_color(prize_count, "bold_green", show_width=printed_width(prize_index)))

            if prize_count > 0:
                has_any_left_gift = True

        logger.info(tableify(cols, colSizes))

        if has_any_card and not has_any_left_gift:
            accounts_that_should_enable_cost_card_to_lottery.append(account_config.name)

    for cardIdx in range(len(card_indexes)):
        idx = len(baseHeads) + cardIdx
        summaryCols[idx] = colored_count(len(cfg.account_configs), summaryCols[idx], cfg.common.ark_lottery_summary_show_color or "fg_thin_cyan")

    logger.info(tableify(summaryCols, colSizes))

    if need_show_tips and len(accounts_that_should_enable_cost_card_to_lottery) > 0:
        accounts = ', '.join(accounts_that_should_enable_cost_card_to_lottery)
        msg = f"账户({accounts})仍有剩余卡片,但已无任何可领取礼包,建议开启消耗卡片来抽奖的功能"
        logger.warning(color("fg_bold_yellow") + msg)
コード例 #13
0
ファイル: sell_cards.py プロジェクト: loveisaxin/djc_helper
from util import show_head_line

if __name__ == '__main__':
    # 读取配置信息
    load_config("config.toml", "config.toml.local")
    cfg = config()

    # 12.30 送卡片次数(re:好像送给别人没有上限?)
    indexes = [4]

    for idx in indexes:  # 从1开始,第i个
        account_config = cfg.account_configs[idx - 1]
        show_head_line("开始处理第{}个账户[{}]".format(idx, account_config.name),
                       color("fg_bold_yellow"))

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list()

        lr = djcHelper.fetch_pskey()

        # re: 先填QQ
        # undone: 然后填写卡片
        targetQQ = "XXXXXXXXXXX"
        cards_to_send = [
            ("XXXXXXXXXXX", 1),
            ("XXXXXXXXXXX", 1),
            ("XXXXXXXXXXX", 1),
            ("XXXXXXXXXXX", 1),
        ]
        for name, count in cards_to_send:
コード例 #14
0
def auto_send_cards(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("运行完毕自动赠送卡片")

    target_qqs = cfg.common.auto_send_card_target_qqs
    if len(target_qqs) == 0:
        logger.warning("未定义自动赠送卡片的对象QQ数组,将跳过本阶段")
        return

    increase_counter("/misc/auto_send_cards")

    # 统计各账号卡片数目
    logger.info("拉取各账号的卡片数据中,请耐心等待...")
    qq_to_card_name_to_counts = {}
    qq_to_prize_counts = {}
    qq_to_djcHelper = {}
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)

        lr = djcHelper.fetch_pskey()
        if lr is None:
            continue

        qq = uin2qq(lr.uin)
        al = ArkLottery(djcHelper, lr)

        qq_to_card_name_to_counts[qq] = al.get_card_counts()
        qq_to_prize_counts[qq] = al.get_prize_counts()
        qq_to_djcHelper[qq] = djcHelper

        logger.info("{}/{} 账号 {:} 的数据拉取完毕".format(
            idx, len(cfg.account_configs),
            padLeftRight(account_config.name, 12)))

    # 赠送卡片
    for target_qq in target_qqs:
        if target_qq in qq_to_djcHelper:
            left_times = qq_to_djcHelper[
                target_qq].ark_lottery_query_left_times(target_qq)
            logger.warning(
                color("fg_bold_green") + "账号 {}({}) 今日仍可被赠送 {} 次卡片".format(
                    qq_to_djcHelper[target_qq].cfg.name, target_qq, left_times)
            )
            # 最多赠送目标账号今日仍可接收的卡片数
            for i in range(left_times):
                send_card(target_qq, qq_to_card_name_to_counts,
                          qq_to_prize_counts, qq_to_djcHelper)

            # 赠送卡片完毕后尝试抽奖
            djcHelper = qq_to_djcHelper[target_qq]
            lr = djcHelper.fetch_pskey()
            if lr is not None:
                al = ArkLottery(djcHelper, lr)
                al.try_lottery_using_cards(print_warning=False)
コード例 #15
0
def show_lottery_status(ctx, cfg, need_show_tips=False):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line(ctx)

    order_map = {
        "1-1": "多人配合新挑战",
        "1-2": "丰富机制闯难关",
        "1-3": "新剧情视听盛宴",
        "1-4": "单人成团战不停",
        "2-1": "回归奖励大升级",
        "2-2": "秒升Lv96刷深渊",
        "2-3": "灿烂自选回归领",
        "2-4": "告别酱油变大佬",
        "3-1": "单人爽刷新玩法",
        "3-2": "独立成团打副本",
        "3-3": "海量福利金秋享",
        "3-4": "超强奖励等你拿",
        "全新团本": "勇士归来礼包",
        "超低门槛": "超低门槛",
        "人人可玩": "人人可玩",
        "幸运礼包": "幸运礼包",
    }

    heads = ["序号", "账号名"]
    colSizes = [4, 12]

    card_indexes = [
        "1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "2-4", "3-1", "3-2",
        "3-3", "3-4"
    ]
    card_width = 3
    heads.extend(card_indexes)
    colSizes.extend([card_width for i in card_indexes])

    prize_indexes = ["全新团本", "超低门槛", "人人可玩", "幸运礼包"]
    heads.extend(prize_indexes)
    colSizes.extend([printed_width(name) for name in prize_indexes])

    accounts_that_should_enable_cost_card_to_lottery = []

    logger.info(tableify(heads, colSizes))
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        if not account_config.ark_lottery.show_status:
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)

        lr = djcHelper.fetch_pskey()
        if lr is None:
            continue

        al = ArkLottery(djcHelper, lr)

        card_counts = al.get_card_counts()
        prize_counts = al.get_prize_counts()

        cols = [idx, account_config.name]
        has_any_card = False
        has_any_left_gift = False
        # 处理各个卡片数目
        for card_index in card_indexes:
            card_count = card_counts[order_map[card_index]]

            show_count = card_count
            # 特殊处理色彩
            if card_count == 0:
                if idx == 1:
                    # 突出显示大号没有的卡片
                    show_count = color("fg_bold_cyan") + padLeftRight(
                        card_count, 3) + color("INFO")
                else:
                    # 小号没有的卡片直接不显示,避免信息干扰
                    show_count = ""
            else:
                if idx == 1:
                    if card_count == 1:
                        # 大号只有一张的卡片也特殊处理
                        show_count = color("fg_bold_blue") + padLeftRight(
                            card_count, 3) + color("INFO")
                    else:
                        # 大号其余卡片亮绿色
                        show_count = color("fg_bold_green") + padLeftRight(
                            card_count, 3) + color("INFO")
                else:
                    # 小号拥有的卡片淡化处理,方便辨识
                    show_color = account_config.ark_lottery.show_color or "fg_bold_black"
                    show_count = color(show_color) + padLeftRight(
                        card_count, 3) + color("INFO")

            cols.append(show_count)

            if card_count > 0:
                has_any_card = True

        # 处理各个奖励剩余领取次数
        for prize_index in prize_indexes:
            prize_count = prize_counts[order_map[prize_index]]
            cols.append(prize_count)

            if prize_count > 0:
                has_any_left_gift = True

        logger.info(tableify(cols, colSizes))

        if has_any_card and not has_any_left_gift:
            accounts_that_should_enable_cost_card_to_lottery.append(
                account_config.name)

    if need_show_tips and len(
            accounts_that_should_enable_cost_card_to_lottery) > 0:
        msg = "账户({})仍有剩余卡片,但已无任何可领取礼包,建议开启消耗卡片来抽奖的功能".format(
            ', '.join(accounts_that_should_enable_cost_card_to_lottery))
        logger.warning(color("fg_bold_yellow") + msg)
コード例 #16
0
ファイル: main_def.py プロジェクト: daimmon/djc_helper
def show_accounts_status(cfg, ctx):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line(ctx)

    heads = ["序号", "账号名", "启用状态", "聚豆余额", "聚豆历史总数", "成就点", "心悦组队", "闪光杯出货数", "赛丽亚卡片", "爆竹积分"]
    colSizes = [4, 12, 8, 8, 12, 6, 8, 12, 14, 8]

    logger.info(tableify(heads, colSizes))
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()

        status = "启用" if account_config.is_enabled() else "未启用"

        djc_info = djcHelper.query_balance("查询聚豆概览", print_res=False)["data"]
        djc_allin, djc_balance = int(djc_info['allin']), int(djc_info['balance'])

        xinyue_info = djcHelper.query_xinyue_info("查询心悦成就点概览", print_res=False)
        teaminfo = djcHelper.query_xinyue_teaminfo(print_res=False)
        team_score = "无队伍"
        if teaminfo.id != "":
            team_score = f"{teaminfo.score}/20"
            fixed_team = djcHelper.get_fixed_team()
            if fixed_team is not None:
                team_score = f"[{fixed_team.id}]{team_score}"

        shanguang_equip_count = djcHelper.query_dnf_shanguang_equip_count(print_warning=False)

        sailiya_cards = djcHelper.query_majieluo_card_info()

        firecrackers_points = djcHelper.query_firecrackers_points()

        cols = [idx, account_config.name, status, djc_balance, djc_allin, xinyue_info.score, team_score, shanguang_equip_count, sailiya_cards, firecrackers_points]
        logger.info(color("fg_bold_green") + tableify(cols, colSizes, need_truncate=True))

    logger.info("")
    _show_head_line("付费相关信息")
    user_buy_info = get_user_buy_info(cfg)
    show_buy_info(user_buy_info)
コード例 #17
0
ファイル: main_def.py プロジェクト: daimmon/djc_helper
def show_lottery_status(ctx, cfg, need_show_tips=False):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line(ctx)

    show_end_time("2021-02-28 23:59:59")

    lottery_zzconfig = zzconfig()
    card_info_map = parse_card_group_info_map(lottery_zzconfig)
    order_map = {}
    # 卡片编码 => 名称
    for name, card_info in card_info_map.items():
        order_map[card_info.index] = name

    # 奖励展示名称 => 实际名称
    groups = [
        lottery_zzconfig.prizeGroups.group1,
        lottery_zzconfig.prizeGroups.group2,
        lottery_zzconfig.prizeGroups.group3,
        lottery_zzconfig.prizeGroups.group4,
    ]
    prizeDisplayTitles = []
    for group in groups:
        displayTitle = group.title
        if len(displayTitle) > 4 and "礼包" in displayTitle:
            # 将 全民竞速礼包 这种名称替换为 全民竞速
            displayTitle = displayTitle.replace("礼包", "")

        order_map[displayTitle] = group.title
        prizeDisplayTitles.append(displayTitle)

    heads = []
    colSizes = []

    baseHeads = ["序号", "账号名"]
    baseColSizes = [4, 12]
    heads.extend(baseHeads)
    colSizes.extend(baseColSizes)

    card_indexes = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "2-4", "3-1", "3-2", "3-3", "3-4"]
    card_width = 3
    heads.extend(card_indexes)
    colSizes.extend([card_width for i in card_indexes])

    prize_indexes = [*prizeDisplayTitles]
    heads.extend(prize_indexes)
    colSizes.extend([printed_width(name) for name in prize_indexes])

    accounts_that_should_enable_cost_card_to_lottery = []

    logger.info(tableify(heads, colSizes))
    summaryCols = [1, "总计", *[0 for card in card_indexes], *[count_with_color(0, "bold_green", show_width=printed_width(prize_index)) for prize_index in prize_indexes]]
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        if not account_config.ark_lottery.show_status:
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        lr = djcHelper.fetch_pskey()
        if lr is None:
            continue
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)

        qa = QzoneActivity(djcHelper, lr)

        card_counts = qa.get_card_counts()
        prize_counts = qa.get_prize_counts()

        summaryCols[0] += 1

        cols = [idx, account_config.name]
        has_any_card = False
        has_any_left_gift = False
        # 处理各个卡片数目
        for card_position, card_index in enumerate(card_indexes):
            card_count = card_counts[order_map[card_index]]

            cols.append(colored_count(idx, card_count, account_config.ark_lottery.show_color))

            # 更新统计信息
            summaryCols[len(baseHeads) + card_position] += card_count

            if card_count > 0:
                has_any_card = True

        # 处理各个奖励剩余领取次数
        for prize_index in prize_indexes:
            prize_count = prize_counts[order_map[prize_index]]
            cols.append(count_with_color(prize_count, "bold_green", show_width=printed_width(prize_index)))

            if prize_count > 0:
                has_any_left_gift = True

        logger.info(tableify(cols, colSizes))

        if has_any_card and not has_any_left_gift:
            accounts_that_should_enable_cost_card_to_lottery.append(account_config.name)

    for cardIdx in range(len(card_indexes)):
        idx = len(baseHeads) + cardIdx
        summaryCols[idx] = colored_count(len(cfg.account_configs), summaryCols[idx], cfg.common.ark_lottery_summary_show_color or "fg_thin_cyan")

    logger.info(tableify(summaryCols, colSizes))

    if need_show_tips and len(accounts_that_should_enable_cost_card_to_lottery) > 0:
        accounts = ', '.join(accounts_that_should_enable_cost_card_to_lottery)
        msg = f"账户({accounts})仍有剩余卡片,但已无任何可领取礼包,建议开启消耗卡片来抽奖的功能"
        logger.warning(color("fg_bold_yellow") + msg)

    if not os.path.exists("DNF蚊子腿小助手_集卡特别版.exe"):
        logger.warning(color("bold_cyan") + (
            "以下为广告时间0-0\n"
            "如果只需要集卡功能,可以联系我购买集卡特别版哦,特别版仅包含集卡相关功能(集卡、送卡、展示卡片信息、兑换卡片奖励、使用卡片抽奖),供某些只需要集卡的朋友使用\n"
            "演示地址:https://www.bilibili.com/video/BV1zA411H7mP\n"
            "价格:6.66元\n"
            "购买方式:加小助手群后QQ私聊我付款截图,我确认无误后会将DLC以及用法发给你,并拉到一个无法主动加入的专用群,通过群文件分发该DLC的后续更新版本~\n"
            "PS:这个DLC相当于是小助手的子集,用于仅处理集卡相关内容,之前听到有的朋友有这样的需求,所以特地制作的,是否购买自行考量哈。\n"
            "如果购买的话能鼓励我花更多时间来维护小助手,支持新的蚊子腿以及优化使用体验(o゚▽゚)o  \n"
            "\n"
            "2021.2.2 update: 本轮集卡我又换完啦,有需要买卡的朋友可以加群私聊我购买哦~依旧是一元一张任意卡。先问下有没有卡,得到确定回复后直接发付款截图和要收卡片的QQ号码即可(不需要加好友)"
        ))
コード例 #18
0
def show_accounts_status(cfg, ctx):
    logger.info("")
    _show_head_line("部分活动信息")
    logger.warning("如果一直卡在这一步,请在小助手目录下创建一个空文件:不查询活动.txt")
    Urls().show_current_valid_act_infos()

    logger.info("")
    _show_head_line("付费相关信息")
    user_buy_info = get_user_buy_info(cfg)
    show_buy_info(user_buy_info)

    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line(ctx)

    heads = ["序号", "账号名", "启用状态", "聚豆余额", "聚豆历史总数", "成就点", "心悦组队", "心悦G分", "编年史", "年史碎片", "守护者卡片", "马杰洛石头"]
    colSizes = [4, 12, 8, 8, 12, 6, 8, 8, 14, 8, 15, 10]

    logger.info(tableify(heads, colSizes))
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list(print_warning=False)

        status = "启用" if account_config.is_enabled() else "未启用"

        djc_info = djcHelper.query_balance("查询聚豆概览", print_res=False)["data"]
        djc_allin, djc_balance = int(djc_info['allin']), int(djc_info['balance'])

        xinyue_info = djcHelper.query_xinyue_info("查询心悦成就点概览", print_res=False)
        teaminfo = djcHelper.query_xinyue_teaminfo(print_res=False)
        team_score = "无队伍"
        if teaminfo.id != "":
            team_score = f"{teaminfo.score}/20"
            fixed_team = djcHelper.get_fixed_team()
            if fixed_team is not None:
                team_score = f"[{fixed_team.id}]{team_score}"

        gpoints = djcHelper.query_gpoints()

        ui = djcHelper.query_dnf_helper_chronicle_info()
        levelInfo = f"LV{ui.level}({ui.currentExp}/{ui.levelExp})"
        chronicle_points = ui.point
        if ui.totalExp == 0:
            levelInfo = ""
            chronicle_points = ""

        majieluo_cards = djcHelper.query_majieluo_card_info()

        stone_count = djcHelper.query_stone_count()

        cols = [idx, account_config.name, status, djc_balance, djc_allin, xinyue_info.score, team_score, gpoints, levelInfo, chronicle_points, majieluo_cards, stone_count]
        logger.info(color("fg_bold_green") + tableify(cols, colSizes, need_truncate=True))
コード例 #19
0
ファイル: main.py プロジェクト: 915646637/djc_helper
    for _idx, account_config in enumerate(cfg.account_configs):
        idx = _idx + 1
        status = "启用" if account_config.enable else "未启用"
        logger.info("{}\t{}\t{}".format(idx, account_config.name, status))
    logger.info("")

    # 预先尝试创建和加入固定队伍,从而每周第一次操作的心悦任务也能加到队伍积分中
    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.enable or account_config.run_mode == "pre_run":
            # 未启用的账户或者预运行阶段的账户不走该流程
            continue

        logger.info("------------尝试为第{}个账户({})加入心悦固定队------------\n".format(idx, account_config.name))

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.check_skey_expired()
        # 尝试加入固定心悦队伍
        djcHelper.try_join_fixed_xinyue_team()

    # 正式进行流程
    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.enable:
            logger.info("第{}个账号({})未启用,将跳过".format(idx, account_config.name))
            continue

        logger.info("------------开始处理第{}个账户({})------------\n".format(idx, account_config.name))

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.run()
コード例 #20
0
def query_card_info():
    # 读取配置信息
    cfg = config()

    # init_pool(cfg.get_pool_size())
    # check_all_skey_and_pskey(cfg, check_skey_only=True)

    # 12.30 送卡片次数(re:好像送给别人没有上限?)
    indexes = list(range(len(cfg.account_configs), 0, -1))

    order_map, _ = make_ark_lottery_card_and_award_info()

    heads = []
    colSizes = []

    card_indexes = ["1-1", "1-2", "1-3", "1-4", "2-1", "2-2", "2-3", "2-4", "3-1", "3-2", "3-3", "3-4"]
    card_width = 3
    heads.extend(card_indexes)
    colSizes.extend([card_width for i in card_indexes])

    summaryCols = [*[0 for card in card_indexes]]

    for idx in indexes:  # 从1开始,第i个
        account_config = cfg.account_configs[idx - 1]
        if not account_config.function_switches.get_ark_lottery or not account_config.is_enabled():
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        lr = djcHelper.fetch_pskey()
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list()
        qa = QzoneActivity(djcHelper, lr)

        # 获取卡片和奖励数目,其中新版本卡片为 id=>count ,旧版本卡片为 name=>count
        card_counts: Dict[str, int]

        if is_new_version_ark_lottery():
            card_counts = djcHelper.dnf_ark_lottery_get_card_counts()
        else:
            qa = QzoneActivity(djcHelper, lr)

            card_counts = qa.get_card_counts()

        # 处理各个卡片数目
        for card_position, card_index in enumerate(card_indexes):
            card_count = card_counts[order_map[card_index]]

            # 更新统计信息
            summaryCols[card_position] += card_count

    msg = "\n卡片详情如下"
    msg += "\n "
    for col in range(4):
        msg += f" {col + 1:3d}"
    for row in range(3):
        msg += f"\n{row + 1}"
        for col in range(4):
            msg += f" {summaryCols[row * 4 + col]:3d}"
    msg += "\n"

    return msg
コード例 #21
0
def sell_card(targetQQ: str, cards_to_send: List[str]) -> str:
    cards_to_send = [name for name in cards_to_send if name != CARD_PLACEHOLDER]
    original_cards = [*cards_to_send]

    # 读取配置信息
    cfg = config()

    # 12.30 送卡片次数(re:好像送给别人没有上限?)
    indexes = list(range(len(cfg.account_configs), 0, -1))

    if not is_new_version_ark_lottery():
        card_info_map = parse_card_group_info_map(zzconfig())
        for name in cards_to_send:
            if name not in card_info_map:
                return f"{name}不是本期卡片名称,有效的卡片名称为: {list(card_info_map.keys())}"

    success_send_list = []

    for idx in indexes:  # 从1开始,第i个
        account_config = cfg.account_configs[idx - 1]
        show_head_line(f"开始处理第{idx}个账户[{account_config.name}]", color("fg_bold_yellow"))
        if not account_config.function_switches.get_ark_lottery or not account_config.is_enabled():
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.fetch_pskey()
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list()

        remaining_cards = []
        for name in cards_to_send:
            send_ok = False

            if is_new_version_ark_lottery():
                send_ok = djcHelper.dnf_ark_lottery_send_card(name, targetQQ)
            else:
                res = djcHelper.send_card_by_name(name, targetQQ)
                retCode = int(res["13333"]["ret"])

                if retCode == 0:
                    send_ok = True
                else:
                    if len(original_cards) == 1:
                        if retCode == 10017:
                            return "该账号今日已被赠送过四次"

            if send_ok:
                success_send_list.append(name)
            else:
                remaining_cards.append(name)

        cards_to_send = remaining_cards
        if len(cards_to_send) == 0:
            break

    msg = ""
    if len(success_send_list) != 0:
        msg += f"\n成功发送以下卡片:{success_send_list}"
    if len(cards_to_send) != 0:
        msg += f"\n无法发送以下卡片:{cards_to_send},是否已达到赠送上限或者这个卡卖完了?"
    if len(success_send_list) != 0:
        msg += "\n请使用手机打开集卡页面确认是否到账~ 若到账请按1元每张的价格主动扫码转账哦~(不定期我会核查的,如果买了不付款的话就加入本工具黑名单~)"
    msg += "\n"

    return msg
コード例 #22
0
def get_account_status(idx: int, account_config: AccountConfig, common_config: CommonConfig):
    djcHelper = DjcHelper(account_config, common_config)
    djcHelper.check_skey_expired()
    djcHelper.get_bind_role_list(print_warning=False)

    status = "启用" if account_config.is_enabled() else "未启用"

    djc_info = djcHelper.query_balance("查询聚豆概览", print_res=False)["data"]
    djc_allin, djc_balance = int(djc_info['allin']), int(djc_info['balance'])

    xinyue_info = djcHelper.query_xinyue_info("查询心悦成就点概览", print_res=False)
    teaminfo = djcHelper.query_xinyue_teaminfo()
    team_award_summary = "无队伍"
    if teaminfo.id != "":
        team_award_summary = teaminfo.award_summary
        fixed_team = djcHelper.get_fixed_team()
        if fixed_team is not None:
            team_award_summary = f"[{fixed_team.id}]{team_award_summary}"

    gpoints = djcHelper.query_gpoints()

    ui = djcHelper.query_dnf_helper_chronicle_info()
    levelInfo = f"LV{ui.level}({ui.currentExp}/{ui.levelExp})"
    chronicle_points = ui.point
    if ui.totalExp == 0:
        levelInfo = ""
        chronicle_points = ""

    majieluo_stone = djcHelper.query_stone_count()

    return [
        idx, account_config.name, status,
        djc_balance, djc_allin,
        xinyue_info.xytype_str, xinyue_info.score, xinyue_info.ysb, team_award_summary, xinyue_info.work_info(),
        gpoints,
        levelInfo, chronicle_points,
        majieluo_stone,
    ]
コード例 #23
0
def try_xinyue_sailiyam_start_work(cfg):
    if not has_any_account_in_normal_run(cfg):
        return
    _show_head_line("尝试派赛利亚出去打工")

    for idx, account_config in enumerate(cfg.account_configs):
        idx += 1
        if not account_config.is_enabled():
            # 未启用的账户的账户不走该流程
            continue

        logger.info("")
        logger.warning(color("fg_bold_green") + f"------------开始处理第{idx}个账户({account_config.name})的赛利亚的打工和领工资~------------")

        djcHelper = DjcHelper(account_config, cfg.common)
        if account_config.function_switches.get_xinyue_sailiyam or account_config.function_switches.disable_most_activities:
            # 先尝试领工资
            djcHelper.show_xinyue_sailiyam_work_log()
            djcHelper.xinyue_sailiyam_op("领取工资", "714229", iPackageId=djcHelper.get_xinyue_sailiyam_package_id())
            djcHelper.xinyue_sailiyam_op("全勤奖", "715724")

            # 然后派出去打工
            djcHelper.xinyue_sailiyam_op("出去打工", "714255")

            logger.info("等待一会,避免请求过快")
            time.sleep(3)

        logger.info(color("fg_bold_cyan") + djcHelper.get_xinyue_sailiyam_workinfo())
        logger.info(color("fg_bold_cyan") + djcHelper.get_xinyue_sailiyam_status())
コード例 #24
0
ファイル: majieluo.py プロジェクト: fzls/djc_helper
def cui():
    # 读取配置信息
    load_config("config.toml", "config.toml.local")
    cfg = config()

    from main_def import check_proxy

    check_proxy(cfg)

    # note: 以下内容修改为自己的配置
    # 大号的账号序号(从1开始)
    dahao_indexes = [1]
    # 三个小号的序号
    xiaohao_indexes = [6, 7, 8]
    # 三个小号的QQ号
    xiaohao_qq_list = ["3036079506", "1470237902", "1276170371"]

    # re: 流程:
    #   1. send_to_xiaohao设为True,大号发送宝箱链接给三个小号
    #   2. 电脑上,大号QQ里点开三个小号对话的宝箱链接,替换Scode到scode_list里面
    #   3. send_to_xiaohao设为False,让小号开启各个宝箱

    # --------------- 每次只需要按流程修改下面几行 ---------------------

    send_to_xiaohao = True
    # send_to_xiaohao = False

    scode_list = [
        "MDJKQ0t5dDJYazlMVmMrc2ZXV0tVT0xsZitZMi9YOXZUUFgxMW1PcnQ2Yz0=",
        "UFgxa1lQZ3RBZERCMTU0N3dSWmcwZUxsZitZMi9YOXZUUFgxMW1PcnQ2Yz0=",
        "cXNpZTIrY2dRYk1GL2E4UjlGQzBkdUxsZitZMi9YOXZUUFgxMW1PcnQ2Yz0=",
    ]

    if len(xiaohao_qq_list) != scode_list:
        message_box("配置的小号数目与scode数目不一致,请确保两者一致", "出错了")
        sys.exit()

    # --------------- 每次只需要按流程修改上面几行 ---------------------

    # 登录相应账号
    if send_to_xiaohao:
        indexes = dahao_indexes
    else:
        indexes = xiaohao_indexes

    for idx in indexes:  # 从1开始,第i个
        account_config = cfg.account_configs[idx - 1]

        show_head_line(f"预先获取第{idx}个账户[{account_config.name}]的skey",
                       color("fg_bold_yellow"))

        if not account_config.is_enabled():
            logger.warning("账号被禁用,将跳过")
            continue

        djcHelper = DjcHelper(account_config, cfg.common)
        djcHelper.fetch_pskey()
        djcHelper.check_skey_expired()

    # 执行对应逻辑
    for order_index, account_index in enumerate(indexes):  # 从1开始,第i个
        account_config = cfg.account_configs[account_index - 1]

        show_head_line(f"开始处理第{account_index}个账户[{account_config.name}]",
                       color("fg_bold_yellow"))

        if not account_config.is_enabled():
            logger.warning("账号被禁用,将跳过")
            continue

        djcHelper = DjcHelper(account_config, cfg.common)

        djcHelper.fetch_pskey()
        djcHelper.check_skey_expired()
        djcHelper.get_bind_role_list()

        if send_to_xiaohao:
            logger.info(
                color("bold_green") + f"发送宝箱链接给小号QQ: {xiaohao_qq_list}")

            djcHelper.majieluo_send_to_xiaohao(xiaohao_qq_list)

            msg = (
                "1. 请在电脑登录大号QQ,依次点击各个小号的对话框里刚刚发送的宝箱链接,在浏览器中复制其链接中sCode的值到scode_list对应位置\n"
                "2. 请修改send_to_xiaohao为False后再次运行")
            message_box(msg, "后续流程")
        else:
            scode = scode_list[order_index]
            logger.info(
                f"第{order_index + 1}个小号领取刚刚运行后填写的Scode列表中第{order_index + 1}个scode - {scode}"
            )

            res = djcHelper.majieluo_open_box(scode)
            if res.sOutValue1 == 0:
                logger.info(color("bold_green") + "领取成功")
            else:
                code_to_message = {
                    "1": "无效的赠送链接",
                    "2": "不能打开自己的礼盒~",
                    "3": "该礼盒已经被开启",
                    "4": "好友今天的礼盒已经被全部打开了哦~",
                    "5": "一天只可以打开3次礼盒哦~",
                    "6": "该礼盒已经被开启",
                    "7": "该礼盒已经被开启",
                }
                message = "系统繁忙,请稍后再试~"
                if res.sOutValue1 in code_to_message:
                    message = code_to_message[res.sOutValue1]

                logger.error(message)

            time.sleep(1)

    # 第二次执行完毕提示修改send_to_xiaohao
    if not send_to_xiaohao:
        message_box("已领取完毕,请修改send_to_xiaohao为True,方便明天继续从头用", "提示")