diff --git a/mihoyo_libs/get_image.py b/mihoyo_libs/get_image.py index 1eb74626..9e9e5e7f 100644 --- a/mihoyo_libs/get_image.py +++ b/mihoyo_libs/get_image.py @@ -1623,7 +1623,7 @@ async def draw_info_pic(uid: str, image: Optional[Match] = None) -> str: daily_data['resin_recovery_time']))) text_draw.text((268, 305), f' {next_resin_rec_time}', text_color, genshin_font(18), anchor='lm') - text_draw.text((170, 331), f'预计 后全部恢复', text_color, genshin_font(18), anchor='lm') + text_draw.text((170, 331), f'预计 后全部恢复', text_color, genshin_font(18), anchor='lm') text_draw.text((208, 331), f'{resin_recovery_time}', highlight_color, genshin_font(18), anchor='lm') # 洞天宝钱时间计算 diff --git a/mihoyo_libs/get_mihoyo_bbs_data.py b/mihoyo_libs/get_mihoyo_bbs_data.py index 1f8eb8d3..cc9dd53d 100644 --- a/mihoyo_libs/get_mihoyo_bbs_data.py +++ b/mihoyo_libs/get_mihoyo_bbs_data.py @@ -160,24 +160,26 @@ char_adv_im = """【{}】 async def weapon_adv(name): - char_adv_path = os.path.join(FILE_PATH, 'Genshin All Char.xlsx') - # char_adv_path = FILE_PATH + char_adv_path = os.path.join(FILE_PATH, 'mihoyo_libs/Genshin All Char.xlsx') wb = load_workbook(char_adv_path) ws = wb.active - weapon_name = '' - char_list = [] + weapons={} for c in range(2, 5): for r in range(2, 300): if ws.cell(r, c).value: # if all(i in ws.cell(r,c).value for i in name): if name in ws.cell(r, c).value: weapon_name = ws.cell(r, c).value - char_list.append(ws.cell(2 + ((r - 2) // 5) * 5, 1).value) + weapon=weapons.get(weapon_name,[]) + weapon.append(ws.cell(2 + ((r - 2) // 5) * 5, 1).value) + weapons[weapon_name]=weapon - if char_list: - im = ','.join(char_list) - im = im + '可能会用到【{}】'.format(weapon_name) + if weapons: + im = [] + for k, v in weapons.items(): + im.append(f'{"、".join(v)}可能会用到【{k}】') + im = '\n'.join(im) else: im = '没有角色能使用【{}】'.format(weapon_name) return im