diff --git a/core/clicker/blum.py b/core/clicker/blum.py index fae0dc9..92ce57f 100644 --- a/core/clicker/blum.py +++ b/core/clicker/blum.py @@ -110,11 +110,11 @@ def collect_pumpkin(screen: Any, rect: Tuple[int, int, int, int]) -> bool: for x, y in product(range(0, width, 20), range(0, height, 20)): r, g, b = screen.getpixel((x, y)) - pamkin_range = (35 < b < 63) and (220 <= r < 233) and (114 <= g < 128) + pumpkin_range = (35 < b < 75) and (200 <= r < 245) and (114 <= g < 140) play_button = screen.getpixel((int(width * 0.80), int(height * 0.63))) - if pamkin_range and not play_button == (255, 255, 255): + if pumpkin_range and not play_button == (255, 255, 255): screen_x = rect[0] + x screen_y = rect[1] + y mouse.move(screen_x, screen_y, absolute=True) @@ -134,8 +134,8 @@ def detect_reload_screen(screen: Any) -> bool: """ width, height = screen.size - x1, y1 = (math.ceil(width * 0.43781), math.ceil(height * 0.60252)) #grey reload button - x2, y2 = (math.ceil(width * 0.24626), math.ceil(height * 0.429775)) #white pixel on word + x1, y1 = (math.ceil(width * 0.43781), math.ceil(height * 0.60252)) # grey reload button + x2, y2 = (math.ceil(width * 0.24626), math.ceil(height * 0.429775)) # white pixel on word reload_button = screen.getpixel((x1, y1)) white_pixel = screen.getpixel((x2, y2)) @@ -185,7 +185,7 @@ def detect_replay(self, screen: Any, rect: Tuple[int, int, int, int]) -> bool: ) mouse.click(button=mouse.LEFT) - time.sleep(0.5) + time.sleep(1) self.replays += 1 return True diff --git a/core/config/config.json b/core/config/config.json index a18dc2e..70f7d92 100644 --- a/core/config/config.json +++ b/core/config/config.json @@ -1,5 +1,5 @@ { - "LANGUAGE": "en", + "LANGUAGE": "fa", "REPLAYS": 50, "REPLAY_DELAY": 3, "TOGGLE_HOTKEY": "p", diff --git a/core/localization/localization.py b/core/localization/localization.py index 2e4d5e4..d30540d 100644 --- a/core/localization/localization.py +++ b/core/localization/localization.py @@ -3,16 +3,16 @@ from core.logger.logger import logger -from typing import Dict +from typing import Dict, Union -def load_json_file(file_path: str) -> Dict: +def load_json_file(file_path: Union[str, Path]) -> Dict: """ Load a JSON file and return its contents as a dictionary. - :param: file_path (str): The path to the JSON file. + :param file_path: The path to the JSON file. - :return: Dict: Parsed JSON content, or an empty dictionary if an error occurs. + :return: Parsed JSON content, or an empty dictionary if an error occurs. """ try: with open(file_path, "r", encoding="utf-8") as file: @@ -48,13 +48,15 @@ def get_language(key: str) -> str: :param key: The key to look up in the language file. - :return: str: The localized string or an error message if key not found. + :return: The localized string or an error message if the key is not found. """ - lang: str = ( - get_config_value("LANGUAGE") or "en" - ) # Fallback to 'en' if LANGUAGE not found + lang: str = get_config_value("LANGUAGE") or "en" # Fallback to 'en' if LANGUAGE not found file_path: Path = Path(f"core/localization/langs/{lang}.json") - data: Dict = load_json_file(file_path) or load_json_file(f"core/localization/langs/en.json") + data: Dict = load_json_file(file_path) or load_json_file("core/localization/langs/en.json") - return data.get(key, f"Localization error: '{key}' not found.") + return ujson.dumps( + data.get(key, f"Localization error: '{key}' not found."), + ensure_ascii=False, + indent=4 + ) if lang == "fa" else data.get(key, f"Localization error: '{key}' not found.")