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);
if (game?.remoteId) {
if (game.remoteId) {
return HydraApi.put(
"/profile/games/achievements",
{

View File

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