diff --git a/diva/quest.py b/diva/quest.py index 32a8fde..52e112e 100644 --- a/diva/quest.py +++ b/diva/quest.py @@ -23,7 +23,6 @@ def scene_mst(old_path, languages): scenes[str(x.questSceneMstId)] = { "Name": x.name, "SummaryText": x.summaryText, "Parts": [], - "Enabled": False, "Folder": "" } id_num = "" @@ -44,16 +43,9 @@ def scene_mst(old_path, languages): .one()) folder = path.path.split("/")[2] if scenes[str(x.questSceneMstId)]["Folder"] and scenes[str(x.questSceneMstId)]["Folder"] != folder: - raise KeyError("Internal path inconsitency, bailing out {}".format(y.afterTalkName)) + raise KeyError("Internal path inconsitency, bailing out {}".format(id_num)) scenes[str(x.questSceneMstId)]["Folder"] = folder - if os.path.isfile(os.path.join(old_path, "XduScene.json")): - with open(os.path.join(old_path, "XduScene.json"), "r") as old_json_file: - old_json = json.load(old_json_file) - for key in old_json: - if old_json[key]['Enabled'] == True and key in scenes: - scenes[key]['Enabled'] = True - with io.open(os.path.join(old_path, "XduScene.json"), "w", newline='\n') as json_file: json.dump(scenes, json_file, ensure_ascii=False, indent='\t', sort_keys=True) @@ -62,11 +54,15 @@ def scene_mst(old_path, languages): if l == "jpn": for x in result: out_dict[str(x.questSceneMstId)] = { "Name": x.name, - "SummaryText": x.summaryText } + "SummaryText": x.summaryText, + "Credits": "POKELABO", + "Enabled": False } else: for x in result: out_dict[str(x.questSceneMstId)] = { "Name": "", - "SummaryText": "" } + "SummaryText": "", + "Credits": "", + "Enabled": False } langfile = os.path.join(old_path, "XduSceneNames_{}.json".format(l)) if os.path.isfile(langfile): @@ -91,27 +87,19 @@ def quest_mst(old_path, languages): .all()) quests = {} for x in result: - quests[str(x.questMstId)] = { "Name": x.name, "Scenes": [d.questSceneMstId for d in x.scenes], "Enabled": False } - - if os.path.isfile(os.path.join(old_path, "XduQuest.json")): - with open(os.path.join(old_path, "XduQuest.json"), "r") as old_json_file: - old_json = json.load(old_json_file) - for key in old_json: - if old_json[key]['Enabled'] == True and key in quests: - quests[key]['Enabled'] = True + quests[str(x.questMstId)] = { "Name": x.name, "Scenes": [d.questSceneMstId for d in x.scenes] } with io.open(os.path.join(old_path, "XduQuest.json"), "w", newline='\n') as json_file: json.dump(quests, json_file, ensure_ascii=False, indent='\t', sort_keys=True) - for l in languages: out_dict = {} if l == "jpn": for x in result: - out_dict[str(x.questMstId)] = { "Name": x.name } + out_dict[str(x.questMstId)] = { "Name": x.name, "Enabled": False } else: for x in result: - out_dict[str(x.questMstId)] = { "Name": "" } + out_dict[str(x.questMstId)] = { "Name": "", "Enabled": False } langfile = os.path.join(old_path, "XduQuestNames_{}.json".format(l)) if os.path.isfile(langfile):