add some achievements

This commit is contained in:
syuilo 2023-01-21 15:30:29 +09:00
parent 951ab90b1a
commit 9d367882fb
6 changed files with 41 additions and 2 deletions

View file

@ -1119,6 +1119,12 @@ _achievements:
_htl20npm: _htl20npm:
title: "流れるTL" title: "流れるTL"
description: "ホームタイムラインの流速が20npmを越す" description: "ホームタイムラインの流速が20npmを越す"
_outputHelloWorldOnScratchpad:
title: "Hello, world!"
description: "スクラッチパッドで hello world を出力した"
_open3windows:
title: "マルチウィンドウ"
description: "ウィンドウを3つ以上開いた状態にした"
_driveFolderCircularReference: _driveFolderCircularReference:
title: "循環参照" title: "循環参照"
description: "ドライブのフォルダを再帰的な入れ子にしようとした" description: "ドライブのフォルダを再帰的な入れ子にしようとした"

View file

@ -65,6 +65,8 @@ const ACHIEVEMENT_TYPES = [
'postedAt0min0sec', 'postedAt0min0sec',
'selfQuote', 'selfQuote',
'htl20npm', 'htl20npm',
'outputHelloWorldOnScratchpad',
'open3windows',
'driveFolderCircularReference', 'driveFolderCircularReference',
'reactWithoutRead', 'reactWithoutRead',
'clickedClickHere', 'clickedClickHere',

View file

@ -24,7 +24,7 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ComputedRef, inject, provide } from 'vue'; import { ComputedRef, inject, onMounted, onUnmounted, provide } from 'vue';
import RouterView from '@/components/global/RouterView.vue'; import RouterView from '@/components/global/RouterView.vue';
import MkWindow from '@/components/MkWindow.vue'; import MkWindow from '@/components/MkWindow.vue';
import { popout as _popout } from '@/scripts/popout'; import { popout as _popout } from '@/scripts/popout';
@ -35,6 +35,8 @@ import { mainRouter, routes } from '@/router';
import { Router } from '@/nirax'; import { Router } from '@/nirax';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
import { PageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata'; import { PageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata';
import { openingWindowsCount } from '@/os';
import { claimAchievement } from '@/scripts/achievements';
const props = defineProps<{ const props = defineProps<{
initialPath: string; initialPath: string;
@ -128,6 +130,17 @@ function popout() {
windowEl.close(); windowEl.close();
} }
onMounted(() => {
openingWindowsCount.value++;
if (openingWindowsCount.value >= 3) {
claimAchievement('open3windows');
}
});
onUnmounted(() => {
openingWindowsCount.value--;
});
defineExpose({ defineExpose({
close, close,
}); });

View file

@ -9,7 +9,7 @@ import * as Misskey from 'misskey-js';
import { i18n } from './i18n'; import { i18n } from './i18n';
import MkPostFormDialog from '@/components/MkPostFormDialog.vue'; import MkPostFormDialog from '@/components/MkPostFormDialog.vue';
import MkWaitingDialog from '@/components/MkWaitingDialog.vue'; import MkWaitingDialog from '@/components/MkWaitingDialog.vue';
import MkPageWindow from '@/components/MkPageWindow.vue' import MkPageWindow from '@/components/MkPageWindow.vue';
import MkToast from '@/components/MkToast.vue'; import MkToast from '@/components/MkToast.vue';
import MkDialog from '@/components/MkDialog.vue'; import MkDialog from '@/components/MkDialog.vue';
import MkEmojiPickerDialog from '@/components/MkEmojiPickerDialog.vue'; import MkEmojiPickerDialog from '@/components/MkEmojiPickerDialog.vue';
@ -18,6 +18,8 @@ import MkPopupMenu from '@/components/MkPopupMenu.vue';
import MkContextMenu from '@/components/MkContextMenu.vue'; import MkContextMenu from '@/components/MkContextMenu.vue';
import { MenuItem } from '@/types/menu'; import { MenuItem } from '@/types/menu';
export const openingWindowsCount = ref(0);
export const apiWithDialog = (( export const apiWithDialog = ((
endpoint: string, endpoint: string,
data: Record<string, any> = {}, data: Record<string, any> = {},

View file

@ -47,6 +47,7 @@ import { definePageMetadata } from '@/scripts/page-metadata';
import { AsUiComponent, AsUiRoot, patch, registerAsUiLib, render } from '@/scripts/aiscript/ui'; import { AsUiComponent, AsUiRoot, patch, registerAsUiLib, render } from '@/scripts/aiscript/ui';
import MkAsUi from '@/components/MkAsUi.vue'; import MkAsUi from '@/components/MkAsUi.vue';
import { miLocalStorage } from '@/local-storage'; import { miLocalStorage } from '@/local-storage';
import { claimAchievement } from '@/scripts/achievements';
const parser = new Parser(); const parser = new Parser();
let aiscript: Interpreter; let aiscript: Interpreter;
@ -90,6 +91,9 @@ async function run() {
}); });
}, },
out: (value) => { out: (value) => {
if (value.type === 'str' && value.value.toLowerCase().replace(',', '').includes('hello world')) {
claimAchievement('outputHelloWorldOnScratchpad');
}
logs.value.push({ logs.value.push({
id: Math.random(), id: Math.random(),
text: value.type === 'str' ? value.value : utils.valToString(value), text: value.type === 'str' ? value.value : utils.valToString(value),

View file

@ -61,6 +61,8 @@ export const ACHIEVEMENT_TYPES = [
'postedAt0min0sec', 'postedAt0min0sec',
'selfQuote', 'selfQuote',
'htl20npm', 'htl20npm',
'outputHelloWorldOnScratchpad',
'open3windows',
'driveFolderCircularReference', 'driveFolderCircularReference',
'reactWithoutRead', 'reactWithoutRead',
'clickedClickHere', 'clickedClickHere',
@ -346,6 +348,16 @@ export const ACHIEVEMENT_BADGES = {
bg: 'linear-gradient(0deg, rgb(220 223 225), rgb(172 192 207))', bg: 'linear-gradient(0deg, rgb(220 223 225), rgb(172 192 207))',
frame: 'bronze', frame: 'bronze',
}, },
'outputHelloWorldOnScratchpad': {
img: '/fluent-emoji/1f530.png',
bg: 'linear-gradient(0deg, rgb(58 231 198), rgb(37 194 255))',
frame: 'bronze',
},
'open3windows': {
img: '/fluent-emoji/1f5a5.png',
bg: 'linear-gradient(0deg, rgb(144 224 255), rgb(255 168 252))',
frame: 'bronze',
},
'driveFolderCircularReference': { 'driveFolderCircularReference': {
img: '/fluent-emoji/1f4c2.png', img: '/fluent-emoji/1f4c2.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))',