feat: adjust rld achievement

This commit is contained in:
Zamitto 2024-10-20 12:48:04 -03:00
parent 63507f00f6
commit 993b35cf3b
2 changed files with 18 additions and 10 deletions

View File

@ -120,7 +120,7 @@ export const mergeAchievements = async (
const mergedLocalAchievements = unlockedAchievements.concat(newAchievements); const mergedLocalAchievements = unlockedAchievements.concat(newAchievements);
if (game?.remoteId) { if (game.remoteId) {
return HydraApi.put( return HydraApi.put(
"/profile/games/achievements", "/profile/games/achievements",
{ {

View File

@ -242,6 +242,13 @@ const processRld = (unlockedAchievements: any): UnlockedAchievement[] => {
const unlockedAchievement = unlockedAchievements[achievement]; const unlockedAchievement = unlockedAchievements[achievement];
if (unlockedAchievement?.State) { if (unlockedAchievement?.State) {
const unlocked = new DataView(
new Uint8Array(
Buffer.from(unlockedAchievement.State.toString(), "hex")
).buffer
).getUint32(0, true);
if (unlocked === 1) {
newUnlockedAchievements.push({ newUnlockedAchievements.push({
name: achievement, name: achievement,
unlockTime: unlockTime:
@ -253,6 +260,7 @@ const processRld = (unlockedAchievements: any): UnlockedAchievement[] => {
}); });
} }
} }
}
return newUnlockedAchievements; return newUnlockedAchievements;
}; };