支持角色别名查询 (#15)

* 别名查询修改

* 别名查询修改

* add some functions

* 别名查询修改

* 🚨 `pre-commit-ci`修复格式错误

* 修改别名

* 🚨 `pre-commit-ci`修复格式错误

* 修改别名

* 🚨 `pre-commit-ci`修复格式错误

* Add files via upload

* 🚨 `pre-commit-ci`修复格式错误

* 修复别名查询

* 🚨 `pre-commit-ci`修复格式错误

* 修复别名查询

* 🚨 `pre-commit-ci`修复格式错误

* 修复别名查询

* 修复角色别名

* 🚨 `pre-commit-ci`修复格式错误

* 别名查询修复

* 🚨 `pre-commit-ci`修复格式错误

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
季落 2023-05-14 17:58:43 +08:00 committed by GitHub
parent d5de4b7efb
commit b6243b16aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 649 additions and 656 deletions

View File

@ -7,16 +7,15 @@ from typing import Dict, Union, Optional
from mpmath import mp, nstr
from PIL import Image, ImageDraw
from gsuid_core.logger import logger
from gsuid_core.utils.error_reply import CHAR_HINT
from gsuid_core.utils.image.convert import convert_img
from gsuid_core.utils.image.image_tools import draw_text_by_line
from .mono.Character import Character
from ..utils.error_reply import CHAR_HINT
from ..utils.map.SR_MAP_PATH import RelicId2Rarity
from ..utils.excel.read_excel import light_cone_ranks
from ..utils.map.name_covert import alias_to_char_name
from ..utils.fonts.first_world import fw_font_28, fw_font_120
# from ..utils.map.name_covert import name_to_avatar_id, alias_to_char_name
from ..utils.resource.RESOURCE_PATH import (
RELIC_PATH,
SKILL_PATH,
@ -580,15 +579,9 @@ async def get_char_data(
) -> Union[Dict, str]:
player_path = PLAYER_PATH / str(sr_uid)
SELF_PATH = player_path / 'SELF'
# char_id = await name_to_avatar_id(char_name)
if '开拓者' in char_name:
char_name = '开拓者'
# else:
# char_name = await alias_to_char_name(char_id, char_name)
char_name = await alias_to_char_name(char_name)
char_path = player_path / f'{char_name}.json'
char_self_path = SELF_PATH / f'{char_name}.json'
if char_path.exists():
path = char_path
elif enable_self and char_self_path.exists():

View File

@ -20,10 +20,10 @@ async def name_to_avatar_id(name: str) -> str:
return avatar_id
async def alias_to_char_name(char_id: str, char_name: str) -> str:
for i in alias_data['characters'][char_id]:
if (char_name in i) or (char_name in alias_data[i]):
return i
async def alias_to_char_name(char_name: str) -> str:
for i in alias_data['characters']:
if char_name in alias_data['characters'][i]:
return alias_data['characters'][i][0]
return char_name