Skip to content

Commit

Permalink
Process choices in story texts
Browse files Browse the repository at this point in the history
  • Loading branch information
laqieer committed Oct 7, 2024
1 parent 075055e commit 5a02fa8
Show file tree
Hide file tree
Showing 4,157 changed files with 97,226 additions and 1,853 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
36 changes: 32 additions & 4 deletions 5_build_story.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,18 @@ def GetActorByStyle(lines, style):
return actor

def FindActorByController(actors, controllerId):
actor = None
if controllerId in actors:
return actors[controllerId]
actor = actors[controllerId]
if "dot" + controllerId in actors:
return actors["dot" + controllerId]
actor = actors["dot" + controllerId]
if "Dot" + controllerId in actors:
return actors["Dot" + controllerId]
raise ValueError(f"Controller not found: {controllerId}")
actor = actors["Dot" + controllerId]
if actor is None:
raise ValueError(f"Controller not found: {controllerId}")
if actor == "playerId":
actor = PlayerUnitIds[0]
return actor

FuncsInCommonPack = {}

Expand Down Expand Up @@ -162,6 +167,7 @@ def FindActorByController(actors, controllerId):

Texts[""] = ""
Texts["Narrator"] = "(ナレーション)"
Texts["Select"] = "(選択肢)"

def BuildText(face, talkerNameTag, text, isMind):
text = text.replace("\r\n", "<br>").replace("\r", "<br>").replace("\n", "<br>")
Expand Down Expand Up @@ -227,6 +233,13 @@ def BuildText(face, talkerNameTag, text, isMind):
for line in lines:
if line.startswith("--"):
continue
if "::" in line or "function" in line:
f_out.write(f"""
<tr>
<td colspan="2" style="text-align: center;">{get_func_name(line.strip().replace("::", ""))}</td>
</tr>
""")
continue
if "(" in line and ")" in line:
func_name = get_func_name(line)
args = get_func_args(line)
Expand Down Expand Up @@ -283,6 +296,21 @@ def BuildText(face, talkerNameTag, text, isMind):
face = Faces[FindActorByController(actors, controllerId)]
text = Texts.get(textId, textId)
f_out.write(BuildText(face, talkerNameTag, text, isMind))
case func_name if func_name.startswith("open_select_window"):
isMind = False
controllerId = args[0]
face = Faces[FindActorByController(actors, controllerId)]
buttonTexts = args[2:]
talkerNameTag = "Select"
text = "<ol>"
for buttonText in buttonTexts:
if "_direct" in buttonText:
t = buttonText
else:
t = Texts.get(buttonText, buttonText)
text += f"<li>{t}</li>"
text += "</ol>"
f_out.write(BuildText(face, talkerNameTag, text, isMind))

f_out.write(" </table>")

Expand Down
18 changes: 17 additions & 1 deletion docs/story/1.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,21 @@ <h1>汎用スキップデモ</h1>
<p><b></b></p>
<p></p>
<a href="https://github.com/laqieer/AT-Datamine/tree/main/LuaScript/content_luascript_story_beta4/DUMMY_SKIP.lua">View script in lua</a>
<table> </table></body>
<table>
<tr>
<td colspan="2" style="text-align: center;">Load</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">Play</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">PreLoad</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">PreLoad_AutoGenerate</td>
</tr>
</table></body>
</html>
61 changes: 61 additions & 0 deletions docs/story/100001.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ <h1>1章/施設利用/x0401_勉強</h1>
<p></p>
<a href="https://github.com/laqieer/AT-Datamine/tree/main/LuaScript/content_luascript_area_beta4/AC_01_001.lua">View script in lua</a>
<table>
<tr>
<td colspan="2" style="text-align: center;">Load</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">Play</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【(選択肢)】<br><ol><li>勉強する</li><li>やめておく</li></ol></td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">Load_Main</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_First_start</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※削除</td>
Expand All @@ -21,6 +42,10 @@ <h1>1章/施設利用/x0401_勉強</h1>
<td>【ノワール】<br>※削除</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Inst_start</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>騎士として人前に出ても恥ずかしくないよう<br>知性を身に付けておかないとな</td>
Expand All @@ -31,34 +56,70 @@ <h1>1章/施設利用/x0401_勉強</h1>
<td>【ノワール】<br>ここで少し勉強していくべきか?</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Inst_bonus</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※仮テキスト<br>※天候ボーナス予告</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Inst_cancel</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※仮テキスト<br>※キャンセル</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Main_item</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>そういえば<br>こんなときに役立ちそうな道具を持ってたな</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Main_useitem</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Main_noitem</td>
</tr>

<tr>
<td></td>
<td>【(ナレーション)】<br>理解が深まってきた気がする…!</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Main_bonus</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※仮テキスト<br>※天候ボーナス時の結果</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_001_Main_end</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>そろそろ集中力が切れてきたな<br>今日はここまでにしておこう</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">PreLoad</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">PreLoad_AutoGenerate</td>
</tr>
</table></body>
</html>
61 changes: 61 additions & 0 deletions docs/story/100002.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@ <h1>1章/施設利用/x0401_特訓</h1>
<p></p>
<a href="https://github.com/laqieer/AT-Datamine/tree/main/LuaScript/content_luascript_area_beta4/AC_01_002.lua">View script in lua</a>
<table>
<tr>
<td colspan="2" style="text-align: center;">Load</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">Play</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【(選択肢)】<br><ol><li>訓練する</li><li>やめておく</li></ol></td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">Load_Main</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_First_start</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※削除</td>
Expand All @@ -21,6 +42,10 @@ <h1>1章/施設利用/x0401_特訓</h1>
<td>【ノワール】<br>※削除</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Inst_start</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>実戦を想定した訓練は<br>メンタルを鍛えるのにもいいらしい</td>
Expand All @@ -31,34 +56,70 @@ <h1>1章/施設利用/x0401_特訓</h1>
<td>【ノワール】<br>ちょっと<br>ひと汗かいていこうかな?</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Inst_bonus</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※仮テキスト<br>※天候ボーナス予告</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Inst_cancel</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※仮テキスト<br>※キャンセル</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Main_item</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>そういえば<br>こんなときに役立ちそうな道具を持ってたな</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Main_useitem</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Main_noitem</td>
</tr>

<tr>
<td></td>
<td>【(ナレーション)】<br>精神が研ぎ澄まされたような気がする…!</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Main_bonus</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>※仮テキスト<br>※天候ボーナス時の結果</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">AC_01_002_Main_end</td>
</tr>

<tr>
<td><img src="../imgs/UnitThumb/101009002.png" alt="101009002" height="110"><br></td>
<td>【ノワール】<br>さすがに疲れたな<br>今日はこのくらいにしておくか</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">PreLoad</td>
</tr>

<tr>
<td colspan="2" style="text-align: center;">PreLoad_AutoGenerate</td>
</tr>
</table></body>
</html>
Loading

0 comments on commit 5a02fa8

Please sign in to comment.