From 1616f627559e44578e9f3f4a1318d7ce5f9a01f5 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 21 Apr 2025 22:40:11 +0800 Subject: [PATCH] wip: migrate backend to new game package --- .gitignore | 1 + app/package.json | 1 + app/src/components/game/DescriptionPart.vue | 16 +- app/src/components/game/QuestPart.vue | 3 +- app/src/store/session.ts | 55 ++- app/src/types.ts | 7 +- app/src/views/GamePage.vue | 2 +- app/src/views/RegisterPage.vue | 2 +- packages/game/src/schema/quest.ts | 2 +- packages/game/src/schema/response.ts | 2 +- packages/game/src/schema/stage.ts | 3 +- packages/models/src/session.ts | 4 +- packages/utils/src/dag.ts | 4 +- quests/cast/game.yml | 77 ++-- quests/checkpoint-01/answer.sh | 7 - quests/checkpoint-01/game.yml | 110 ----- quests/checkpoint-01/home/folder01/file1.txt | 0 quests/checkpoint-01/home/folder02/file2.txt | 0 quests/checkpoint-01/home/folder03/file3.txt | 0 quests/checkpoint-02/answer.sh | 7 - quests/checkpoint-02/game.yml | 108 ----- quests/checkpoint-02/home/hello.txt | 1 - ...oultramicroscopicsilicovolcanoconiosis.txt | 1 - quests/checkpoint-03/answer.sh | 12 - quests/checkpoint-03/game.yml | 153 ------- quests/checkpoint-03/home/folder/hello.txt | 1 - .../checkpoint-03/home/trash_can/garbage.txt | 0 .../checkpoint-03/home/trash_can/rubbish.txt | 0 .../home/trash_can/secret/letter.txt | 1 - quests/checkpoint-03/home/trash_can/trash.txt | 0 quests/copy/answer.sh | 13 - quests/copy/game.yml | 409 ------------------ quests/copy/home/hello.txt | 1 - quests/copy/home/notes/note.txt | 1 - quests/copy/home/world.txt | 1 - quests/create/answer.sh | 12 - quests/create/game.yml | 228 ---------- quests/exceptions.yml | 174 ++++---- quests/execute/execute.md | 80 ---- quests/execute/game.yml | 187 -------- quests/execute/home/commands/lucky | 3 - quests/execute/home/dog | 8 - quests/execute/home/hello.txt | 1 - quests/explore/answer.sh | 8 - quests/explore/game.yml | 175 -------- quests/explore/home/folder1/file1.txt | 0 quests/explore/home/folder1/file2.txt | 0 quests/explore/home/folder2/file3.txt | 0 quests/explore/home/folder2/file4.txt | 0 quests/get-started/answer.sh | 4 - quests/get-started/game.yml | 73 ---- quests/helloworld/answer.sh | 4 - quests/helloworld/game.yml | 97 ----- quests/helloworld/home/forgotten_scroll.txt | 9 - quests/move/answer.sh | 11 - quests/move/game.yml | 208 --------- quests/move/home/hello.txt | 1 - quests/move/home/notes/note.txt | 1 - quests/move/home/world.txt | 1 - quests/path/answer.sh | 8 - quests/path/game.yml | 168 ------- quests/path/home/folder1/file1.txt | 0 quests/path/home/folder1/file2.txt | 0 quests/path/home/folder2/file3.txt | 0 quests/path/home/folder2/file4.txt | 0 quests/read/answer.sh | 5 - quests/read/game.yml | 105 ----- quests/read/home/file1.txt | 1 - quests/read/home/folder/file.txt | 1 - quests/remove/answer.sh | 14 - quests/remove/game.yml | 259 ----------- quests/remove/home/empty/.gitkeep | 0 quests/remove/home/hello.txt | 1 - quests/remove/home/notes/note.txt | 1 - quests/remove/home/trash/garbage.txt | 0 quests/remove/home/trash/rubbish.txt | 0 quests/remove/home/trash/secrets/envelope.txt | 0 quests/remove/home/world.txt | 1 - quests/remove/home/wow.txt | 1 - quests/tab/game.yml | 196 --------- .../SuperSecretPlansForWorldDomination.txt | 10 - .../HowToProperlyMakeASandwich.txt | 9 - .../RandomStuffThatIDownloadedAt3AM.txt | 5 - .../RandomStuffThatIDownloadedAt4AM.txt | 5 - ...ieNmaeWthAloOfTpyosThatisRleayHdToRaed.txt | 3 - quests/tab/tab.md | 95 ---- .../src/api/controllers/commandController.ts | 23 +- .../src/api/controllers/sessionController.ts | 2 +- server/src/containers/cli.ts | 19 +- server/src/game/commandHandler.ts | 8 +- server/src/models/quest.ts | 28 +- server/src/models/sessionManager.ts | 29 +- server/src/routers/questRouter.ts | 29 +- server/src/routers/sessionRouter.ts | 2 +- 94 files changed, 263 insertions(+), 3055 deletions(-) delete mode 100644 quests/checkpoint-01/answer.sh delete mode 100644 quests/checkpoint-01/game.yml delete mode 100644 quests/checkpoint-01/home/folder01/file1.txt delete mode 100644 quests/checkpoint-01/home/folder02/file2.txt delete mode 100644 quests/checkpoint-01/home/folder03/file3.txt delete mode 100644 quests/checkpoint-02/answer.sh delete mode 100644 quests/checkpoint-02/game.yml delete mode 100644 quests/checkpoint-02/home/hello.txt delete mode 100644 quests/checkpoint-02/home/pneumonoultramicroscopicsilicovolcanoconiosis.txt delete mode 100644 quests/checkpoint-03/answer.sh delete mode 100644 quests/checkpoint-03/game.yml delete mode 100644 quests/checkpoint-03/home/folder/hello.txt delete mode 100644 quests/checkpoint-03/home/trash_can/garbage.txt delete mode 100644 quests/checkpoint-03/home/trash_can/rubbish.txt delete mode 100644 quests/checkpoint-03/home/trash_can/secret/letter.txt delete mode 100644 quests/checkpoint-03/home/trash_can/trash.txt delete mode 100644 quests/copy/answer.sh delete mode 100644 quests/copy/game.yml delete mode 100644 quests/copy/home/hello.txt delete mode 100644 quests/copy/home/notes/note.txt delete mode 100644 quests/copy/home/world.txt delete mode 100644 quests/create/answer.sh delete mode 100644 quests/create/game.yml delete mode 100644 quests/execute/execute.md delete mode 100644 quests/execute/game.yml delete mode 100755 quests/execute/home/commands/lucky delete mode 100755 quests/execute/home/dog delete mode 100644 quests/execute/home/hello.txt delete mode 100644 quests/explore/answer.sh delete mode 100644 quests/explore/game.yml delete mode 100644 quests/explore/home/folder1/file1.txt delete mode 100644 quests/explore/home/folder1/file2.txt delete mode 100644 quests/explore/home/folder2/file3.txt delete mode 100644 quests/explore/home/folder2/file4.txt delete mode 100644 quests/get-started/answer.sh delete mode 100644 quests/get-started/game.yml delete mode 100644 quests/helloworld/answer.sh delete mode 100644 quests/helloworld/game.yml delete mode 100644 quests/helloworld/home/forgotten_scroll.txt delete mode 100644 quests/move/answer.sh delete mode 100644 quests/move/game.yml delete mode 100644 quests/move/home/hello.txt delete mode 100644 quests/move/home/notes/note.txt delete mode 100644 quests/move/home/world.txt delete mode 100644 quests/path/answer.sh delete mode 100644 quests/path/game.yml delete mode 100644 quests/path/home/folder1/file1.txt delete mode 100644 quests/path/home/folder1/file2.txt delete mode 100644 quests/path/home/folder2/file3.txt delete mode 100644 quests/path/home/folder2/file4.txt delete mode 100644 quests/read/answer.sh delete mode 100644 quests/read/game.yml delete mode 100644 quests/read/home/file1.txt delete mode 100644 quests/read/home/folder/file.txt delete mode 100644 quests/remove/answer.sh delete mode 100644 quests/remove/game.yml delete mode 100644 quests/remove/home/empty/.gitkeep delete mode 100644 quests/remove/home/hello.txt delete mode 100644 quests/remove/home/notes/note.txt delete mode 100644 quests/remove/home/trash/garbage.txt delete mode 100644 quests/remove/home/trash/rubbish.txt delete mode 100644 quests/remove/home/trash/secrets/envelope.txt delete mode 100644 quests/remove/home/world.txt delete mode 100644 quests/remove/home/wow.txt delete mode 100644 quests/tab/game.yml delete mode 100644 quests/tab/home/SuperSecretPlansForWorldDomination.txt delete mode 100644 quests/tab/home/ThingsIWillOrganizeLaterWhenIHaveTime/HowToProperlyMakeASandwich.txt delete mode 100644 quests/tab/home/ThingsIWillOrganizeLaterWhenIHaveTime/RandomStuffThatIDownloadedAt3AM.txt delete mode 100644 quests/tab/home/ThingsIWillOrganizeLaterWhenIHaveTime/RandomStuffThatIDownloadedAt4AM.txt delete mode 100644 quests/tab/home/ThsisAFlieNmaeWthAloOfTpyosThatisRleayHdToRaed.txt delete mode 100644 quests/tab/tab.md diff --git a/.gitignore b/.gitignore index eeb5072..b831f99 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ config +.quest # Logs logs diff --git a/app/package.json b/app/package.json index 9d70fd4..78d5bd4 100644 --- a/app/package.json +++ b/app/package.json @@ -18,6 +18,7 @@ "@fortawesome/vue-fontawesome": "^3.0.3", "@linux-odyssey/constants": "*", "@linux-odyssey/file-graph": "*", + "@linux-odyssey/game": "*", "@linux-odyssey/models": "*", "@linux-odyssey/utils": "*", "@trpc/client": "^11.1.0", diff --git a/app/src/components/game/DescriptionPart.vue b/app/src/components/game/DescriptionPart.vue index 3e7257a..a7e3111 100644 --- a/app/src/components/game/DescriptionPart.vue +++ b/app/src/components/game/DescriptionPart.vue @@ -28,6 +28,10 @@ const right = () => { current.value += 1 } } + +const response = computed(() => { + return sessionStore.session?.responses[current.value] +})