(add) new achievement

This commit is contained in:
kakkokari-gtyih 2023-09-11 20:12:21 +09:00
parent 25e030a707
commit d16ef2e16e
5 changed files with 33 additions and 0 deletions

5
locales/index.d.ts vendored
View File

@ -1467,6 +1467,11 @@ export interface Locale {
"description": string;
"flavor": string;
};
"_smashTestNotificationButton": {
"title": string;
"description": string;
"flavor": string;
};
};
};
"_role": {

View File

@ -1391,6 +1391,10 @@ _achievements:
title: "Brain Diver"
description: "Brain Diverへのリンクを投稿した"
flavor: "Misskey-Misskey La-Tu-Ma"
_smashTestNotificationButton:
title: "セルフ通知破壊"
description: "通知テストを連打した"
flavor: "ほどほどにしておきましょう"
_role:
new: "ロールの作成"

View File

@ -85,6 +85,7 @@ export const ACHIEVEMENT_TYPES = [
'setNameToSyuilo',
'cookieClicked',
'brainDiver',
'smashTestNotificationButton',
] as const;
@Injectable()

View File

@ -81,6 +81,7 @@ export const ACHIEVEMENT_TYPES = [
'setNameToSyuilo',
'cookieClicked',
'brainDiver',
'smashTestNotificationButton',
] as const;
export const ACHIEVEMENT_BADGES = {
@ -454,6 +455,11 @@ export const ACHIEVEMENT_BADGES = {
bg: 'linear-gradient(0deg, rgb(144, 224, 255), rgb(255, 168, 252))',
frame: 'bronze',
},
'smashTestNotificationButton': {
img: '/fluent-emoji/1f514.png',
bg: 'linear-gradient(0deg, rgb(187 183 59), rgb(255 143 77))',
frame: 'bronze',
},
/* @see <https://github.com/misskey-dev/misskey/pull/10365#discussion_r1155511107>
} as const satisfies Record<typeof ACHIEVEMENT_TYPES[number], {
img: string;

View File

@ -6,6 +6,10 @@
import * as Misskey from 'misskey-js';
import * as os from '@/os';
import { globalEvents } from '@/events';
import { claimAchievement } from '@/scripts/achievements';
let smashCount = 0;
let smashTimer: number | null = null;
/**
*
@ -31,4 +35,17 @@ export function testNotification(type: 'client' | 'server'): void {
globalEvents.emit('clientNotification', notification);
break;
}
// セルフ通知破壊 実績関連
smashCount++;
if (smashCount >= 7) {
claimAchievement('smashTestNotificationButton');
smashCount = 0;
}
if (smashTimer) {
clearTimeout(smashTimer);
}
smashTimer = window.setTimeout(() => {
smashCount = 0;
}, 300);
}