Skip to content

Commit c0702fd

Browse files
committed
Check if time-based achievements are unlocked before initializing them in main-boot
1 parent ac1e5a0 commit c0702fd

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

packages/frontend/src/boot/main-boot.ts

+17-11
Original file line numberDiff line numberDiff line change
@@ -216,19 +216,25 @@ export async function mainBoot() {
216216
claimAchievement('collectAchievements30');
217217
}
218218

219-
window.setInterval(() => {
220-
if (Math.floor(Math.random() * 20000) === 0) {
221-
claimAchievement('justPlainLucky');
222-
}
223-
}, 1000 * 10);
219+
if (!claimedAchievements.includes('justPlainLucky')) {
220+
window.setInterval(() => {
221+
if (Math.floor(Math.random() * 20000) === 0) {
222+
claimAchievement('justPlainLucky');
223+
}
224+
}, 1000 * 10);
225+
}
224226

225-
window.setTimeout(() => {
226-
claimAchievement('client30min');
227-
}, 1000 * 60 * 30);
227+
if (!claimedAchievements.includes('client30min')) {
228+
window.setTimeout(() => {
229+
claimAchievement('client30min');
230+
}, 1000 * 60 * 30);
231+
}
228232

229-
window.setTimeout(() => {
230-
claimAchievement('client60min');
231-
}, 1000 * 60 * 60);
233+
if (!claimedAchievements.includes('client60min')) {
234+
window.setTimeout(() => {
235+
claimAchievement('client60min');
236+
}, 1000 * 60 * 60);
237+
}
232238

233239
// 邪魔
234240
//const lastUsed = miLocalStorage.getItem('lastUsed');

0 commit comments

Comments
 (0)