mirror of
https://github.com/KimigaiiWuyi/GenshinUID.git
synced 2025-05-08 04:55:51 +08:00
🐛 修复部分情况下查询面板替换武器失效
This commit is contained in:
parent
9cc2147ebb
commit
a27e33c25f
@ -1,3 +1,4 @@
|
||||
import re
|
||||
from copy import deepcopy
|
||||
from typing import Dict, List, Tuple, Optional
|
||||
|
||||
@ -14,12 +15,16 @@ from ..etc.get_buff_list import get_buff_list
|
||||
from ...genshinuid_config.gs_config import gsconfig
|
||||
from ..etc.status_change import EXTRA_CHAR_LIST, STATUS_CHAR_LIST
|
||||
from ..etc.MAP_PATH import ActionMAP, char_action, avatarName2SkillAdd
|
||||
from ...utils.map.GS_MAP_PATH import avatarName2Weapon, avatarName2Element
|
||||
from ...utils.map.name_covert import name_to_avatar_id, avatar_id_to_char_star
|
||||
from ...utils.ambr_to_minigg import (
|
||||
convert_ambr_to_minigg,
|
||||
convert_ambr_to_weapon,
|
||||
)
|
||||
from ...utils.map.GS_MAP_PATH import (
|
||||
avatarName2Weapon,
|
||||
avatarName2Element,
|
||||
weaponId2Name_data,
|
||||
)
|
||||
from ..etc.base_info import (
|
||||
ATTR_MAP,
|
||||
ELEMENT_MAP,
|
||||
@ -139,13 +144,25 @@ class Character:
|
||||
weapon_raw_data = await get_weapon_info(weapon)
|
||||
except ConnectTimeout:
|
||||
weapon_raw_data = -1
|
||||
|
||||
if isinstance(weapon_raw_data, int) or isinstance(
|
||||
weapon_raw_data, List
|
||||
):
|
||||
weapon_id = 0
|
||||
if weapon in beta_weapons:
|
||||
weapon_id = beta_weapons[weapon]
|
||||
else:
|
||||
for _weapon_id in weaponId2Name_data:
|
||||
_weapon_name = weaponId2Name_data[_weapon_id]
|
||||
if _weapon_name == weapon:
|
||||
weapon_id = _weapon_id
|
||||
break
|
||||
else:
|
||||
return {}
|
||||
|
||||
if weapon_id == 0:
|
||||
return {}
|
||||
|
||||
weapon_raw_data = await convert_ambr_to_weapon(weapon_id)
|
||||
if not weapon_raw_data:
|
||||
return {}
|
||||
@ -191,12 +208,19 @@ class Character:
|
||||
)
|
||||
weapon_info['weaponStats'][1]['statValue'] = fake_value
|
||||
|
||||
if 'effect' in weapon_raw_data:
|
||||
weapon_info['weaponEffect'] = weapon_raw_data['effect'].format(
|
||||
if 'effectTemplateRaw' in weapon_raw_data:
|
||||
weapon_info['weaponEffect'] = weapon_raw_data[
|
||||
'effectTemplateRaw'
|
||||
].format(
|
||||
*weapon_raw_data[
|
||||
'r{}'.format(str(weapon_info['weaponAffix']))
|
||||
]
|
||||
)
|
||||
weapon_info['weaponEffect'] = re.sub(
|
||||
r'</?c[^\u4e00-\u9fa5/d]+>',
|
||||
'',
|
||||
weapon_info['weaponEffect'],
|
||||
)
|
||||
else:
|
||||
weapon_info['weaponEffect'] = '无特效。'
|
||||
weapon_info['weaponType'] = weapon_raw_data['weaponText']
|
||||
|
@ -224,7 +224,7 @@ async def convert_ambr_to_weapon(
|
||||
result[f'r{index+1}'] = {'description': effect_desc}
|
||||
else:
|
||||
if index != 0:
|
||||
result['effect'] = result[f'r{index+1}']['description']
|
||||
result['effectTemplateRaw'] = result[f'r{index+1}']['description']
|
||||
atk_curve_type = upgrade['prop'][0]['type']
|
||||
sp_curve_type = upgrade['prop'][1]['type']
|
||||
atk_curve = WEAPON_GROW_CURVE['90']['curveInfos'][atk_curve_type]
|
||||
|
@ -1,7 +1,7 @@
|
||||
<p align="center">
|
||||
<a href="https://github.com/KimigaiiWuyi/GenshinUID/"><img src="https://s2.loli.net/2023/03/25/bareSdYcsmRPOyZ.png" width="256" height="256" alt="GenshinUID"></a>
|
||||
</p>
|
||||
<h1 align = "center">GenshinUID 5.0.1</h1>
|
||||
<h1 align = "center">GenshinUID 5.1.2</h1>
|
||||
<h4 align = "center">✨支持OneBot(QQ)、QQ频道、微信、开黑啦、Telegram的全功能原神Bot插件✨</h4>
|
||||
<div align = "center">
|
||||
<a href="https://docs.sayu-bot.com/" target="_blank">安装文档</a> ·
|
||||
@ -51,5 +51,5 @@
|
||||
+ 如果对本插件有功能建议&Bug报告,欢迎提Issue & Pr,每一条都会详细看过
|
||||
+ 如果本插件对你有帮助,不要忘了点个Star~
|
||||
+ 本项目仅供学习使用,请勿用于商业用途
|
||||
+ [爱发电](https://afdian.net/@KimigaiiWuyi)
|
||||
+ [爱发电](https://afdian.com/a/KimigaiiWuyi)
|
||||
+ [GPL-3.0 License](https://github.com/KimigaiiWuyi/GenshinUID/blob/main/LICENSE) ©[@KimigaiiWuyi](https://github.com/KimigaiiWuyi)
|
||||
|
Loading…
x
Reference in New Issue
Block a user