diff --git a/HSRScanner.spec b/HSRScanner.spec index 15e06dc..df7da54 100644 --- a/HSRScanner.spec +++ b/HSRScanner.spec @@ -37,6 +37,7 @@ a.datas += [('images\\avatars\\Herta.png','src\\images\\avatars\\Herta.png', "DA a.datas += [('images\\avatars\\Himeko.png','src\\images\\avatars\\Himeko.png', "DATA")] a.datas += [('images\\avatars\\Hook.png','src\\images\\avatars\\Hook.png', "DATA")] a.datas += [('images\\avatars\\JingYuan.png','src\\images\\avatars\\JingYuan.png', "DATA")] +a.datas += [('images\\avatars\\Luocha.png','src\\images\\avatars\\Luocha.png', "DATA")] a.datas += [('images\\avatars\\March7th.png','src\\images\\avatars\\March7th.png', "DATA")] a.datas += [('images\\avatars\\Natasha.png','src\\images\\avatars\\Natasha.png', "DATA")] a.datas += [('images\\avatars\\Pela.png','src\\images\\avatars\\Pela.png', "DATA")] @@ -53,6 +54,7 @@ a.datas += [('images\\avatars\\Sushang.png','src\\images\\avatars\\Sushang.png', a.datas += [('images\\avatars\\Tingyun.png','src\\images\\avatars\\Tingyun.png', "DATA")] a.datas += [('images\\avatars\\Welt.png','src\\images\\avatars\\Welt.png', "DATA")] a.datas += [('images\\avatars\\Yanqing.png','src\\images\\avatars\\Yanqing.png', "DATA")] +a.datas += [('images\\avatars\\Yukong.png','src\\images\\avatars\\Yukong.png', "DATA")] pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) diff --git a/requirements.txt b/requirements.txt index 06edd1f..29da1d7 100644 Binary files a/requirements.txt and b/requirements.txt differ diff --git a/src/character_scanner.py b/src/character_scanner.py index e49a378..21dce69 100644 --- a/src/character_scanner.py +++ b/src/character_scanner.py @@ -5,6 +5,7 @@ from utils.game_data_helpers import get_character_meta_data, get_closest_character_name from utils.screenshot import Screenshot + class CharacterScanner: NAV_DATA = { "16:9": { @@ -34,7 +35,7 @@ def __init__(self, screenshot: Screenshot, logger, interrupt, update_progress) - self._screenshot = screenshot self._logger = logger self._trailblazerScanned = False - + def parse(self, stats_dict, eidlon_images): if self.interrupt.is_set(): return @@ -58,8 +59,8 @@ def parse(self, stats_dict, eidlon_images): try: character["level"] = int(level) except ValueError: - self.logger.emit(f"{character['key']}: Failed to parse level." + - (f" Got \"{level}\" instead." if level else "")) + self._logger.emit(f"{character['key']}: Failed to parse level." + + (f" Got \"{level}\" instead." if level else "")) if self._logger else None for img in eidlon_images: img = img.convert("L") @@ -101,7 +102,7 @@ def parse(self, stats_dict, eidlon_images): self.update_progress.emit(102) return character - + def get_traces_dict(self, path): if path == "The Hunt": traces_dict = self._screenshot.screenshot_character_hunt_traces() @@ -119,13 +120,14 @@ def get_traces_dict(self, path): traces_dict = self._screenshot.screenshot_character_abundance_traces() else: raise ValueError("Invalid path") - + return traces_dict def get_closest_name(self, character_name, path): if self.__is_trailblazer(): if self._trailblazerScanned: - self._logger.emit("WARNING: Parsed more than one Trailblazer. Please review JSON output.") + self._logger.emit( + "WARNING: Parsed more than one Trailblazer. Please review JSON output.") if self._logger else None else: self._trailblazerScanned = True @@ -137,7 +139,7 @@ def get_closest_name(self, character_name, path): if min_dist > 5: raise Exception( f"Character not found in database. Got {character_name}") - + return character_name def __is_trailblazer(self): @@ -148,4 +150,3 @@ def __is_trailblazer(self): return True return False - \ No newline at end of file diff --git a/src/images/avatars/Luocha.png b/src/images/avatars/Luocha.png new file mode 100644 index 0000000..6bad1d0 Binary files /dev/null and b/src/images/avatars/Luocha.png differ diff --git a/src/images/avatars/Yukong.png b/src/images/avatars/Yukong.png new file mode 100644 index 0000000..6dc5da4 Binary files /dev/null and b/src/images/avatars/Yukong.png differ diff --git a/src/images/avatars/avatars.psb b/src/images/avatars/avatars.psb index 023aeaf..3db7c62 100644 Binary files a/src/images/avatars/avatars.psb and b/src/images/avatars/avatars.psb differ diff --git a/src/light_cone_strategy.py b/src/light_cone_strategy.py index ae857de..26597a4 100644 --- a/src/light_cone_strategy.py +++ b/src/light_cone_strategy.py @@ -122,7 +122,7 @@ def parse(self, stats_dict, interrupt, update_progress): max_level = int(max_level) except ValueError: self._logger.emit( - f"Light Cone ID {self._curr_id}: Error parsing level, setting to 1") + f"Light Cone ID {self._curr_id}: Error parsing level, setting to 1") if self._logger else None level = 1 max_level = 20 @@ -132,7 +132,7 @@ def parse(self, stats_dict, interrupt, update_progress): superimposition = int(superimposition) except ValueError: self._logger.emit( - f"Light Cone ID {self._curr_id}: Error parsing superimposition, setting to 1") + f"Light Cone ID {self._curr_id}: Error parsing superimposition, setting to 1") if self._logger else None superimposition = 1 min_dim = min(lock.size) diff --git a/src/relic_strategy.py b/src/relic_strategy.py index 0e63470..3664c84 100644 --- a/src/relic_strategy.py +++ b/src/relic_strategy.py @@ -88,7 +88,7 @@ def extract_stats_data(self, key, img): if not level: self._logger.emit( f"Relic ID {self._curr_id}: Failed to extract level. Setting to 0." - ) + ) if self._logger else None level = 0 return int(level) elif key == "mainStatKey": @@ -132,7 +132,7 @@ def parse(self, stats_dict, interrupt, update_progress): key, "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcedfghijklmnopqrstuvwxyz", 7) if not key: # self._logger.emit( - # f"Relic ID {self._curr_id}: Failed to get key. Either it doesn't exist or the OCR failed.") + # f"Relic ID {self._curr_id}: Failed to get key. Either it doesn't exist or the OCR failed.") if self._logger else None break key, min_dist = get_closest_relic_sub_stat(key) if min_dist > 5: @@ -142,7 +142,7 @@ def parse(self, stats_dict, interrupt, update_progress): val = image_to_string(val_img, "0123456789.%", 7) if not val: # self._logger.emit( - # f"Relic ID {self._curr_id}: Found sub-stat with no value: {key}. Either it doesn't exist or the OCR failed.") + # f"Relic ID {self._curr_id}: Found sub-stat with no value: {key}. Either it doesn't exist or the OCR failed.") if self._logger else None break if val[-1] == '%': diff --git a/src/scanner.py b/src/scanner.py index c59eaea..7a28402 100644 --- a/src/scanner.py +++ b/src/scanner.py @@ -177,7 +177,8 @@ def scan_inventory(self, strategy): return tasks def scan_characters(self): - char_scanner = CharacterScanner(self._screenshot, self.logger, self.interrupt, self.update_progress) + char_scanner = CharacterScanner( + self._screenshot, self.logger, self.interrupt, self.update_progress) nav_data = char_scanner.NAV_DATA[self._aspect_ratio] # Get character count from Data Bank menu @@ -236,7 +237,8 @@ def scan_characters(self): try: path, character_name = map( str.strip, character_name.split("/")) - character_name = char_scanner.get_closest_name(character_name, path) + character_name = char_scanner.get_closest_name( + character_name, path) stats_dict["name"] = character_name # Get level @@ -277,7 +279,7 @@ def scan_characters(self): tasks.add(task) except Exception as e: self.logger.emit( - f"Failed to parse character {character_name}. Got \"{e}\" error. Skipping...") + f"Failed to parse character {character_name}. Got \"{e}\" error. Skipping...") if self._logger else None # Reset for next character self._nav.move_cursor_to(*nav_data["details_button"]) diff --git a/src/ui/hsr_scanner.py b/src/ui/hsr_scanner.py index d559c2a..9917753 100644 --- a/src/ui/hsr_scanner.py +++ b/src/ui/hsr_scanner.py @@ -227,7 +227,7 @@ def setupUi(self, MainWindow): def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate - MainWindow.setWindowTitle(_translate("MainWindow", "HSR Scanner beta v0.1.3")) + MainWindow.setWindowTitle(_translate("MainWindow", "HSR Scanner beta v0.1.4")) self.formGroupBox.setTitle(_translate("MainWindow", "Items to scan")) self.checkBoxScanLightCones.setText(_translate("MainWindow", "Light Cones")) self.checkBoxScanRelics.setText(_translate("MainWindow", "Relics")) @@ -261,7 +261,7 @@ def retranslateUi(self, MainWindow): "\n" -"

HSR SCANNER v0.1.3

\n" +"

HSR SCANNER v0.1.4

\n" "


\n" "

- BETA -

\n" "


\n" diff --git a/src/ui/hsr_scanner.ui b/src/ui/hsr_scanner.ui index f390dd3..13be430 100644 --- a/src/ui/hsr_scanner.ui +++ b/src/ui/hsr_scanner.ui @@ -35,7 +35,7 @@ false - HSR Scanner beta v0.1.3 + HSR Scanner beta v0.1.4 @@ -497,7 +497,7 @@ <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600; text-decoration: underline;">HSR SCANNER v0.1.3</span></p> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600; text-decoration: underline;">HSR SCANNER v0.1.4</span></p> <p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> <p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">- BETA -</span></p> <p align="center" style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> diff --git a/src/utils/game_data_helpers.py b/src/utils/game_data_helpers.py index 09cca51..5636036 100644 --- a/src/utils/game_data_helpers.py +++ b/src/utils/game_data_helpers.py @@ -208,6 +208,8 @@ "TrailblazerDestruction": {"e3": {"skill": 2, "talent": 2}, "e5": {"ult": 2, "basic": 1}}, "TrailblazerPreservation": {"e3": {"skill": 2, "talent": 2}, "e5": {"ult": 2, "basic": 1}}, "Silver Wolf": {"e3": {"skill": 2, "talent": 2}, "e5": {"ult": 2, "basic": 1}}, + "Luocha": {"e3": {"skill": 2, "basic": 1}, "e5": {"ult": 2, "talent": 2}}, + "Yukong": {"e3": {"skill": 2, "basic": 1}, "e5": {"ult": 2, "talent": 2}}, } RELIC_MAIN_STATS = {