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,15 +242,23 @@ const processRld = (unlockedAchievements: any): UnlockedAchievement[] => {
const unlockedAchievement = unlockedAchievements[achievement]; const unlockedAchievement = unlockedAchievements[achievement];
if (unlockedAchievement?.State) { if (unlockedAchievement?.State) {
newUnlockedAchievements.push({ const unlocked = new DataView(
name: achievement, new Uint8Array(
unlockTime: Buffer.from(unlockedAchievement.State.toString(), "hex")
new DataView( ).buffer
new Uint8Array( ).getUint32(0, true);
Buffer.from(unlockedAchievement.Time.toString(), "hex")
).buffer if (unlocked === 1) {
).getUint32(0, true) * 1000, newUnlockedAchievements.push({
}); name: achievement,
unlockTime:
new DataView(
new Uint8Array(
Buffer.from(unlockedAchievement.Time.toString(), "hex")
).buffer
).getUint32(0, true) * 1000,
});
}
} }
} }