From d83bd32429817b90cb81a297f78bfefd045c18f0 Mon Sep 17 00:00:00 2001 From: seria Date: Fri, 2 Feb 2024 10:33:55 +0800 Subject: [PATCH] refactor: Refactor percentage stat conversion --- enka/client.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/enka/client.py b/enka/client.py index 2ba01f0..6abd575 100644 --- a/enka/client.py +++ b/enka/client.py @@ -148,8 +148,7 @@ def _post_process_character(self, character: "Character") -> "Character": weapon.name = self._assets.text_map[weapon.name] for stat in weapon.stats: stat.name = self._assets.text_map[stat.type.value] - if stat.type.name in PERCENT_STAT_TYPES: - stat.value *= 100 + stat.value *= 100 if stat.type.name in PERCENT_STAT_TYPES else 1 # artifacts for artifact in character.artifacts: @@ -158,14 +157,12 @@ def _post_process_character(self, character: "Character") -> "Character": artifact.main_stat.name = self._assets.text_map[artifact.main_stat.type.value] for stat in artifact.sub_stats: stat.name = self._assets.text_map[stat.type.value] - if stat.type.name in PERCENT_STAT_TYPES: - stat.value *= 100 + stat.value *= 100 if stat.type.name in PERCENT_STAT_TYPES else 1 # stats for stat_type, stat in character.stats.items(): stat.name = self._assets.text_map.get(stat_type.name) - if stat_type.name in PERCENT_STAT_TYPES: - stat.value *= 100 + stat.value *= 100 if stat_type.name in PERCENT_STAT_TYPES else 1 # constellations for constellation in character.constellations: