diff --git a/dependency/ResourceHacker.ini b/dependency/ResourceHacker.ini index 4c4e4ea..7b4cb46 100644 --- a/dependency/ResourceHacker.ini +++ b/dependency/ResourceHacker.ini @@ -1,9 +1,9 @@ [MRU List] -MRU1=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Might & Magic Heroes VI Shades of Darkness v2.1 Plus 20 Trainer.exe -MRU2=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Home Behind 2 Early Access Plus 22 Trainer.exe -MRU3=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Batman Arkham Knight v1.0-Update 2016.03.08 Plus 15 Trainer.exe -MRU4=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Halo The Master Chief Collection (Halo 3 ODST) v1.0-v20221219 Plus 13 Trainer.exe -MRU5= +MRU1=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Bright Memory Episode 1 Early Access Plus 5 Trainer Updated 2020.01.16.exe +MRU2=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Might & Magic Heroes VI Shades of Darkness v2.1 Plus 20 Trainer.exe +MRU3=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Home Behind 2 Early Access Plus 22 Trainer.exe +MRU4=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Batman Arkham Knight v1.0-Update 2016.03.08 Plus 15 Trainer.exe +MRU5=C:\Users\dyang\AppData\Local\Temp\GameCheatsManagerTemp\Halo The Master Chief Collection (Halo 3 ODST) v1.0-v20221219 Plus 13 Trainer.exe MRU6= MRU7= MRU8= diff --git a/gamecheats.py b/gamecheats.py index ae8d7c3..98f1e0b 100644 --- a/gamecheats.py +++ b/gamecheats.py @@ -544,8 +544,8 @@ def xhh_zhName(self, appid, trainerName): response = requests.get(xhhGameDetailUrl, headers=self.headers) xhhData = response.json() - # ======================================= - # Special cases, add as needed + # ======================================================= + # Special cases to match with Xiao Hei He game names if trainerName == "Assassin's Creed 3": trainerName = "Assassin's Creed III" elif trainerName == "Halo Infinite (Campaign)": @@ -626,6 +626,11 @@ def translate_keyword(self, keyword): return [keyword] def translate_trainer(self, trainerName): + # ======================================================= + # Special cases + if trainerName == "Bright.Memory.Episode.1 Trainer": + trainerName = "Bright Memory Episode 1 Trainer" + trans_trainerName = trainerName found_translation = False @@ -682,7 +687,7 @@ def is_match(sanitized_keyword, sanitized_targetString): sanitized_keyword, sanitized_targetString) return similarity >= similarity_threshold - sanitized_targetString = self.sanitize(targetString) + sanitized_targetString = self.sanitize(targetString.rsplit(" Trainer", 1)[0]) return any(is_match(self.sanitize(kw), sanitized_targetString) for kw in keyword if len(kw) >= 2 and len(sanitized_targetString) >= 2) @@ -893,7 +898,7 @@ def download_display(self, keyword): # parse trainer name rawTrainerName = link.get_text() parsedTrainerName = re.sub( - r' v.*|\.\bv.*| \d+\.\d+\.\d+.*| Plus\s\d+.*|Build\s\d+.*|(\d+\.\d+-Update.*)|Update\s\d+.*|\(Update\s.*| Early Access .*', '', rawTrainerName).replace("_", ": ") + r' v.*|\.\bv.*| \d+\.\d+\.\d+.*| Plus\s\d+.*|Build\s\d+.*|(\d+\.\d+-Update.*)|Update\s\d+.*|\(Update\s.*| Early Access .*|\.Early.Access.*', '', rawTrainerName).replace("_", ": ") trainerName = parsedTrainerName.strip() + " Trainer" # search algorithm @@ -949,7 +954,7 @@ def download_display(self, keyword): trainer_names = list(self.trainer_urls.keys()) # Using a dictionary to store future and its corresponding original trainer name - max_threads = 10 + max_threads = 5 with concurrent.futures.ThreadPoolExecutor(max_workers=max_threads) as executor: future_to_trainerName = {executor.submit( self.translate_trainer, trainerName): trainerName for trainerName in trainer_names}