From 0eeb17c5cbd4c5336e6295812c4664c273b26958 Mon Sep 17 00:00:00 2001 From: RBAmeto <46624927+RBAmeto@users.noreply.github.com> Date: Fri, 11 Oct 2024 12:59:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9C=AB=E6=97=A5=E5=92=8C?= =?UTF-8?q?=E8=99=9A=E6=9E=84=E7=9A=84=E5=88=86=E6=95=B0=E7=8E=B0=E5=AE=9E?= =?UTF-8?q?=20(#43)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StarRailUID/sruid_utils/api/mys/models.py | 1 + .../starrailuid_abyss_boss/draw_abyss_card.py | 26 ++++++++++++++++ .../draw_abyss_card.py | 30 +++++++++++++++++-- 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/StarRailUID/sruid_utils/api/mys/models.py b/StarRailUID/sruid_utils/api/mys/models.py index f36d5da..7c7509f 100644 --- a/StarRailUID/sruid_utils/api/mys/models.py +++ b/StarRailUID/sruid_utils/api/mys/models.py @@ -256,6 +256,7 @@ class AbyssAvatar(Struct): class AbyssNodeDetail(Struct): challenge_time: Union[AbyssTime, None] avatars: List[AbyssAvatar] + score: Optional[str] = None class AbyssFloorDetail(Struct): diff --git a/StarRailUID/starrailuid_abyss_boss/draw_abyss_card.py b/StarRailUID/starrailuid_abyss_boss/draw_abyss_card.py index 1fedd79..6c6b57a 100644 --- a/StarRailUID/starrailuid_abyss_boss/draw_abyss_card.py +++ b/StarRailUID/starrailuid_abyss_boss/draw_abyss_card.py @@ -92,6 +92,7 @@ async def _draw_floor_card( img: Image.Image, index_floor: int, floor_name: str, + sum_score: Union[int, None], ): for index_num in [0, 1, 2]: star_num = index_num + 1 @@ -108,6 +109,15 @@ async def _draw_floor_card( fill=white_color, anchor="mm", ) + #总分todo + if sum_score: + floor_pic_draw.text( + (800, 60), + f"{sum_score}", + font=sr_font_42, + fill="#fec86f", + anchor="rm", + ) img.paste(floor_pic, (0, 657 + index_floor * 570), floor_pic) @@ -192,12 +202,18 @@ async def draw_abyss_img( floor_name = level.name node_1 = level.node_1 node_2 = level.node_2 + if node_1.score and node_2.score: + sum_score = int(node_1.score) + int(node_2.score) + else: + sum_score = None for index_part in [0, 1]: node_num = index_part + 1 if node_num == 1: time_array = node_1.challenge_time + score = node_1.score else: time_array = node_2.challenge_time + score = node_2.score assert time_array is not None time_str = f"{time_array.year}-{time_array.month}" time_str = f"{time_str}-{time_array.day}" @@ -217,6 +233,15 @@ async def draw_abyss_img( sr_font_22, "lm", ) + # 分数todo + if score : + floor_pic_draw.text( + (800, 120 + index_part * 219), + f"{score}", + "#fec86f", + sr_font_30, + "rm", + ) if node_num == 1: avatars_array = node_1 else: @@ -235,6 +260,7 @@ async def draw_abyss_img( img, index_floor, floor_name, + sum_score, ) res = await convert_img(img) diff --git a/StarRailUID/starrailuid_abyss_story/draw_abyss_card.py b/StarRailUID/starrailuid_abyss_story/draw_abyss_card.py index 547a316..783b6e9 100644 --- a/StarRailUID/starrailuid_abyss_story/draw_abyss_card.py +++ b/StarRailUID/starrailuid_abyss_story/draw_abyss_card.py @@ -100,6 +100,7 @@ async def _draw_floor_card( index_floor: int, floor_name: str, round_num: Union[int, None], + sum_score: Union[int, None], ): for index_num in [0, 1, 2]: star_num = index_num + 1 @@ -116,10 +117,19 @@ async def _draw_floor_card( fill=white_color, anchor="mm", ) + #总分todo + if sum_score: + floor_pic_draw.text( + (800, 40), + f"{sum_score}", + font=sr_font_22, + fill="#fec86f", + anchor="rm", + ) floor_pic_draw.text( - (802, 60), + (800, 70), f"使用轮: {round_num}", - font=sr_font_28, + font=sr_font_22, fill=gray_color, anchor="rm", ) @@ -208,12 +218,18 @@ async def draw_abyss_img( round_num = level.round_num node_1 = level.node_1 node_2 = level.node_2 + if node_1.score and node_2.score: + sum_score = int(node_1.score) + int(node_2.score) + else: + sum_score = None for index_part in [0, 1]: node_num = index_part + 1 if node_num == 1: time_array = node_1.challenge_time + score = node_1.score else: time_array = node_2.challenge_time + score = node_2.score assert time_array is not None time_str = f"{time_array.year}-{time_array.month}" time_str = f"{time_str}-{time_array.day}" @@ -233,6 +249,15 @@ async def draw_abyss_img( sr_font_22, "lm", ) + # 分数todo + if score : + floor_pic_draw.text( + (800, 120 + index_part * 219), + f"{score}", + "#fec86f", + sr_font_30, + "rm", + ) if node_num == 1: avatars_array = node_1 else: @@ -253,6 +278,7 @@ async def draw_abyss_img( index_floor, floor_name, round_num, + sum_score, ) res = await convert_img(img)