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

View File

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

View File

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

View File

@ -8,11 +8,36 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from 'vue'; import { onActivated, onDeactivated, onMounted, onUnmounted, ref } from 'vue';
import MkAchievements from '@/components/MkAchievements.vue'; import MkAchievements from '@/components/MkAchievements.vue';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata'; import { definePageMetadata } from '@/scripts/page-metadata';
import { $i } from '@/account'; 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({ definePageMetadata({
title: i18n.ts.achievements, title: i18n.ts.achievements,

View File

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