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,
|
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({
|
const stageSchema = new Schema({
|
||||||
id: {
|
id: {
|
||||||
type: String,
|
type: String,
|
||||||
@@ -29,12 +48,7 @@ const stageSchema = new Schema({
|
|||||||
required: true,
|
required: true,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
condition: {
|
condition: conditionSchema,
|
||||||
command: [String],
|
|
||||||
output: [String],
|
|
||||||
error: [String],
|
|
||||||
pwd: [String],
|
|
||||||
},
|
|
||||||
responses: {
|
responses: {
|
||||||
type: [responseSchema],
|
type: [responseSchema],
|
||||||
required: true,
|
required: true,
|
||||||
@@ -52,18 +66,6 @@ const Quest = model(
|
|||||||
title: String,
|
title: String,
|
||||||
order: Number,
|
order: Number,
|
||||||
instruction: String,
|
instruction: String,
|
||||||
tasks: {
|
|
||||||
id: String,
|
|
||||||
content: String,
|
|
||||||
display: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
completed: {
|
|
||||||
type: Boolean,
|
|
||||||
default: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
stages: [stageSchema],
|
stages: [stageSchema],
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -168,8 +168,9 @@ stages:
|
|||||||
condition:
|
condition:
|
||||||
pwd:
|
pwd:
|
||||||
- '^/home/commander$'
|
- '^/home/commander$'
|
||||||
include:
|
files:
|
||||||
- !*.txt
|
- path: '*.txt'
|
||||||
|
exists: false
|
||||||
responses:
|
responses:
|
||||||
- type: dialogue
|
- type: dialogue
|
||||||
speaker: Unix 精靈
|
speaker: Unix 精靈
|
||||||
@@ -178,7 +179,7 @@ stages:
|
|||||||
- 請使用 `rm [檔案名稱]` 來銷毀垃圾。
|
- 請使用 `rm [檔案名稱]` 來銷毀垃圾。
|
||||||
- 這個 `rm` 指令也可以一次處理多的檔案喔,用法跟 `mv` 一樣。
|
- 這個 `rm` 指令也可以一次處理多的檔案喔,用法跟 `mv` 一樣。
|
||||||
- 如果你忘記的話,看看這個範例:`rm [檔案名稱1] [檔案名稱2]`
|
- 如果你忘記的話,看看這個範例:`rm [檔案名稱1] [檔案名稱2]`
|
||||||
scroll
|
|
||||||
- id: remove-trash
|
- id: remove-trash
|
||||||
task: 銷毀垃圾
|
task: 銷毀垃圾
|
||||||
repeatable: false
|
repeatable: false
|
||||||
@@ -187,8 +188,9 @@ scroll
|
|||||||
condition:
|
condition:
|
||||||
pwd:
|
pwd:
|
||||||
- '^/home/commander$'
|
- '^/home/commander$'
|
||||||
include:
|
files:
|
||||||
- !*.trash
|
- path: '*.trash'
|
||||||
|
exists: false
|
||||||
responses:
|
responses:
|
||||||
- type: dialogue
|
- type: dialogue
|
||||||
speaker: Unix 精靈
|
speaker: Unix 精靈
|
||||||
@@ -248,7 +250,7 @@ scroll
|
|||||||
- type: dialogue
|
- type: dialogue
|
||||||
speaker: Unix 精靈
|
speaker: Unix 精靈
|
||||||
content:
|
content:
|
||||||
- 現在,你可以使用 `cd ..` 來回到上一層目錄。
|
- 現在,你可以使用 `cd ..` 來回到上一層目錄。
|
||||||
|
|
||||||
- id: exit-bookcase
|
- id: exit-bookcase
|
||||||
task: 離開書櫃
|
task: 離開書櫃
|
||||||
@@ -282,4 +284,3 @@ scroll
|
|||||||
- type: narrative
|
- type: narrative
|
||||||
content:
|
content:
|
||||||
- 你踏出了房門,真正的冒險現在才正要開始。
|
- 你踏出了房門,真正的冒險現在才正要開始。
|
||||||
|
|
||||||
Reference in new issue
Block a user