Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dyang886 committed Jan 16, 2024
1 parent c3a456e commit 1ee3bf3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
10 changes: 5 additions & 5 deletions dependency/ResourceHacker.ini
Original file line number Diff line number Diff line change
@@ -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=
15 changes: 10 additions & 5 deletions gamecheats.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)":
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 1ee3bf3

Please sign in to comment.