Skip to content

Commit

Permalink
Check if time-based achievements are unlocked before initializing the…
Browse files Browse the repository at this point in the history
…m in main-boot
  • Loading branch information
GeopJr committed Oct 5, 2024
1 parent ac1e5a0 commit c0702fd
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions packages/frontend/src/boot/main-boot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,19 +216,25 @@ export async function mainBoot() {
claimAchievement('collectAchievements30');
}

window.setInterval(() => {
if (Math.floor(Math.random() * 20000) === 0) {
claimAchievement('justPlainLucky');
}
}, 1000 * 10);
if (!claimedAchievements.includes('justPlainLucky')) {
window.setInterval(() => {
if (Math.floor(Math.random() * 20000) === 0) {
claimAchievement('justPlainLucky');
}
}, 1000 * 10);
}

window.setTimeout(() => {
claimAchievement('client30min');
}, 1000 * 60 * 30);
if (!claimedAchievements.includes('client30min')) {
window.setTimeout(() => {
claimAchievement('client30min');
}, 1000 * 60 * 30);
}

window.setTimeout(() => {
claimAchievement('client60min');
}, 1000 * 60 * 60);
if (!claimedAchievements.includes('client60min')) {
window.setTimeout(() => {
claimAchievement('client60min');
}, 1000 * 60 * 60);
}

// 邪魔
//const lastUsed = miLocalStorage.getItem('lastUsed');
Expand Down

0 comments on commit c0702fd

Please sign in to comment.