mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
feat: update quest schema
* files * boolean operator
This commit is contained in:
1 parent
857e0e7f6a
commit
2f64175df2
2 files changed
+28
-25
No files matched your search
+20
-18
@@ -10,6 +10,25 @@ const responseSchema = new Schema({
|
||||
color: String,
|
||||
})
|
||||
|
||||
const fileConditionSchema = new Schema({
|
||||
path: String,
|
||||
type: String,
|
||||
exists: Boolean,
|
||||
})
|
||||
|
||||
const conditionSchema = new Schema({
|
||||
command: [String],
|
||||
output: [String],
|
||||
error: [String],
|
||||
pwd: [String],
|
||||
files: [fileConditionSchema],
|
||||
})
|
||||
|
||||
conditionSchema.add({
|
||||
OR: [conditionSchema],
|
||||
NOT: conditionSchema,
|
||||
})
|
||||
|
||||
const stageSchema = new Schema({
|
||||
id: {
|
||||
type: String,
|
||||
@@ -29,12 +48,7 @@ const stageSchema = new Schema({
|
||||
required: true,
|
||||
default: false,
|
||||
},
|
||||
condition: {
|
||||
command: [String],
|
||||
output: [String],
|
||||
error: [String],
|
||||
pwd: [String],
|
||||
},
|
||||
condition: conditionSchema,
|
||||
responses: {
|
||||
type: [responseSchema],
|
||||
required: true,
|
||||
@@ -52,18 +66,6 @@ const Quest = model(
|
||||
title: String,
|
||||
order: Number,
|
||||
instruction: String,
|
||||
tasks: {
|
||||
id: String,
|
||||
content: String,
|
||||
display: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
completed: {
|
||||
type: Boolean,
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
stages: [stageSchema],
|
||||
})
|
||||
)
|
||||
|
||||
@@ -168,8 +168,9 @@ stages:
|
||||
condition:
|
||||
pwd:
|
||||
- '^/home/commander$'
|
||||
include:
|
||||
- !*.txt
|
||||
files:
|
||||
- path: '*.txt'
|
||||
exists: false
|
||||
responses:
|
||||
- type: dialogue
|
||||
speaker: Unix 精靈
|
||||
@@ -178,7 +179,7 @@ stages:
|
||||
- 請使用 `rm [檔案名稱]` 來銷毀垃圾。
|
||||
- 這個 `rm` 指令也可以一次處理多的檔案喔,用法跟 `mv` 一樣。
|
||||
- 如果你忘記的話,看看這個範例:`rm [檔案名稱1] [檔案名稱2]`
|
||||
scroll
|
||||
|
||||
- id: remove-trash
|
||||
task: 銷毀垃圾
|
||||
repeatable: false
|
||||
@@ -187,8 +188,9 @@ scroll
|
||||
condition:
|
||||
pwd:
|
||||
- '^/home/commander$'
|
||||
include:
|
||||
- !*.trash
|
||||
files:
|
||||
- path: '*.trash'
|
||||
exists: false
|
||||
responses:
|
||||
- type: dialogue
|
||||
speaker: Unix 精靈
|
||||
@@ -248,7 +250,7 @@ scroll
|
||||
- type: dialogue
|
||||
speaker: Unix 精靈
|
||||
content:
|
||||
- 現在,你可以使用 `cd ..` 來回到上一層目錄。
|
||||
- 現在,你可以使用 `cd ..` 來回到上一層目錄。
|
||||
|
||||
- id: exit-bookcase
|
||||
task: 離開書櫃
|
||||
@@ -282,4 +284,3 @@ scroll
|
||||
- type: narrative
|
||||
content:
|
||||
- 你踏出了房門,真正的冒險現在才正要開始。
|
||||
|
||||
Reference in new issue
Block a user