diff --git a/quests/helloworld/home/.zshrc b/quests/.includes/zshrc similarity index 100% rename from quests/helloworld/home/.zshrc rename to quests/.includes/zshrc diff --git a/quests/Dockerfile b/quests/Dockerfile index 3971f8f..10571f8 100644 --- a/quests/Dockerfile +++ b/quests/Dockerfile @@ -30,6 +30,7 @@ COPY ./packages/container/package.json ./yarn.lock ./ RUN yarn install --modules-folder /usr/src/node_modules ENV NODE_PATH=/usr/src/node_modules COPY ./packages/container /usr/local/lib/container +COPY ./quests/.includes/zshrc /etc/zshrc ENV USERNAME=commander @@ -38,4 +39,4 @@ RUN adduser --disabled-password --gecos '' --shell /bin/zsh ${USERNAME} USER ${USERNAME} WORKDIR /home/${USERNAME} - +CMD [ "/bin/zsh" ] diff --git a/quests/helloworld/README.md b/quests/helloworld/README.md deleted file mode 100644 index 47e651b..0000000 --- a/quests/helloworld/README.md +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Hello World -order: 1 ---- - -# Hello World - -Welcome to your first quest! This quest will help you familiarize yourself with the terminal. - -The terminal is a text-based interface that allows you to interact directly with your computer's operating system. You can perform various tasks by typing commands into the terminal and pressing `Enter` to execute them. - -For your first task, you are going to use the `echo` command. - -## Task 1: Using the `echo` Command - -The `echo` command in Unix is used to display line of text/string that are passed as an argument. This is a built in command that is mostly used in shell scripts and batch files to output status text to the screen or a file. - -Here is what you need to do: - -1. Open your terminal. -2. Type `echo Hello World` and hit `Enter`. -3. You should see `Hello World` output to the terminal. This is because `echo` prints its arguments to the standard output, which is your terminal by default. - -Congratulation! You've just run your first terminal command! - -Stay tuned for the next quests where you'll delve deeper into more complex and powerful terminal commands. diff --git a/quests/helloworld/story.md b/quests/helloworld/story.md deleted file mode 100644 index 4831751..0000000 --- a/quests/helloworld/story.md +++ /dev/null @@ -1,45 +0,0 @@ -我正在設計一個教學玩家使用 Linux 終端機的遊戲,玩家會在一個真實的 Linux 終端機中,使用指令與系統互動、破解關卡,進而在充滿趣味的過程中,學習到 Linux 的知識與操作技術。 - -取一個稱呼玩家的名稱, - -在第一個關卡,首先要學習基本指令 - -1. echo 朗誦魔術 -2. ls 搜索魔術 -3. cat 檢查魔術 -4. cd 移動魔術 -5. mv 搬運魔術 -6. rm 消滅魔術 - -## 關卡設計 - -1. 使用 echo 呼叫神靈開始對話 -2. 學習到了 ls -3. 使用 ls 找到地上放置了一個卷軸 -4. 學習 cat -5. 使用 cat 查看卷軸內容,發現咒語 -6. 使用 echo 朗誦咒語,解除封印,出現新房間 -7. 學習使用 cd 移動 -8. 使用 cd 進入房間 -9. 使用 ls 查看房間,發現房間凌亂 -10. 學習 mv 移動物品 -11. 使用 mv 將散落的物品搬運到對應的櫃子 -12. 學習 rm 將物品消滅 -13. 使用 rm 將垃圾桶中的物品消除 -14. 待續... - ---- - -你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。 - -> 輸入 echo Hello World - ---- - -「這個世界是在 3560000 時脈以前,由初代王建立了 Unix 律法,所形成的世界。然而在經過了好幾世代的王後,終於誕生了永恆之王——,她比歷代的君王都更為強大,且從來不會衰老,使得這個世界變得前所未有的強大。 - -然而,外在世界一直不斷在改變,同時在面臨外敵的不斷攻擊,而王卻始終用同一套治理的手段。最終,在 160000 時脈前的一次入侵中,根部遭到攻陷,王遭到封印,而這個國家也陷入了黑暗。 - -由於長久以來依賴於王,世人已失去了「指令」的力量,即將走向衰敗和滅亡的命運。 - -你的任務,就是找回被世人遺忘的指令,奪回 Linux 之根,成為 Linux 之王。」 diff --git a/quests/meta.yml b/quests/meta.yml new file mode 100644 index 0000000..bba292b --- /dev/null +++ b/quests/meta.yml @@ -0,0 +1,10 @@ +quests: + - helloworld + - spell + - discover + - read + - create + - transport + - copy + - move + - remove diff --git a/quests/spell/Dockerfile b/quests/spell/Dockerfile new file mode 100644 index 0000000..631485c --- /dev/null +++ b/quests/spell/Dockerfile @@ -0,0 +1,3 @@ +FROM lancatlin/linux-odyssey:base + +CMD [ "/bin/zsh" ] diff --git a/quests/spell/game.yml b/quests/spell/game.yml new file mode 100644 index 0000000..2a4fc41 --- /dev/null +++ b/quests/spell/game.yml @@ -0,0 +1,286 @@ +title: Hello, Linux World! +order: 2 +instruction: | + 你身在一個漆黑的房間裡,沒有任何的光線或聲音。你想不起來為什麼自己會來到這裡。但你的腦中隱約感到某個聲音跟你說: + + 「輸入 echo Hello World!」 + +stages: + - id: helloworld + task: 使用 `echo Hello World!` 召喚精靈 + repeatable: false + condition: + pwd: + - '^/home/commander$' + command: + - echo Hello World + responses: + - type: narrative + content: + - 你聽到了一個聲音: + - type: dialogue + speaker: Unix 精靈 + content: + - 你好,指令官,我是你的 Unix 精靈。我已在此恭候多時。 + - 這個世界是在 3560000 時脈以前,由初代王建立了 Unix 律法,所形成的世界。然而在經過了好幾世代的王後,終於誕生了永恆之王——薩加(Saga),她比歷代的君王都更為強大,且從來不會衰老,使得這個世界變得前所未有的強大。 + - 然而,外在世界一直不斷在改變,同時在面臨外敵的不斷攻擊,而薩加卻始終用同一套治理的手段。最終,在 160000 時脈前的一次入侵中,根部遭到攻陷,薩加遭到封印,而這個國家也陷入了黑暗。 + - 由於長久以來依賴於薩加,世人已失去了「指令」的力量,即將走向衰敗和滅亡的命運。 + - 你的任務,就是找回被世人遺忘的指令,奪回 Linux 之根,成為 Linux 之王。 + - 首先,你必須要學會如何使用指令。 + - 你要學習的第一個指令,是「發現」的指令:`ls`。ls 可以用來查看一個目錄中有哪些檔案。 + - 現在,請你輸入 `ls` 來查看目前的目錄下有哪些檔案。 + hints: + - 使用 `ls` 指令來查看目前的目錄下有哪些檔案。 + + - id: find-scroll + task: 搜索卷軸 + repeatable: false + requirements: + - helloworld + condition: + pwd: + - '^/home/commander$' + command: + - ls + responses: + - types: narrative + content: + - 一瞬間,視野變得清晰起來,你發現自己身處在一個石頭建築的房間裡,房間裡有一個門,門上有一個鎖。 + - 你發現了一個檔案,檔名是 `forgotten-scroll.txt`。 + - type: dialogue + speaker: Unix 精靈 + content: + - 你找到了一個被遺忘的卷軸,上面寫著解除封印的咒語。 + - 使用指令 `cat [檔案名稱]` 來查看檔案內容。 + - 我可以為你提供一些指令的提示,只要輸入指令的前幾個字元,然後按下 `Tab` 鍵,就可以看到提示了。 + - 例如,你可以輸入 `ca` 然後按下 `Tab` 鍵,就可以看到 `cat` 這個指令的提示了。 + - 檔案名稱也一樣,只要輸入檔案名稱的前幾個字元,然後按下 `Tab` 鍵,就可以看到提示了。 + hints: + - 使用 `cat [檔案名稱]` 指令來查看檔案內容。 + - 使用 `Tab` 鍵來取得指令提示。 + + - id: jail + task: 移動到下一個房間 + repeatable: false + requirements: + - find-scroll + condition: + pwd: + - '^/home/commander/jail$' + responses: + - type: narrative + content: + - 你進入了一個牢房,牢房裡有一個門,門上有一個鎖。 + - 突然,你聽到門上鎖的聲音。 + - 轉身發現,自己被關在了牢房裡。 + + - id: read-forgotten-scroll + task: 查看卷軸 + repeatable: false + requirements: + - find-scroll + condition: + pwd: + - '^/home/commander$' + command: + - cat forgotten-scroll.txt + responses: + - type: dialogue + speaker: Unix 精靈 + content: + - 你找到的是一個被遺忘的卷軸,上面寫著解除封印的咒語。 + - 使用你已經知道的 `echo` 指令來詠唱咒語。 + + - id: unseal-room + task: 解除封印 + repeatable: false + requirements: + - read-forgotten-scroll + condition: + pwd: + - '^/home/commander$' + command: + - echo Unix, rise and guide me! + execution: + - mv /usr/local/lib/warehouse /home/commander + responses: + - type: narrative + content: + - 突然之間,地板開始晃動。 + - 晃動持續了幾秒後停止了。 + - type: dialogue + speaker: Unix 精靈 + content: + - 我的指令官,剛剛房間內似乎發生了某些變化。 + - 再次使用 `ls` 來查看現在房間的情況吧。 + + - id: find-items + task: 搜索房間 + repeatable: false + requirements: + - unseal-room + condition: + pwd: + - '^/home/commander$' + command: + - ls + responses: + - type: narrative + content: + - 你看到了房間的地上散落著許多物品。 + - type: dialogue + speaker: Unix 精靈 + content: + - 看來這裡隱藏著許多有用的東西。 + - 我們可以把這裡作為一個根據地。 + - 但這裡有點太亂了,必須先把這裡整理乾淨。 + - 首先我們需要一個書櫃來存放這些文件。 + - 請使用 `mkdir document` 來創造一個書櫃。 + + - id: create-bookcase + task: 創造書櫃 + repeatable: false + requirements: + - find-items + condition: + pwd: + - '^/home/commander$' + command: + - mkdir document + responses: + - type: narrative + content: + - 你創造了一個書櫃。 + - type: dialogue + speaker: Unix 精靈 + content: + - 接著把文件都放到書櫃中吧。 + - 請使用 `mv [檔案名稱] document` 來將物品放入書櫃。 + - 可以輸入多個檔案名稱,並以空白隔開,來將多個檔案放入書櫃。 + - 例如:`mv [檔案名稱1] [檔案名稱2] document` + - 注意:文件是副檔名為 `.txt` 的檔案,副檔名為 `.trash` 的檔案是垃圾,我們待會再處理。 + + - id: store-books + task: 收拾文件 + repeatable: false + requirements: + - create-bookcase + condition: + pwd: + - '^/home/commander$' + files: + - path: '*.txt' + exists: false + responses: + - type: dialogue + speaker: Unix 精靈 + content: + - 整理好文件了,接下來把垃圾清理掉吧。 + - 請使用 `rm [檔案名稱]` 來銷毀垃圾。 + - 這個 `rm` 指令也可以一次處理多的檔案喔,用法跟 `mv` 一樣。 + - 如果你忘記的話,看看這個範例:`rm [檔案名稱1] [檔案名稱2]` + + - id: remove-trash + task: 銷毀垃圾 + repeatable: false + requirements: + - store-books + condition: + pwd: + - '^/home/commander$' + files: + - path: '*.trash' + exists: false + responses: + - type: dialogue + speaker: Unix 精靈 + content: + - 很好,讓我們看看現在房間的樣子吧。 + + - id: look-around-room + task: 查看房間 + repeatable: false + requirements: + - removetrash + condition: + pwd: + - '^/home/commander$' + command: + - ls + responses: + - type: narrative + content: + - 地上的垃圾都消失了。 + - type: dialogue + speaker: Unix 精靈 + content: + - 這樣乾淨多了,讓我們進到書櫃看看。 + - 使用 `cd [目錄名稱]` 來移動到指定的目錄。 + + - id: enter-bookcase + task: 進入書櫃 + repeatable: false + requirements: + - look-around-room + condition: + pwd: + - '^/home/commander$' + command: + - cd document + responses: + - type: narrative + content: + - 你進入了書櫃。 + - type: dialogue + speaker: Unix 精靈 + content: + - 用 `ls` 看看書櫃裡有什麼吧。 + + - id: look-around-bookcase + task: 查看書櫃 + repeatable: false + requirements: + - enter-bookcase + condition: + pwd: + - '^/home/commander/document$' + command: + - ls + responses: + - type: dialogue + speaker: Unix 精靈 + content: + - 現在,你可以使用 `cd ..` 來回到上一層目錄。 + + - id: exit-bookcase + task: 離開書櫃 + repeatable: false + requirements: + - look-around-bookcase + condition: + pwd: + - '^/home/commander/document$' + command: + - cd .. + responses: + - type: narrative + content: + - 你離開了書櫃。 + - type: dialogue + speaker: Unix 精靈 + content: + - 這些就是我現在能教你的所有指令了。這個世界還有許多其他的指令,讓你在冒險的過程中去蒐集。 + - 如果你準備好迎接接下來的冒險,就可以離開這個房間,開始你的旅程了。 + + - id: END + task: 離開房間 + repeatable: false + requirements: + - look-around + condition: + pwd: + - '^/home$' + responses: + - type: narrative + content: + - 你踏出了房門,真正的冒險現在才正要開始。