diff --git a/_scripts/uuid_checker.py b/_scripts/uuid_checker.py new file mode 100644 index 00000000..0a5d8eb0 --- /dev/null +++ b/_scripts/uuid_checker.py @@ -0,0 +1,65 @@ +import json +import os +import logging +import sys +import uuid + +filepath = ".." +LOGGER = logging.getLogger() +logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) +ALL_UUID = [] + +REPLACE_IF_CONFLICTED = True +DISABLE_WRITING = True + + +def traverse_path(namespace: list): + global ALL_UUID, LOGGER, REPLACE_IF_CONFLICTED + current_path = "/".join(namespace) + + all_path = list(os.listdir(current_path)) + all_file = list(filter(lambda i: os.path.isfile(os.path.join(*namespace, i)) and not i.startswith("."), all_path)) + all_folder = list(filter(lambda i: os.path.isdir(os.path.join(*namespace, i)) + and not i.startswith(".") and not i.startswith("_"), + all_path)) + + for i in all_file: + if i.endswith(".json"): + curr_filepath = os.path.join(current_path, i) + LOGGER.debug(f"CHECKING: {curr_filepath}") + + with open(curr_filepath, mode="r", encoding="UTF-8") as file: + original_content = json.load(file) + + # try to get uuid + try: + file_uuid = original_content["uuid"] + except KeyError: + # guess this is something special, but whatsoever move on + LOGGER.warning(f"SKIPPING: {curr_filepath}") + continue + + # check uuid + if file_uuid in ALL_UUID: + LOGGER.warning(f"WARNING:\t\t\t{curr_filepath}\tUUID conflicted!") + LOGGER.warning(f"\tORIGINAL: {original_content}") + + # replace uuid + if REPLACE_IF_CONFLICTED: + while True: + replace_uuid = str(uuid.uuid4()) + if replace_uuid not in ALL_UUID: + break + + original_content["uuid"] = replace_uuid + LOGGER.warning(f"\tNEW UUID: {replace_uuid}") + + if not DISABLE_WRITING: + with open(curr_filepath, mode="w", encoding="UTF-8") as file: + json.dump(original_content, file) + + for folder in all_folder: + traverse_path(namespace + [folder]) + + +traverse_path([filepath]) diff --git a/i18n/en/story.json b/i18n/en/story.json index 3543199c..6ae03179 100644 --- a/i18n/en/story.json +++ b/i18n/en/story.json @@ -504,7 +504,7 @@ "[STORY_MAIN_2_1_6_P2_DESC]": "When everything woke up, Aris had been much better in the way of her speech. Momoi also got the falsified student ID card. Then, Momoi purposed to take Aris around the Millennium.", "[STORY_MAIN_2_1_7_NAME]": "Much Too Big to Be Called a Gun", - "[STORY_MAIN_2_1_7_DESC]": "The Game Development Department heads to the Engineering Department to get Aris a firearm. Aris ends up picking a railgun meant to be attached to an intergalactic battleship. The Engineering Department challenges Aris to a fight to test her abilities.", + "[STORY_MAIN_2_1_7_DESC_1]": "The Game Development Department heads to the Engineering Department to get Aris a firearm. Aris ends up picking a railgun meant to be attached to an intergalactic battleship. The Engineering Department challenges Aris to a fight to test her abilities.", "[STORY_MAIN_2_1_7_DESC_2]": "Aris skillfully uses the railgun to fend off the Engineering Department members, despite never having held such a weapon before. Utaha, the president of the Engineering Department, begins to become suspicious of Aris' unusual physical prowess.", "[STORY_MAIN_2_1_7_P1_NAME]": "Go To The Engineering Department!", "[STORY_MAIN_2_1_7_P1_DESC]": "All of the Game Development Club went to the Engineering Department with Aris.", @@ -567,7 +567,7 @@ "[STORY_MAIN_2_1_12_P10_DESC]": "Akane was curious about the source of the intel, and Yuuka replied to her with a catty smile: Himari, the president of Veritas, told her directly.", "[STORY_MAIN_2_1_13_NAME]": "Nerds vs. Maids", - "[STORY_MAIN_2_1_13_DESC]": "While Aris and Veritas create a distraction, Midori, Momoi, and Sensei attempt a frontal assault on Seminar.", + "[STORY_MAIN_2_1_13_DESC_1]": "While Aris and Veritas create a distraction, Midori, Momoi, and Sensei attempt a frontal assault on Seminar.", "[STORY_MAIN_2_1_13_DESC_2]": "Veritas' hacking ends up trapping Akane in a sealed room.", "[STORY_MAIN_2_1_13_P1_NAME]": "Aris Down", "[STORY_MAIN_2_1_13_P1_DESC]": "Aris took the role as forceful breakthrough girl, but was arrested at last. Akane expressed her liking towards Aris. Yuuka suddenly realized the trap in it, and enjoined the subordinate to replace the security system with the ones that were not from the Engineering Department.", diff --git a/main/story/main/2/2/02.json b/main/story/main/2/2/02.json index a00ad559..b4ac0b21 100644 --- a/main/story/main/2/2/02.json +++ b/main/story/main/2/2/02.json @@ -33,32 +33,32 @@ "character": ["Midori", "Momoi"] }, { - "name": "[STORY_MAIN_2_2_1_P3_NAME]", - "desc": "[STORY_MAIN_2_2_1_P3_DESC]", + "name": "[STORY_MAIN_2_2_2_P3_NAME]", + "desc": "[STORY_MAIN_2_2_2_P3_DESC]", "is_battle": false, "track": ["OST_17"], "background": ["BG_GameDevRoom.jpg"], "character": ["Aris", "Yuzu", "Midori", "Momoi"] }, { - "name": "[STORY_MAIN_2_2_1_P4_NAME]", - "desc": "[STORY_MAIN_2_2_1_P4_DESC]", + "name": "[STORY_MAIN_2_2_2_P4_NAME]", + "desc": "[STORY_MAIN_2_2_2_P4_DESC]", "is_battle": false, "track": ["OST_19"], "background": ["BG_GameDevRoom.jpg", "BG_CS_Millenium_02.jpg"], "character": ["Aris", "Momoi", "Yuzu", "Midori"] }, { - "name": "[STORY_MAIN_2_2_1_P5_NAME]", - "desc": "[STORY_MAIN_2_2_1_P5_DESC]", + "name": "[STORY_MAIN_2_2_2_P5_NAME]", + "desc": "[STORY_MAIN_2_2_2_P5_DESC]", "is_battle": false, "track": ["OST_18", "OST_75"], "background": ["BG_CS_Millenium_02.jpg", "BG_GameDevRoom.jpg"], "character": ["Yuzu", "Aris", "Momoi", "Midori"] }, { - "name": "[STORY_MAIN_2_2_1_P6_NAME]", - "desc": "[STORY_MAIN_2_2_1_P6_DESC]", + "name": "[STORY_MAIN_2_2_2_P6_NAME]", + "desc": "[STORY_MAIN_2_2_2_P6_DESC]", "is_battle": false, "track": ["OST_22", "OST_64"], "background": ["BG_GameDevRoom.jpg"], diff --git a/main/story/main/2/2/16.json b/main/story/main/2/2/16.json index 624d6524..e96b3645 100644 --- a/main/story/main/2/2/16.json +++ b/main/story/main/2/2/16.json @@ -35,7 +35,7 @@ { "name": "[STORY_MAIN_2_2_16_P3_NAME]", "desc": "[STORY_MAIN_2_2_16_P3_DESC]", - "is_battle": true, + "is_battle": false, "track": ["OST_68"], "background": ["BG_BigSisterRoom.jpg", "BG_IndoorPlaza_Night3.jpg"], "character": ["Rio", "Himari", "Eimi"] diff --git a/uuid_manager.json b/uuid_manager.json deleted file mode 100644 index 83c3f753..00000000 --- a/uuid_manager.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "b58525d1-cf3e-4225-af91-c13b1d5e1f40": "track/ost/1.json", - "1b9acff6-c0ac-4d18-b994-bce23e57e1b2": "track/short_animation/1.json", - "3812c0be-e9ef-4737-9986-6cbff3fc4c07": "all.json", - "e9faff3a-2d17-4772-9ebd-6493090166c3": "track/all.json", - "bd4457bb-1c23-44f7-81ea-a0b30a6bdc19": "track/ost/all.json", - "048fd34b-6c69-4492-855e-6eb8d23bc50a": "main/story/main/1/1/1.json", - "b6217e00-b7bf-4492-b61f-a39904cfacfb": "main/story/main/1/1/2.json", - "046e8196-6d03-4542-bd98-3c8382132eed": "track/ost/2.json", - "d8bb6352-740f-4487-82d1-871b8d76cc54": "track/ost/4.json", - "0dfa8e45-ba89-4a26-ae5e-3684e5a51357": "track/ost/5.json", - "b6cd18b0-eae5-4f86-8bca-b943f184f9d5": "track/ost/9.json", - "4c92dbd7-268e-400b-ad32-73ecb9e2ec99": "track/ost/10.json" -} \ No newline at end of file