Skip to content

Commit

Permalink
v0.1.4: Add Luocha and Yukong to database
Browse files Browse the repository at this point in the history
  • Loading branch information
kel-z committed Jun 28, 2023
1 parent 6b77882 commit 2df7e38
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 20 deletions.
2 changes: 2 additions & 0 deletions HSRScanner.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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)

Expand Down
Binary file modified requirements.txt
Binary file not shown.
17 changes: 9 additions & 8 deletions src/character_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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
Expand All @@ -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")
Expand Down Expand Up @@ -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()
Expand All @@ -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

Expand All @@ -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):
Expand All @@ -148,4 +150,3 @@ def __is_trailblazer(self):
return True

return False

Binary file added src/images/avatars/Luocha.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/images/avatars/Yukong.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/images/avatars/avatars.psb
Binary file not shown.
4 changes: 2 additions & 2 deletions src/light_cone_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/relic_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down Expand Up @@ -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:
Expand All @@ -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] == '%':
Expand Down
8 changes: 5 additions & 3 deletions src/scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"])
Expand Down
4 changes: 2 additions & 2 deletions src/ui/hsr_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -261,7 +261,7 @@ def retranslateUi(self, MainWindow):
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'MS Shell Dlg 2\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
"<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>\n"
"<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>\n"
"<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>\n"
"<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>\n"
"<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>\n"
Expand Down
4 changes: 2 additions & 2 deletions src/ui/hsr_scanner.ui
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<bool>false</bool>
</property>
<property name="windowTitle">
<string>HSR Scanner beta v0.1.3</string>
<string>HSR Scanner beta v0.1.4</string>
</property>
<widget class="QWidget" name="centralwidget">
<property name="enabled">
Expand Down Expand Up @@ -497,7 +497,7 @@
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; text-decoration: underline;&quot;&gt;HSR SCANNER v0.1.3&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:12pt; font-weight:600; text-decoration: underline;&quot;&gt;HSR SCANNER v0.1.4&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;- BETA -&lt;/span&gt;&lt;/p&gt;
&lt;p align=&quot;center&quot; style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;
Expand Down
2 changes: 2 additions & 0 deletions src/utils/game_data_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down

0 comments on commit 2df7e38

Please sign in to comment.