diff --git a/src/open_dread_rando/files/schema.json b/src/open_dread_rando/files/schema.json index 08ddf7588..e7c261d33 100644 --- a/src/open_dread_rando/files/schema.json +++ b/src/open_dread_rando/files/schema.json @@ -290,7 +290,11 @@ "pattern": "[A-Z]+?_[0-9]+" }, "text": { - "type": "string" + "type": ["string", "array"], + "items": { + "type": "string" + }, + "description": "If a string, the Adam dialogue will be replaced with a single page containing the string. If an array, a page will be created for each element." } }, "required": [ diff --git a/src/open_dread_rando/misc_patches/text_patches.py b/src/open_dread_rando/misc_patches/text_patches.py index f119727a9..71d2c7538 100644 --- a/src/open_dread_rando/misc_patches/text_patches.py +++ b/src/open_dread_rando/misc_patches/text_patches.py @@ -59,12 +59,21 @@ def patch_hints(editor: PatcherEditor, hints: list[dict]): # update hint text hint_id = f"DIAG_ADAM_{hint['hint_id']}" - string_key = f"{hint_id}_PAGE_1" + + hint_text = hint["text"] + + if isinstance(hint_text, str): + hint_text = [hint_text] + + pages = { + f"{hint_id}_PAGE_{i + 1}": hint + for i, hint in enumerate(hint_text) + } usable.tCaptionList = { - hint_id: [string_key] + hint_id: list(pages) or [f"{hint_id}_PAGE_1"] } - patch_text(editor, string_key, hint["text"]) + apply_text_patches(editor, pages) _PROJECT_MEMBERS = { diff --git a/tests/test_files/april_fools_patcher.json b/tests/test_files/april_fools_patcher.json index 4b2a7c835..cef0ee023 100644 --- a/tests/test_files/april_fools_patcher.json +++ b/tests/test_files/april_fools_patcher.json @@ -3528,7 +3528,9 @@ "actor": "PRP_CV_AccessPoint002" }, "hint_id": "CAVE_2", - "text": "Can you guess where a {c1}Progressive Suit{c0} goes?|That's right! It goes in the {c5}Cataris{c0} hole!" + "text": [ + "Can you guess where a {c1}Progressive Suit{c0} goes?|That's right! It goes in the {c5}Cataris{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3537,7 +3539,9 @@ "actor": "PRP_CV_AccessPoint001" }, "hint_id": "CAVE_1", - "text": "Can you guess where the {c1}Power Bomb{c0} goes?|That's right! It goes in the {c5}Artaria{c0} hole!" + "text": [ + "Can you guess where the {c1}Power Bomb{c0} goes?|That's right! It goes in the {c5}Artaria{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3546,7 +3550,9 @@ "actor": "accesspoint" }, "hint_id": "MAGMA_1", - "text": "Can you guess where the {c1}Wave Beam{c0} goes?|That's right! It goes in the {c5}Ghavoran{c0} hole!" + "text": [ + "Can you guess where the {c1}Wave Beam{c0} goes?|That's right! It goes in the {c5}Ghavoran{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3555,7 +3561,9 @@ "actor": "accesspoint_000" }, "hint_id": "MAGMA_2", - "text": "Can you guess where the {c1}Wide Beam{c0} goes?|That's right! It goes in the {c5}Ghavoran{c0} hole!" + "text": [ + "Can you guess where the {c1}Wide Beam{c0} goes?|That's right! It goes in the {c5}Ghavoran{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3564,7 +3572,9 @@ "actor": "accesspoint_000" }, "hint_id": "LAB_1", - "text": "Can you guess where the {c1}Spider Magnet{c0} goes?|That's right! It goes in the {c5}Artaria{c0} hole!" + "text": [ + "Can you guess where the {c1}Spider Magnet{c0} goes?|That's right! It goes in the {c5}Artaria{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3573,7 +3583,9 @@ "actor": "accesspoint_001" }, "hint_id": "LAB_2", - "text": "{c4}A joke hint.{c0}" + "text": [ + "{c4}A joke hint.{c0}" + ] }, { "accesspoint_actor": { @@ -3582,7 +3594,9 @@ "actor": "accesspoint_000" }, "hint_id": "AQUA_1", - "text": "Can you guess where the {c1}Screw Attack{c0} goes?|That's right! It goes in the {c5}Burenia{c0} hole!" + "text": [ + "Can you guess where the {c1}Screw Attack{c0} goes?|That's right! It goes in the {c5}Burenia{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3591,7 +3605,9 @@ "actor": "accesspoint_001" }, "hint_id": "AQUA_2", - "text": "Can you guess where a {c1}Progressive Bomb{c0} goes?|That's right! It goes in the {c5}Burenia{c0} hole!" + "text": [ + "Can you guess where a {c1}Progressive Bomb{c0} goes?|That's right! It goes in the {c5}Burenia{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3600,7 +3616,9 @@ "actor": "accesspoint_000" }, "hint_id": "SANC_1", - "text": "Can you guess where the {c1}Storm Missile{c0} goes?|That's right! It goes in the {c5}Ferenia{c0} hole!" + "text": [ + "Can you guess where the {c1}Storm Missile{c0} goes?|That's right! It goes in the {c5}Ferenia{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3609,7 +3627,9 @@ "actor": "accesspoint_000" }, "hint_id": "FOREST_1", - "text": "Can you guess where the {c1}Flash Shift{c0} goes?|That's right! It goes in the {c5}Ghavoran{c0} hole!" + "text": [ + "Can you guess where the {c1}Flash Shift{c0} goes?|That's right! It goes in the {c5}Ghavoran{c0} hole!" + ] }, { "accesspoint_actor": { @@ -3618,7 +3638,9 @@ "actor": "accesspoint_000" }, "hint_id": "SHIP_1", - "text": "Can you guess where a {c1}Progressive Suit{c0} goes?|That's right! It goes in the {c5}Artaria{c0} hole!" + "text": [ + "Can you guess where a {c1}Progressive Suit{c0} goes?|That's right! It goes in the {c5}Artaria{c0} hole!" + ] } ], "text_patches": { diff --git a/tests/test_files/starter_preset_patcher.json b/tests/test_files/starter_preset_patcher.json index da808d65e..f057d61d7 100644 --- a/tests/test_files/starter_preset_patcher.json +++ b/tests/test_files/starter_preset_patcher.json @@ -3592,7 +3592,9 @@ "actor": "PRP_CV_AccessPoint002" }, "hint_id": "CAVE_2", - "text": "A {c1}Progressive Beam{c0} can be found in {c5}Cataris{c0}." + "text": [ + "A {c1}Progressive Beam{c0} can be found in {c5}Cataris{c0}." + ] }, { "accesspoint_actor": { @@ -3601,7 +3603,9 @@ "actor": "PRP_CV_AccessPoint001" }, "hint_id": "CAVE_1", - "text": "A {c1}Progressive Beam{c0} can be found in {c5}Artaria{c0}." + "text": [ + "A {c1}Progressive Beam{c0} can be found in {c5}Artaria{c0}." + ] }, { "accesspoint_actor": { @@ -3610,7 +3614,9 @@ "actor": "accesspoint" }, "hint_id": "MAGMA_1", - "text": "A {c1}Progressive Bomb{c0} can be found in {c5}Artaria{c0}." + "text": [ + "A {c1}Progressive Bomb{c0} can be found in {c5}Artaria{c0}." + ] }, { "accesspoint_actor": { @@ -3619,7 +3625,9 @@ "actor": "accesspoint_000" }, "hint_id": "MAGMA_2", - "text": "A {c1}Progressive Suit{c0} can be found in {c5}Ghavoran{c0}." + "text": [ + "A {c1}Progressive Suit{c0} can be found in {c5}Ghavoran{c0}." + ] }, { "accesspoint_actor": { @@ -3628,7 +3636,9 @@ "actor": "accesspoint_000" }, "hint_id": "LAB_1", - "text": "A {c1}Progressive Spin{c0} can be found in {c5}Burenia{c0}." + "text": [ + "A {c1}Progressive Spin{c0} can be found in {c5}Burenia{c0}." + ] }, { "accesspoint_actor": { @@ -3637,7 +3647,9 @@ "actor": "accesspoint_001" }, "hint_id": "LAB_2", - "text": "The {c1}Grapple Beam{c0} can be found in {c5}Burenia{c0}." + "text": [ + "The {c1}Grapple Beam{c0} can be found in {c5}Burenia{c0}." + ] }, { "accesspoint_actor": { @@ -3646,7 +3658,9 @@ "actor": "accesspoint_000" }, "hint_id": "AQUA_1", - "text": "The {c1}Storm Missile{c0} can be found in {c5}Cataris{c0}." + "text": [ + "The {c1}Storm Missile{c0} can be found in {c5}Cataris{c0}." + ] }, { "accesspoint_actor": { @@ -3655,7 +3669,9 @@ "actor": "accesspoint_001" }, "hint_id": "AQUA_2", - "text": "The {c1}Power Bomb{c0} can be found in {c5}Dairon{c0}." + "text": [ + "The {c1}Power Bomb{c0} can be found in {c5}Dairon{c0}." + ] }, { "accesspoint_actor": { @@ -3664,7 +3680,9 @@ "actor": "accesspoint_000" }, "hint_id": "SANC_1", - "text": "A {c1}Progressive Bomb{c0} can be found in {c5}Dairon{c0}." + "text": [ + "A {c1}Progressive Bomb{c0} can be found in {c5}Dairon{c0}." + ] }, { "accesspoint_actor": { @@ -3673,7 +3691,9 @@ "actor": "accesspoint_000" }, "hint_id": "FOREST_1", - "text": "The {c1}Spider Magnet{c0} can be found in {c5}Artaria{c0}." + "text": [ + "The {c1}Spider Magnet{c0} can be found in {c5}Artaria{c0}." + ] }, { "accesspoint_actor": { @@ -3682,7 +3702,9 @@ "actor": "accesspoint_000" }, "hint_id": "SHIP_1", - "text": "The {c1}Screw Attack{c0} can be found in {c5}Ferenia{c0}." + "text": [ + "The {c1}Screw Attack{c0} can be found in {c5}Ferenia{c0}." + ] } ], "text_patches": {