feat: add alternative objectIds

This commit is contained in:
Zamitto 2024-10-06 02:32:22 -03:00
parent f5da836b1b
commit 456e7ed809

View file

@ -167,6 +167,14 @@ const getPathFromCracker = async (cracker: Cracker) => {
throw new Error(`Cracker ${cracker} not implemented`);
};
const getAlternativeObjectIds = (objectId: string) => {
if (objectId === "205100") {
return ["205100", "217980", "31292"];
}
return [objectId];
};
export const findAchievementFiles = async (game: Game) => {
const achievementFiles: AchievementFile[] = [];
@ -174,7 +182,8 @@ export const findAchievementFiles = async (game: Game) => {
for (const { folderPath, fileLocation } of await getPathFromCracker(
cracker
)) {
const filePath = path.join(folderPath, game.objectID, ...fileLocation);
for (const objectId of getAlternativeObjectIds(game.objectID)) {
const filePath = path.join(folderPath, objectId, ...fileLocation);
if (fs.existsSync(filePath)) {
achievementFiles.push({
@ -184,6 +193,7 @@ export const findAchievementFiles = async (game: Game) => {
}
}
}
}
return achievementFiles;
};