From 8bf935843ebfb308841d908eed887ff988b2d893 Mon Sep 17 00:00:00 2001 From: qwerdvd <2450899274@qq.com> Date: Wed, 7 Jun 2023 17:25:53 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=E4=BF=AE=E6=AD=A3=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=96=87=E4=BB=B6=E6=9B=B4=E6=94=B9=E5=B8=A6=E6=9D=A5?= =?UTF-8?q?=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- StarRailUID/starrailuid_charinfo/to_data.py | 50 ++++++++++++--------- 1 file changed, 28 insertions(+), 22 deletions(-) diff --git a/StarRailUID/starrailuid_charinfo/to_data.py b/StarRailUID/starrailuid_charinfo/to_data.py index 2783641..debcbdd 100644 --- a/StarRailUID/starrailuid_charinfo/to_data.py +++ b/StarRailUID/starrailuid_charinfo/to_data.py @@ -154,17 +154,20 @@ async def get_data(char: dict, sr_data: dict, sr_uid: str): extra_ability_temp['extraAbilityLevel'] = behavior['level'] status_add = characterSkillTree[str(char['avatarId'])][ str(behavior['pointId']) - ]['levels'][str(behavior['level'])]['status_add'] + ]['levels'][behavior['level'] - 1]['properties'] 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 status_add: + for property_ in status_add: + extra_ability_temp['statusAdd']['property'] = property_[ + 'type' + ] + extra_ability_temp['statusAdd']['name'] = Property2Name[ + property_['type'] + ] + extra_ability_temp['statusAdd']['value'] = property_[ + 'value' + ] + char_data['avatarExtraAbility'].append(extra_ability_temp) # 处理技能树中的属性加成 if f'{char["avatarId"]}2' == str(behavior['pointId'])[0:5]: @@ -173,19 +176,22 @@ async def get_data(char: dict, sr_data: dict, sr_uid: str): attribute_bonus_temp['attributeBonusLevel'] = behavior['level'] status_add = characterSkillTree[str(char['avatarId'])][ str(behavior['pointId']) - ]['levels'][str(behavior['level'])]['status_add'] + ]['levels'][behavior['level'] - 1]['properties'] 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) + if status_add: + for property_ in status_add: + attribute_bonus_temp['statusAdd']['property'] = property_[ + 'type' + ] + attribute_bonus_temp['statusAdd']['name'] = Property2Name[ + property_['type'] + ] + attribute_bonus_temp['statusAdd']['value'] = property_[ + 'value' + ] + char_data['avatarAttributeBonus'].append( + attribute_bonus_temp + ) # 处理遗器 if char.get('relicList'):