mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-07 04:03:44 +08:00
面板替换别称无法识别问题修改
This commit is contained in:
parent
ad53d53dc9
commit
67457a9c86
@ -103,7 +103,8 @@ async def send_char_info(bot: Bot, ev: Event):
|
|||||||
|
|
||||||
|
|
||||||
async def _get_char_info(bot: Bot, ev: Event, text: str):
|
async def _get_char_info(bot: Bot, ev: Event, text: str):
|
||||||
msg = ''.join(re.findall('^[a-zA-Z0-9_\u4e00-\u9fa5]+$', text))
|
# msg = ''.join(re.findall('^[a-zA-Z0-9_\u4e00-\u9fa5]+$', text))
|
||||||
|
msg = text
|
||||||
if not msg:
|
if not msg:
|
||||||
return None
|
return None
|
||||||
# 获取角色名
|
# 获取角色名
|
||||||
|
@ -14,6 +14,7 @@ from ..utils.map.name_covert import (
|
|||||||
name_to_avatar_id,
|
name_to_avatar_id,
|
||||||
name_to_weapon_id,
|
name_to_weapon_id,
|
||||||
alias_to_char_name,
|
alias_to_char_name,
|
||||||
|
alias_to_weapon_name,
|
||||||
)
|
)
|
||||||
from ..utils.map.SR_MAP_PATH import (
|
from ..utils.map.SR_MAP_PATH import (
|
||||||
Property2Name,
|
Property2Name,
|
||||||
@ -251,7 +252,13 @@ async def make_new_charinfo(
|
|||||||
char_data = {}
|
char_data = {}
|
||||||
char_data['uid'] = uid
|
char_data['uid'] = uid
|
||||||
char_data['nickName'] = 'test'
|
char_data['nickName'] = 'test'
|
||||||
char_data['avatarId'] = int(await name_to_avatar_id(fake_name))
|
char_id = await name_to_avatar_id(fake_name)
|
||||||
|
if char_id == '':
|
||||||
|
fake_name = await alias_to_char_name(fake_name)
|
||||||
|
if fake_name is False:
|
||||||
|
return '请输入正确的角色名'
|
||||||
|
char_id = await name_to_avatar_id(fake_name)
|
||||||
|
char_data['avatarId'] = int(char_id)
|
||||||
char_data['avatarName'] = fake_name
|
char_data['avatarName'] = fake_name
|
||||||
char_data['avatarElement'] = avatarId2DamageType[
|
char_data['avatarElement'] = avatarId2DamageType[
|
||||||
str(char_data['avatarId'])
|
str(char_data['avatarId'])
|
||||||
@ -440,6 +447,9 @@ async def get_char(
|
|||||||
if isinstance(weapon, str):
|
if isinstance(weapon, str):
|
||||||
# 处理武器
|
# 处理武器
|
||||||
equipmentid = await name_to_weapon_id(weapon)
|
equipmentid = await name_to_weapon_id(weapon)
|
||||||
|
if equipmentid == '':
|
||||||
|
weapon = await alias_to_weapon_name(weapon)
|
||||||
|
equipmentid = await name_to_weapon_id(weapon)
|
||||||
equipment_info = {}
|
equipment_info = {}
|
||||||
equipment_info['equipmentID'] = int(equipmentid)
|
equipment_info['equipmentID'] = int(equipmentid)
|
||||||
equipment_info['equipmentName'] = EquipmentID2Name[str(equipmentid)]
|
equipment_info['equipmentName'] = EquipmentID2Name[str(equipmentid)]
|
||||||
|
@ -30,6 +30,11 @@ async def alias_to_char_name(char_name: str) -> str:
|
|||||||
return alias_data['characters'][i][0]
|
return alias_data['characters'][i][0]
|
||||||
return char_name
|
return char_name
|
||||||
|
|
||||||
|
async def alias_to_weapon_name(weapon_name: str) -> str:
|
||||||
|
for i in alias_data['light_cones']:
|
||||||
|
if weapon_name in alias_data['light_cones'][i]:
|
||||||
|
return alias_data['light_cones'][i][0]
|
||||||
|
return weapon_name
|
||||||
|
|
||||||
async def weapon_id_to_name(weapon_id: str) -> str:
|
async def weapon_id_to_name(weapon_id: str) -> str:
|
||||||
return EquipmentID2Name[weapon_id]
|
return EquipmentID2Name[weapon_id]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user