add some achievements

This commit is contained in:
syuilo 2023-01-21 16:06:49 +09:00
parent 9d367882fb
commit 2b377a3dc5
5 changed files with 56 additions and 6 deletions

View file

@ -1095,6 +1095,9 @@ _achievements:
_collectAchievements30:
title: "実績コレクター"
description: "実績を30個以上獲得した"
_viewAchievements3min:
title: "実績好き"
description: "実績一覧を3分以上眺め続けた"
_iLoveMisskey:
title: "I Love Misskey"
description: "\"I ❤ #Misskey\"を投稿した"
@ -1152,6 +1155,9 @@ _achievements:
_loggedInOnBirthday:
title: "ハッピーバースデー"
description: "誕生日にログインした"
_loggedInOnNewYearsDay:
title: "あけましておめでとうございます"
description: "元日にログインした"
_cookieClicked:
title: "クッキーをクリックするゲーム"
description: "クッキーをクリックした"

View file

@ -41,6 +41,7 @@ const ACHIEVEMENT_TYPES = [
'passedSinceAccountCreated2',
'passedSinceAccountCreated3',
'loggedInOnBirthday',
'loggedInOnNewYearsDay',
'noteClipped1',
'noteFavorited1',
'profileFilled',
@ -58,6 +59,7 @@ const ACHIEVEMENT_TYPES = [
'followers500',
'followers1000',
'collectAchievements30',
'viewAchievements3min',
'iLoveMisskey',
'client30min',
'noteDeletedWithin1min',

View file

@ -346,10 +346,11 @@ import { claimAchievement, claimedAchievements } from './scripts/achievements';
});
}
if ($i.birthday) {
const now = new Date();
const m = now.getMonth() + 1;
const d = now.getDate();
if ($i.birthday) {
const bm = parseInt($i.birthday.split('-')[1]);
const bd = parseInt($i.birthday.split('-')[2]);
if (m === bm && d === bd) {
@ -357,6 +358,10 @@ import { claimAchievement, claimedAchievements } from './scripts/achievements';
}
}
if (m === 1 && d === 1) {
claimAchievement('loggedInOnNewYearsDay');
}
if ($i.loggedInDays >= 3) claimAchievement('login3');
if ($i.loggedInDays >= 7) claimAchievement('login7');
if ($i.loggedInDays >= 15) claimAchievement('login15');

View file

@ -8,11 +8,36 @@
</template>
<script lang="ts" setup>
import { ref } from 'vue';
import { onActivated, onDeactivated, onMounted, onUnmounted, ref } from 'vue';
import MkAchievements from '@/components/MkAchievements.vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import { $i } from '@/account';
import { claimAchievement } from '@/scripts/achievements';
let timer;
function viewAchievements3min() {
claimAchievement('viewAchievements3min');
}
onMounted(() => {
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
});
onUnmounted(() => {
window.clearTimeout(timer);
timer = null;
});
onActivated(() => {
if (timer == null) timer = window.setTimeout(viewAchievements3min, 1000 * 60 * 3);
});
onDeactivated(() => {
window.clearTimeout(timer);
timer = null;
});
definePageMetadata({
title: i18n.ts.achievements,

View file

@ -37,6 +37,7 @@ export const ACHIEVEMENT_TYPES = [
'passedSinceAccountCreated2',
'passedSinceAccountCreated3',
'loggedInOnBirthday',
'loggedInOnNewYearsDay',
'noteClipped1',
'noteFavorited1',
'profileFilled',
@ -54,6 +55,7 @@ export const ACHIEVEMENT_TYPES = [
'followers500',
'followers1000',
'collectAchievements30',
'viewAchievements3min',
'iLoveMisskey',
'client30min',
'noteDeletedWithin1min',
@ -289,7 +291,7 @@ export const ACHIEVEMENT_BADGES = {
frame: 'bronze',
},
'followers100': {
img: '/fluent-emoji/1f396.png',
img: '/fluent-emoji/1f60e.png',
bg: 'linear-gradient(0deg, rgb(144 224 255), rgb(255 168 252))',
frame: 'silver',
},
@ -313,6 +315,11 @@ export const ACHIEVEMENT_BADGES = {
bg: 'linear-gradient(0deg, rgb(255 77 77), rgb(247 155 214))',
frame: 'silver',
},
'viewAchievements3min': {
img: '/fluent-emoji/1f3c5.png',
bg: 'linear-gradient(0deg, rgb(144 224 255), rgb(255 168 252))',
frame: 'bronze',
},
'iLoveMisskey': {
img: '/fluent-emoji/2764.png',
bg: 'linear-gradient(0deg, rgb(255 77 77), rgb(247 155 214))',
@ -400,7 +407,12 @@ export const ACHIEVEMENT_BADGES = {
},
'loggedInOnBirthday': {
img: '/fluent-emoji/1f382.png',
bg: 'linear-gradient(0deg, rgb(144 224 255), rgb(255 168 252))',
bg: 'linear-gradient(0deg, rgb(255 77 77), rgb(247 155 214))',
frame: 'silver',
},
'loggedInOnNewYearsDay': {
img: '/fluent-emoji/1f38d.png',
bg: 'linear-gradient(0deg, rgb(255 144 144), rgb(255 232 168))',
frame: 'silver',
},
'cookieClicked': {