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)) # 展示卡仓信息 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 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] djcHelper = DjcHelper(account_config, cfg.common) lr = djcHelper.fetch_pskey() djcHelper.check_skey_expired() djcHelper.get_bind_role_list() 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
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] # 读取配置信息 load_config("config.toml", "config.toml.local") cfg = config() # 12.30 送卡片次数(re:好像送给别人没有上限?) indexes = list(range(len(cfg.account_configs), 0, -1)) 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")) djcHelper = DjcHelper(account_config, cfg.common) lr = djcHelper.fetch_pskey() djcHelper.check_skey_expired() djcHelper.get_bind_role_list() remaining_cards = [] for name in cards_to_send: res = djcHelper.send_card_by_name(name, targetQQ) retCode = int(res["13333"]["ret"]) if retCode == 0: success_send_list.append(name) else: remaining_cards.append(name) if len(original_cards) == 1: if retCode == 10017: return "该账号今日已被赠送过四次" 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 += f"\n请使用手机打开集卡页面确认是否到账~ 若到账请按1元每张的价格主动扫码转账哦~(不自觉的坏孩子会被tjjtds哦<_<)" msg += "\n" return msg
def run_remote(args): if args.query: msg = query_card_info() else: card_info_map = parse_card_group_info_map(zzconfig()) card_name_list = [ card_name for card_name, card_info in card_info_map.items() if card_info.index == args.card_index ] msg = sell_card(args.target_qq, card_name_list) print(json.dumps(msg))
def run_remote(args): if args.query: msg = query_card_info() else: card_name_list: List[str] if is_new_version_ark_lottery(): # 新版集卡中名称为 1/2/3/4/.../10/11/12 card_name_list = [new_ark_lottery_parse_card_id_from_index(args.card_index)] else: card_info_map = parse_card_group_info_map(zzconfig()) card_name_list = [ card_name for card_name, card_info in card_info_map.items() if card_info.index == args.card_index ] msg = sell_card(args.target_qq, card_name_list) print(json.dumps(msg))
def lottery_using_cards(self, card_name, count=1): if count <= 0: return logger.info(f"尝试消耗{count}张卡片【{card_name}】来进行抽奖") card_info_map = parse_card_group_info_map(self.zzconfig) ruleid = card_info_map[card_name].lotterySwitchId for _idx in range(count): # 消耗卡片获得抽奖资格 self.do_ark_lottery("fcg_qzact_present", f"增加抽奖次数-消耗卡片({card_name})", ruleid) # 抽奖 self.do_ark_lottery("fcg_prize_lottery", "进行卡片抽奖", self.zzconfig.rules.lotteryByCard, gameid=self.zzconfig.gameid)
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