diff --git a/mihoyo_libs/get_image.py b/mihoyo_libs/get_image.py index 5cefcd81..5fc004d2 100644 --- a/mihoyo_libs/get_image.py +++ b/mihoyo_libs/get_image.py @@ -1170,7 +1170,7 @@ async def draw_pic(uid: str, nickname: str, image: Optional[Match] = None, mode: text_draw.text((245, 477), str(raw_data['stats']['precious_chest_number']), text_color, genshin_font(24)) text_draw.text((245, 528), str(raw_data['stats']['luxurious_chest_number']), text_color, genshin_font(24)) - mondstadt = liyue = dragonspine = inazuma = offering = dict() + mondstadt = liyue = dragonspine = inazuma = offering = chasms_maw = under_chasms_maw = dict() for i in raw_data['world_explorations']: if i["name"] == "蒙德": mondstadt = i @@ -1183,16 +1183,16 @@ async def draw_pic(uid: str, nickname: str, image: Optional[Match] = None, mode: elif i["name"] == "渊下宫": offering = i elif i["name"] == "璃月层岩巨渊": - ChasmsMaw = i + chasms_maw = i elif i["name"] == "璃月层岩巨渊·地下矿区": - UnderChasmsMaw = i + under_chasms_maw = i # 层岩巨渊 - text_draw.text((477, 727), str(ChasmsMaw['exploration_percentage'] / 10) + '%', text_color, + text_draw.text((477, 727), str(chasms_maw['exploration_percentage'] / 10) + '%', text_color, genshin_font(22)) - text_draw.text((523, 753), str(UnderChasmsMaw['exploration_percentage'] / 10) + '%', text_color, + text_draw.text((523, 753), str(under_chasms_maw['exploration_percentage'] / 10) + '%', text_color, genshin_font(22)) - text_draw.text((500, 782), 'lv.' + str(UnderChasmsMaw['offerings'][0]['level']), text_color, genshin_font(22)) + text_draw.text((500, 782), 'lv.' + str(under_chasms_maw['offerings'][0]['level']), text_color, genshin_font(22)) # 蒙德 text_draw.text((235, 600), str(mondstadt['exploration_percentage'] / 10) + '%', text_color, @@ -1591,13 +1591,13 @@ async def draw_info_pic(uid: str, image: Optional[Match] = None) -> str: else: resin_recovery_time = seconds2hours( daily_data['resin_recovery_time']) - next_resin_rec_time = seconds2hours( - 8 * 60 - ((daily_data['max_resin'] - daily_data['current_resin']) * 8 * 60 - int( - daily_data['resin_recovery_time']))) - text_draw.text((268, 305), f" {next_resin_rec_time}", text_color, genshin_font(18), anchor="lm") + next_resin_rec_time = seconds2hours( + 8 * 60 - ((daily_data['max_resin'] - daily_data['current_resin']) * 8 * 60 - int( + 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((208, 331), f"{resin_recovery_time}", highlight_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") # 洞天宝钱时间计算 coin_rec_time = seconds2hours(int(daily_data["home_coin_recovery_time"])) @@ -1695,8 +1695,16 @@ async def draw_event_pic() -> None: k["time_data"] = time_data elif value.text == "〓活动时间〓": time_data = content_bs.find_all("p")[index + 1].text - time_data = time_data.replace("", "")[16:] - k["time_data"] = time_data + if "([\s\S]*?)", s)[0]) + else: + time_datas.append(s) + k["time_data"] = "——".join(time_datas) + else: + k["time_data"] = time_data elif value.text == "〓祈愿介绍〓": start_time = content_bs.find_all("tr")[1].td.find_all("p")[0].text if "([\s\S]*?)", end_time)[0] - time_data = start_time + "~" + end_time + time_data = start_time + "——" + end_time k["time_data"] = time_data if "冒险助力礼包" in k["title"] or "纪行" in k["title"]: