mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-06-19 05:45:03 +08:00
修复强制刷新主角性别bug (#61)
* 修复强制刷新主角性别bug * 🚨 `pre-commit-ci`修复格式错误 * 修复强制刷新主角性别bug * 🚨 `pre-commit-ci`修复格式错误 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
a3d9184f38
commit
44a55c0866
@ -14,8 +14,8 @@ from .to_data import api_to_dict
|
||||
from .mono.Character import Character
|
||||
from ..utils.error_reply import CHAR_HINT
|
||||
from ..utils.fonts.first_world import fw_font_28
|
||||
from ..utils.map.SR_MAP_PATH import RelicId2Rarity
|
||||
from ..utils.excel.read_excel import light_cone_ranks
|
||||
from ..utils.map.SR_MAP_PATH import RelicId2Rarity, avatarId2Name
|
||||
from ..utils.map.name_covert import name_to_avatar_id, alias_to_char_name
|
||||
from ..utils.resource.RESOURCE_PATH import (
|
||||
RELIC_PATH,
|
||||
@ -571,9 +571,15 @@ async def get_char_data(
|
||||
elif enable_self and char_self_path.exists():
|
||||
path = char_self_path
|
||||
else:
|
||||
im = await api_to_dict(sr_uid)
|
||||
print(str(im))
|
||||
if str(char_name) in im:
|
||||
char_data_list = await api_to_dict(sr_uid)
|
||||
charname_list = []
|
||||
if isinstance(char_data_list, str):
|
||||
return char_data_list
|
||||
else:
|
||||
for char in char_data_list:
|
||||
charname = avatarId2Name[str(char)]
|
||||
charname_list.append(charname)
|
||||
if str(char_name) in charname_list:
|
||||
if char_path.exists():
|
||||
path = char_path
|
||||
elif enable_self and char_self_path.exists():
|
||||
|
@ -8,9 +8,10 @@ from gsuid_core.utils.api.enka.models import EnkaData
|
||||
from .to_data import api_to_dict
|
||||
from ..utils.image.convert import convert_img
|
||||
from ..utils.fonts.first_world import fw_font_28
|
||||
from ..utils.map.SR_MAP_PATH import avatarId2Name
|
||||
from ..utils.map.name_covert import avatar_id_to_char_star
|
||||
from ..utils.fonts.starrail_fonts import sr_font_24, sr_font_30, sr_font_58
|
||||
from ..utils.resource.RESOURCE_PATH import CHAR_ICON_PATH, CHAR_PREVIEW_PATH
|
||||
from ..utils.map.name_covert import name_to_avatar_id, avatar_id_to_char_star
|
||||
|
||||
half_color = (255, 255, 255, 120)
|
||||
first_color = (29, 29, 29)
|
||||
@ -49,12 +50,13 @@ async def draw_enka_card(
|
||||
uid: str, char_list: Optional[List] = None, showfrom: int = 0
|
||||
):
|
||||
char_data_list = []
|
||||
if '希儿' in char_list:
|
||||
char_list.remove('希儿')
|
||||
char_list.append('希儿')
|
||||
if 1102 in char_list:
|
||||
char_list.remove(1102)
|
||||
char_list.append(1102)
|
||||
for char in char_list:
|
||||
avatarName = avatarId2Name[str(char)]
|
||||
char_data_list.append(
|
||||
{'avatarName': char, 'avatarId': await name_to_avatar_id(char)}
|
||||
{'avatarName': avatarName, 'avatarId': str(char)}
|
||||
)
|
||||
if showfrom == 0:
|
||||
line1 = f'展柜内有 {len(char_data_list)} 个角色!'
|
||||
|
@ -106,7 +106,7 @@ async def api_to_dict(
|
||||
im = f'UID: {sr_uid} 的角色展柜刷新失败!\n请检查UID是否正确或者角色展柜是否打开!'
|
||||
return im
|
||||
|
||||
return char_name_list
|
||||
return char_id_list
|
||||
|
||||
|
||||
async def get_data(char: dict, sr_data: dict, sr_uid: str):
|
||||
|
Loading…
x
Reference in New Issue
Block a user