Skip to content

Commit

Permalink
fix: minor bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kel-z committed Dec 15, 2023
1 parent 2d91f11 commit 5b65976
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/config/screenshot.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
"equipped_avatar": (0.3525, 0.9425, 0.4375, 0.99),
"mainStatKey": (0.115, 0.358, 0.7, 0.4),
"substat_names": (0.115, 0.41, 0.5, 0.6),
"substat_vals": (0.5, 0.41, 1, 0.6),
"substat_vals": (0.7, 0.41, 1, 0.6),
},
}
}
4 changes: 2 additions & 2 deletions src/services/scanner/parsers/light_cone_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ def check_filters(
stats_dict["level"] = self.extract_stats_data(
"level", stats_dict["level"]
)
if not level:
if not stats_dict["level"]:
self._log_signal.emit(
f"Light Cone ID {lc_id}: Failed to parse level. Setting to 1."
)
level = "1/20"
stats_dict["level"] = "1/20"
val = int(stats_dict["level"].split("/")[0])

if not isinstance(val, int):
Expand Down
4 changes: 3 additions & 1 deletion src/services/scanner/parsers/relic_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ def _parse_substats(

if not self._validate_substat(name, val, rarity):
self._log_signal.emit(
f"WARNING: Relic ID {relic_id}: Substat {name} has illegal value {val}."
f'WARNING: Relic ID {relic_id}: Substat {name} has illegal value "{val}".'
)

substats.append({"key": name, "value": val})
Expand All @@ -288,6 +288,8 @@ def _validate_substat(self, name: str, val: int | float, rarity: int) -> bool:
:return: True if the substat is valid, False otherwise
"""
try:
if name not in SUBSTAT_ROLL_VALS[str(rarity)]:
return False
if str(val) not in SUBSTAT_ROLL_VALS[str(rarity)][name]:
return False
except KeyError:
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ocr.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def preprocess_sub_stat_img(img: Image) -> Image:
:param img: The image to preprocess
:return: The preprocessed image
"""
img = _preprocess_img_by_colour_filter(img, (255, 255, 255), 95)
img = _preprocess_img_by_colour_filter(img, (255, 255, 255), 100)
return img


Expand Down

0 comments on commit 5b65976

Please sign in to comment.