Skip to content

Commit

Permalink
🐛 Fix KeyError caused by failure to retrieve reliquarySubstats
Browse files Browse the repository at this point in the history
  • Loading branch information
luoshuijs committed Nov 10, 2023
1 parent fcfdba1 commit 5d045a9
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions python_genshin_artifact/enka/enka_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ def de_equip_list(equip_list: list[dict]) -> Tuple[WeaponInterface, List[Artifac
stat_name = fight_map[_main_prop_id]
stat_value = to_float(_main_prop_id, _reliquary_main_stat["statValue"])
_main_stat = (stat_name, stat_value)
for _reliquary_sub_stats in _flat["reliquarySubstats"]:
_append_prop_id = _reliquary_sub_stats["appendPropId"]
stat_name = fight_map[_append_prop_id]
stat_value = to_float(_append_prop_id, _reliquary_sub_stats["statValue"])
_sub_stats = (stat_name, stat_value)
sub_stats.append(_sub_stats)
reliquary_sub_stats = _flat.get("reliquarySubstats")
if reliquary_sub_stats is not None:
for _reliquary_sub_stats in _flat["reliquarySubstats"]:
_append_prop_id = _reliquary_sub_stats["appendPropId"]
stat_name = fight_map[_append_prop_id]
stat_value = to_float(_append_prop_id, _reliquary_sub_stats["statValue"])
_sub_stats = (stat_name, stat_value)
sub_stats.append(_sub_stats)
slot = equip_type_map[_flat["equipType"]]
star = _flat["rankLevel"]
artifacts.append(
Expand Down

0 comments on commit 5d045a9

Please sign in to comment.