# 從零開始的楓之谷私服
###### tags: `Maplestory` `Tutorials`
[ToC]
## :memo: 事前準備
### Step 1: 下載主程式以及資源
| Item | Link |
| ----------------- |:----------------------- |
| 主程式 | [:link:][ClientLink] |
| 本地端連線檔案 | [:link:][LocalHostFile]|
| 伺服器快取檔 | [:link:][ServerResource] |
| 伺服器源碼 | [:link:][Server] |
| Java 16 | [:link:][JDK16] |
| MySQL Server | [:link:][MySQL] |
| Intellij IDEA | [:link:][IntellijIDEA]|
| Navicat (資料庫管理) | [:link:][DBManager]|
[ClientLink]: https://drive.google.com/file/d/1F2D1NabyRVDwhxRnI_kQYULklvuBffVr/view?usp=sharing
[ServerResource]: https://drive.google.com/file/d/14CN-TpcOUL4sJKmgq3u6I1AlbvQJV3dg/view?usp=sharing
[Server]: https://bitbucket.org/swordiemen/swordie/src/master/
[JDK16]: https://www.oracle.com/java/technologies/javase/jdk16-archive-downloads.html
[MySQL]: https://dev.mysql.com/downloads/installer
[LocalHostFile]:
https://drive.google.com/file/d/1o5nfssBb133FdjwAPCUwCs6mmQlZ6alr/view?usp=sharing
[IntellijIDEA]:
https://www.jetbrains.com/idea/download/
[DBManager]:https://drive.google.com/file/d/1XIrY49aTIFTkBmvm6KqzFm2L1b1nYpp5/view?usp=sharing
:rocket:
### Step 2: Clone Code


### Step 3: Setting Project




### Step 4: Set up Database



:bulb: **Hint:** 請先導入


### Step 5: 執行 Server



恭喜完成!
## 創造你的第一個 NPC
### 登入

:bulb: **Hint:** 帳號密碼都是 admin
## 創建腳色


:bulb: **Hint:** Pin Code 是 1111

在聊天輸入 "!setMap 100000000" 傳送到弓箭手村

## 與 Bo 對話 建立範例腳本

:bulb: **Hint:** 回到 Intellij

:bulb: **Hint:** 找到此腳本並改名 所有腳本皆使用 Python 撰寫
## 常用的函式
:bulb: **Hint:** 要使 NPC 可輸出中文需特殊處理 有興趣可與我聯繫
```python=3.9
sm.sendAskYesNo("Your Message") # 會問發出一個 Yes No 問題
```

```python=3.9
sm.sendSayOkay("Your Message") # 會發出一個確認
```

```python=3.9
sm.sendNext("Your Message") # 會發出下一步
```

```python=3.9
sm.sendAskNumber("Your Message", default, min, max) # 會發出取得一個數字
```

```python=3.9
sm.sendAskText("Your Message", default, min-len, max-len) # 會發出取得串文字
```

:bulb: **Hint:** 更多的函式 可以在 ScriptManagerImpl.java 裡面找到
## 創造屬於你的 NPC 吧
### 範例 level 1 : Hello, 你今天過得好嗎???????
```python=3.9
if sm.sendAskYesNo('Hello bro, how is the day today?'):
sm.sendSayOkay("I'm good, too.")
else:
sm.sendSayOkay("OK, Fxck u :)")
```
### 範例 level 2 : 哭阿, 一坨屎
:bulb: **Hint:** 可以用 #i道具ID# 來將道具放在文字中
```python=3.9
if sm.sendAskYesNo('Hello bro, do you want some shit #i4000377# today?'):
sm.giveItem(4000377)
sm.sendSayOkay("Here you go.")
else:
sm.sendSayOkay("OK, bye.")
```

### 範例 level 3 : 無情單殺 無情雙殺 無情三殺 哭阿
:bulb: **Hint:** 可以用 #k #b #g #r #d #e #n(清除) 來改變字體
```python=3.9
if sm.sendAskYesNo(u'#d無情單殺 #b無情雙殺 #g無情三殺 #r#e哭阿#n....'):
sm.sendSayOkay(u"要打中文要改一些封包的編碼")
else:
sm.sendSayOkay("OK, bye.")
```
