mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-08 13:05:55 +08:00
🚨 pre-commit-ci
修复格式错误
This commit is contained in:
parent
ea6a751817
commit
eb51dc4c94
@ -38,6 +38,7 @@ class RoleBasicInfo(TypedDict):
|
||||
# 模拟宇宙相关 #
|
||||
################
|
||||
|
||||
|
||||
class RogueTime(TypedDict):
|
||||
year: int
|
||||
month: int
|
||||
@ -46,6 +47,7 @@ class RogueTime(TypedDict):
|
||||
minute: int
|
||||
second: int
|
||||
|
||||
|
||||
class RogueAvatar(TypedDict):
|
||||
id: int
|
||||
icon: str
|
||||
@ -53,26 +55,31 @@ class RogueAvatar(TypedDict):
|
||||
rarity: int
|
||||
element: str
|
||||
|
||||
|
||||
class RogueBaseType(TypedDict):
|
||||
id: int
|
||||
name: str
|
||||
cnt: int
|
||||
|
||||
|
||||
class RogueBuffitems(TypedDict):
|
||||
id: int
|
||||
name: str
|
||||
is_evoluted: str
|
||||
rank: int
|
||||
|
||||
|
||||
class RogueMiracles(TypedDict):
|
||||
id: int
|
||||
name: str
|
||||
icon: str
|
||||
|
||||
|
||||
class RogueBuffs(TypedDict):
|
||||
base_type: RogueBaseType
|
||||
items: List[RogueBuffitems]
|
||||
|
||||
|
||||
class RogueRecordInfo(TypedDict):
|
||||
name: str
|
||||
finish_time: RogueTime
|
||||
@ -85,31 +92,37 @@ class RogueRecordInfo(TypedDict):
|
||||
difficulty: int
|
||||
progress: int
|
||||
|
||||
|
||||
class RogueBasic(TypedDict):
|
||||
id: int
|
||||
finish_cnt: int
|
||||
schedule_begin: RogueTime
|
||||
schedule_end: RogueTime
|
||||
|
||||
|
||||
class RogueRecord(TypedDict):
|
||||
basic: RogueBasic
|
||||
records: List[RogueRecordInfo]
|
||||
|
||||
|
||||
class RogueBasicInfo(TypedDict):
|
||||
unlocked_buff_num: int
|
||||
unlocked_miracle_num: int
|
||||
unlocked_skill_points: int
|
||||
|
||||
|
||||
class RoleInfo(TypedDict):
|
||||
server: str
|
||||
nickname: str
|
||||
level: int
|
||||
|
||||
|
||||
class RogueData(TypedDict):
|
||||
role: RoleInfo
|
||||
basic_info: RogueBasicInfo
|
||||
current_record: RogueRecord
|
||||
|
||||
|
||||
################
|
||||
# 深渊相关 #
|
||||
################
|
||||
|
@ -1,15 +1,20 @@
|
||||
import math
|
||||
from pathlib import Path
|
||||
from typing import Union, List, Optional
|
||||
from typing import List, Union, Optional
|
||||
|
||||
from PIL import Image, ImageDraw
|
||||
from gsuid_core.logger import logger
|
||||
from gsuid_core.utils.error_reply import get_error
|
||||
import math
|
||||
|
||||
from .utils import get_icon
|
||||
from ..utils.convert import GsCookie
|
||||
from ..utils.image.convert import convert_img
|
||||
from ..sruid_utils.api.mys.models import RogueAvatar, RogueBuffitems, RogueMiracles
|
||||
from ..utils.image.image_tools import get_qq_avatar, draw_pic_with_ring
|
||||
from ..sruid_utils.api.mys.models import (
|
||||
RogueAvatar,
|
||||
RogueMiracles,
|
||||
RogueBuffitems,
|
||||
)
|
||||
from ..utils.fonts.starrail_fonts import (
|
||||
sr_font_22,
|
||||
sr_font_28,
|
||||
@ -74,10 +79,12 @@ bufflist = {
|
||||
126: '欢愉',
|
||||
}
|
||||
|
||||
|
||||
async def get_abyss_star_pic(star: int) -> Image.Image:
|
||||
star_pic = Image.open(TEXT_PATH / f'star{star}.png')
|
||||
return star_pic
|
||||
|
||||
|
||||
async def _draw_rogue_buff(
|
||||
buffs: List[RogueBuffitems],
|
||||
buff_icon: str,
|
||||
@ -111,7 +118,9 @@ async def _draw_rogue_buff(
|
||||
is_evoluted = 1
|
||||
else:
|
||||
is_evoluted = 0
|
||||
buff_bg = Image.open(TEXT_PATH / f'zhufu_{item["rank"]}_{is_evoluted}.png')
|
||||
buff_bg = Image.open(
|
||||
TEXT_PATH / f'zhufu_{item["rank"]}_{is_evoluted}.png'
|
||||
)
|
||||
buff_bg = buff_bg.resize((233, 35))
|
||||
z_left = 90 + 240 * zb_list[jishu][1]
|
||||
z_top = buff_height + 450 + 55 * zb_list[jishu][0]
|
||||
@ -126,6 +135,7 @@ async def _draw_rogue_buff(
|
||||
)
|
||||
return draw_height
|
||||
|
||||
|
||||
async def _draw_rogue_miracles(
|
||||
miracles: List[RogueMiracles],
|
||||
floor_pic: Image.Image,
|
||||
@ -145,6 +155,7 @@ async def _draw_rogue_miracles(
|
||||
jishu = jishu + 1
|
||||
floor_pic.paste(miracles_icon, (z_left, z_top), mask=miracles_icon)
|
||||
|
||||
|
||||
async def _draw_rogue_card(
|
||||
char: RogueAvatar,
|
||||
talent_num: str,
|
||||
@ -180,6 +191,7 @@ async def _draw_rogue_card(
|
||||
char_bg,
|
||||
)
|
||||
|
||||
|
||||
async def draw_rogue_img(
|
||||
qid: Union[str, int],
|
||||
uid: str,
|
||||
@ -341,15 +353,25 @@ async def draw_rogue_img(
|
||||
floor_pic = Image.open(TEXT_PATH / 'detail_bg.png').convert("RGBA")
|
||||
floor_pic = floor_pic.resize((900, detail['detail_h']))
|
||||
|
||||
floor_top_pic = Image.open(TEXT_PATH / 'floor_bg_top.png').convert("RGBA")
|
||||
floor_top_pic = Image.open(TEXT_PATH / 'floor_bg_top.png').convert(
|
||||
"RGBA"
|
||||
)
|
||||
floor_pic.paste(floor_top_pic, (0, 0), floor_top_pic)
|
||||
|
||||
floor_center_pic = Image.open(TEXT_PATH / 'floor_bg_center.png').convert("RGBA")
|
||||
floor_center_pic = floor_center_pic.resize((900, detail['detail_h'] - 170))
|
||||
floor_center_pic = Image.open(
|
||||
TEXT_PATH / 'floor_bg_center.png'
|
||||
).convert("RGBA")
|
||||
floor_center_pic = floor_center_pic.resize(
|
||||
(900, detail['detail_h'] - 170)
|
||||
)
|
||||
floor_pic.paste(floor_center_pic, (0, 100), floor_center_pic)
|
||||
|
||||
floor_bot_pic = Image.open(TEXT_PATH / 'floor_bg_bot.png').convert("RGBA")
|
||||
floor_pic.paste(floor_bot_pic, (0, detail['detail_h'] - 70), floor_bot_pic)
|
||||
floor_bot_pic = Image.open(TEXT_PATH / 'floor_bg_bot.png').convert(
|
||||
"RGBA"
|
||||
)
|
||||
floor_pic.paste(
|
||||
floor_bot_pic, (0, detail['detail_h'] - 70), floor_bot_pic
|
||||
)
|
||||
|
||||
floor_name = progresslist[detail['progress']]
|
||||
difficulty_name = difficultylist[detail['difficulty']]
|
||||
@ -357,9 +379,7 @@ async def draw_rogue_img(
|
||||
time_array = detail['finish_time']
|
||||
time_str = f"{time_array['year']}-{time_array['month']}"
|
||||
time_str = f"{time_str}-{time_array['day']}"
|
||||
time_str = (
|
||||
f"{time_str} {time_array['hour']}:{time_array['minute']}"
|
||||
)
|
||||
time_str = f"{time_str} {time_array['hour']}:{time_array['minute']}"
|
||||
floor_pic_draw = ImageDraw.Draw(floor_pic)
|
||||
floor_pic_draw.text(
|
||||
(450, 60),
|
||||
@ -436,7 +456,9 @@ async def draw_rogue_img(
|
||||
sr_font_34,
|
||||
'lm',
|
||||
)
|
||||
floor_pic.paste(content_center, (0, 370 + buff_height + 80), content_center)
|
||||
floor_pic.paste(
|
||||
content_center, (0, 370 + buff_height + 80), content_center
|
||||
)
|
||||
await _draw_rogue_miracles(
|
||||
detail['miracles'],
|
||||
floor_pic,
|
||||
|
Loading…
x
Reference in New Issue
Block a user