mirror of
https://github.com/baiqwerdvd/StarRailUID.git
synced 2025-05-06 03:33:45 +08:00
🚧 sr强制刷新 增加更多信息
This commit is contained in:
parent
9fbbeb690b
commit
eb1b84a84e
@ -6,12 +6,12 @@ from httpx import ReadTimeout
|
||||
from gsuid_core.utils.api.enka.models import EnkaData
|
||||
|
||||
from ..utils.error_reply import UID_HINT
|
||||
from ..utils.excel.read_excel import AvatarPromotion
|
||||
from ..utils.resource.RESOURCE_PATH import PLAYER_PATH
|
||||
from ..sruid_utils.api.lulu.requests import get_char_card_info
|
||||
|
||||
# from gsuid_core.utils.api.minigg.request import get_weapon_info
|
||||
from .cal_value import cal_relic_sub_affix, cal_relic_main_affix
|
||||
from ..utils.excel.read_excel import AvatarPromotion, EquipmentPromotion
|
||||
from ..utils.map.SR_MAP_PATH import (
|
||||
SetId2Name,
|
||||
Property2Name,
|
||||
@ -22,6 +22,7 @@ from ..utils.map.SR_MAP_PATH import (
|
||||
skillId2Type,
|
||||
avatarId2Name,
|
||||
avatarId2EnName,
|
||||
characterSkillTree,
|
||||
)
|
||||
|
||||
mp.dps = 14
|
||||
@ -114,14 +115,16 @@ async def get_data(char: dict, sr_data: dict, sr_uid: str):
|
||||
'avatarPromotion': char['Promotion'],
|
||||
'avatarLevel': char['Level'],
|
||||
'avatarSkill': [],
|
||||
'avatarExtraAbility': [],
|
||||
'avatarAttributeBonus': [],
|
||||
'RelicInfo': [],
|
||||
'avatarFightProp': {},
|
||||
}
|
||||
avatarName = avatarId2Name[str(char['AvatarID'])]
|
||||
|
||||
char_data['avatarEnName'] = avatarId2EnName[str(char['AvatarID'])]
|
||||
# 处理技能
|
||||
for behavior in char['BehaviorList']:
|
||||
if f'{char["AvatarID"]}0' in str(behavior['BehaviorID']):
|
||||
# 处理技能
|
||||
if f'{char["AvatarID"]}0' == str(behavior['BehaviorID'])[0:5]:
|
||||
skill_temp = {}
|
||||
skill_temp['skillId'] = (
|
||||
char['AvatarID'] * 100 + behavior['BehaviorID'] % 10
|
||||
@ -129,12 +132,47 @@ async def get_data(char: dict, sr_data: dict, sr_uid: str):
|
||||
skill_temp['skillName'] = skillId2Name[str(skill_temp['skillId'])]
|
||||
skill_temp['skillType'] = skillId2Type[str(skill_temp['skillId'])]
|
||||
skill_temp['skillLevel'] = behavior['Level']
|
||||
# behavior_temp['skillIcon'] = skillId2Name['Icon'][
|
||||
# behavior_temp['skillId']
|
||||
# ]
|
||||
char_data['avatarSkill'].append(skill_temp)
|
||||
|
||||
char_data['avatarEnName'] = avatarId2EnName[str(char['AvatarID'])]
|
||||
# 处理技能树中的额外能力
|
||||
if f'{char["AvatarID"]}1' == str(behavior['BehaviorID'])[0:5]:
|
||||
extra_ability_temp = {}
|
||||
extra_ability_temp['extraAbilityId'] = behavior['BehaviorID']
|
||||
extra_ability_temp['extraAbilityLevel'] = behavior['Level']
|
||||
status_add = characterSkillTree[str(char['AvatarID'])][
|
||||
str(behavior['BehaviorID'])
|
||||
]['levels'][str(behavior['Level'])]['status_add']
|
||||
extra_ability_temp['statusAdd'] = {}
|
||||
if status_add != {}:
|
||||
extra_ability_temp['statusAdd']['property'] = status_add[
|
||||
'property'
|
||||
]
|
||||
extra_ability_temp['statusAdd']['name'] = Property2Name[
|
||||
status_add['property']
|
||||
]
|
||||
extra_ability_temp['statusAdd']['value'] = status_add['value']
|
||||
char_data['avatarExtraAbility'].append(extra_ability_temp)
|
||||
|
||||
# 处理技能树中的属性加成
|
||||
if f'{char["AvatarID"]}2' == str(behavior['BehaviorID'])[0:5]:
|
||||
attribute_bonus_temp = {}
|
||||
attribute_bonus_temp['attributeBonusId'] = behavior['BehaviorID']
|
||||
attribute_bonus_temp['attributeBonusLevel'] = behavior['Level']
|
||||
status_add = characterSkillTree[str(char['AvatarID'])][
|
||||
str(behavior['BehaviorID'])
|
||||
]['levels'][str(behavior['Level'])]['status_add']
|
||||
attribute_bonus_temp['statusAdd'] = {}
|
||||
if status_add != {}:
|
||||
attribute_bonus_temp['statusAdd']['property'] = status_add[
|
||||
'property'
|
||||
]
|
||||
attribute_bonus_temp['statusAdd']['name'] = Property2Name[
|
||||
status_add['property']
|
||||
]
|
||||
attribute_bonus_temp['statusAdd']['value'] = status_add[
|
||||
'value'
|
||||
]
|
||||
char_data['avatarAttributeBonus'].append(attribute_bonus_temp)
|
||||
|
||||
# 处理遗器
|
||||
for relic in char['RelicList']:
|
||||
@ -229,7 +267,7 @@ async def get_data(char: dict, sr_data: dict, sr_uid: str):
|
||||
mp.mpf(avatar_promotion_base["BaseAggro"]['Value'])
|
||||
)
|
||||
|
||||
char_data['base_attributes'] = base_attributes
|
||||
char_data['baseAttributes'] = base_attributes
|
||||
|
||||
# 处理武器
|
||||
|
||||
@ -239,11 +277,35 @@ async def get_data(char: dict, sr_data: dict, sr_uid: str):
|
||||
equipment_info['equipmentName'] = EquipmentID2Name[
|
||||
str(equipment_info['equipmentID'])
|
||||
]
|
||||
# equipment_info['EquipmentStar'] = equipment_info['flat']['rankLevel']
|
||||
|
||||
equipment_info['equipmentLevel'] = char['EquipmentID']['Level']
|
||||
equipment_info['equipmentPromotion'] = char['EquipmentID']['Promotion']
|
||||
equipment_info['equipmentRank'] = char['EquipmentID']['Rank']
|
||||
equipment_base_attributes = {}
|
||||
equipment_promotion_base = EquipmentPromotion[
|
||||
str(equipment_info['equipmentID'])
|
||||
][str(equipment_info['equipmentPromotion'])]
|
||||
|
||||
# 生命值
|
||||
equipment_base_attributes['hp'] = str(
|
||||
mp.mpf(equipment_promotion_base["BaseHP"]['Value'])
|
||||
+ mp.mpf(equipment_promotion_base["BaseHPAdd"]['Value'])
|
||||
* (equipment_info['equipmentLevel'] - 1)
|
||||
)
|
||||
# 攻击力
|
||||
equipment_base_attributes['attack'] = str(
|
||||
mp.mpf(equipment_promotion_base["BaseAttack"]['Value'])
|
||||
+ mp.mpf(equipment_promotion_base["BaseAttackAdd"]['Value'])
|
||||
* (equipment_info['equipmentLevel'] - 1)
|
||||
)
|
||||
# 防御力
|
||||
equipment_base_attributes['defence'] = str(
|
||||
mp.mpf(equipment_promotion_base["BaseDefence"]['Value'])
|
||||
+ mp.mpf(equipment_promotion_base["BaseDefenceAdd"]['Value'])
|
||||
* (equipment_info['equipmentLevel'] - 1)
|
||||
)
|
||||
equipment_info['baseAttributes'] = equipment_base_attributes
|
||||
|
||||
char_data['equipmentInfo'] = equipment_info
|
||||
|
||||
with open(
|
||||
|
17301
StarRailUID/utils/excel/EquipmentPromotionConfig.json
Normal file
17301
StarRailUID/utils/excel/EquipmentPromotionConfig.json
Normal file
File diff suppressed because it is too large
Load Diff
@ -11,3 +11,6 @@ with open(EXCEL / 'RelicSubAffixConfig.json', 'r', encoding='utf8') as f:
|
||||
|
||||
with open(EXCEL / 'AvatarPromotionConfig.json', 'r', encoding='utf8') as f:
|
||||
AvatarPromotion = json.load(f)
|
||||
|
||||
with open(EXCEL / 'EquipmentPromotionConfig.json', 'r', encoding='utf8') as f:
|
||||
EquipmentPromotion = json.load(f)
|
||||
|
@ -19,6 +19,7 @@ Property2Name_fileName = 'Property2Name.json'
|
||||
RelicId2SetId_fileName = f'RelicId2SetId_mapping_{version}.json'
|
||||
SetId2Name_fileName = f'SetId2Name_mapping_{version}.json'
|
||||
rankId2Name_fileName = f'rankId2Name_mapping_{version}.json'
|
||||
characterSkillTree_fileName = f'characterSkillTree_mapping_{version}.json'
|
||||
|
||||
|
||||
class TS(TypedDict):
|
||||
@ -55,3 +56,6 @@ with open(MAP / SetId2Name_fileName, 'r', encoding='UTF-8') as f:
|
||||
|
||||
with open(MAP / rankId2Name_fileName, 'r', encoding='UTF-8') as f:
|
||||
rankId2Name = msgjson.decode(f.read(), type=Dict[str, str])
|
||||
|
||||
with open(MAP / characterSkillTree_fileName, 'r', encoding='UTF-8') as f:
|
||||
characterSkillTree = msgjson.decode(f.read(), type=Dict[str, dict])
|
||||
|
File diff suppressed because one or more lines are too long
8
poetry.lock
generated
8
poetry.lock
generated
@ -596,18 +596,18 @@ files = [
|
||||
|
||||
[[package]]
|
||||
name = "platformdirs"
|
||||
version = "3.5.0"
|
||||
version = "3.5.1"
|
||||
description = "A small Python package for determining appropriate platform-specific dirs, e.g. a \"user data dir\"."
|
||||
category = "dev"
|
||||
optional = false
|
||||
python-versions = ">=3.7"
|
||||
files = [
|
||||
{file = "platformdirs-3.5.0-py3-none-any.whl", hash = "sha256:47692bc24c1958e8b0f13dd727307cff1db103fca36399f457da8e05f222fdc4"},
|
||||
{file = "platformdirs-3.5.0.tar.gz", hash = "sha256:7954a68d0ba23558d753f73437c55f89027cf8f5108c19844d4b82e5af396335"},
|
||||
{file = "platformdirs-3.5.1-py3-none-any.whl", hash = "sha256:e2378146f1964972c03c085bb5662ae80b2b8c06226c54b2ff4aa9483e8a13a5"},
|
||||
{file = "platformdirs-3.5.1.tar.gz", hash = "sha256:412dae91f52a6f84830f39a8078cecd0e866cb72294a5c66808e74d5e88d251f"},
|
||||
]
|
||||
|
||||
[package.extras]
|
||||
docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.1.3)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
|
||||
docs = ["furo (>=2023.3.27)", "proselint (>=0.13)", "sphinx (>=6.2.1)", "sphinx-autodoc-typehints (>=1.23,!=1.23.4)"]
|
||||
test = ["appdirs (==1.4.4)", "covdefaults (>=2.3)", "pytest (>=7.3.1)", "pytest-cov (>=4)", "pytest-mock (>=3.10)"]
|
||||
|
||||
[[package]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user