Skip to content

Commit

Permalink
2023-08-31 small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
sctop committed Aug 30, 2023
1 parent adb8e99 commit 6acaf67
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 25 deletions.
65 changes: 65 additions & 0 deletions _scripts/uuid_checker.py
Original file line number Diff line number Diff line change
@@ -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])
4 changes: 2 additions & 2 deletions i18n/en/story.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down Expand Up @@ -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.",
Expand Down
16 changes: 8 additions & 8 deletions main/story/main/2/2/02.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down
2 changes: 1 addition & 1 deletion main/story/main/2/2/16.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
14 changes: 0 additions & 14 deletions uuid_manager.json

This file was deleted.

0 comments on commit 6acaf67

Please sign in to comment.