quest: move enable switch to translations, add credits field

This commit is contained in:
louis 2019-05-17 04:57:02 -04:00
parent 8b7815500e
commit 968baabc0f

View file

@ -23,7 +23,6 @@ def scene_mst(old_path, languages):
scenes[str(x.questSceneMstId)] = { "Name": x.name, scenes[str(x.questSceneMstId)] = { "Name": x.name,
"SummaryText": x.summaryText, "SummaryText": x.summaryText,
"Parts": [], "Parts": [],
"Enabled": False,
"Folder": "" } "Folder": "" }
id_num = "" id_num = ""
@ -44,16 +43,9 @@ def scene_mst(old_path, languages):
.one()) .one())
folder = path.path.split("/")[2] folder = path.path.split("/")[2]
if scenes[str(x.questSceneMstId)]["Folder"] and scenes[str(x.questSceneMstId)]["Folder"] != folder: 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 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: 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) 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": if l == "jpn":
for x in result: for x in result:
out_dict[str(x.questSceneMstId)] = { "Name": x.name, out_dict[str(x.questSceneMstId)] = { "Name": x.name,
"SummaryText": x.summaryText } "SummaryText": x.summaryText,
"Credits": "POKELABO",
"Enabled": False }
else: else:
for x in result: for x in result:
out_dict[str(x.questSceneMstId)] = { "Name": "", out_dict[str(x.questSceneMstId)] = { "Name": "",
"SummaryText": "" } "SummaryText": "",
"Credits": "",
"Enabled": False }
langfile = os.path.join(old_path, "XduSceneNames_{}.json".format(l)) langfile = os.path.join(old_path, "XduSceneNames_{}.json".format(l))
if os.path.isfile(langfile): if os.path.isfile(langfile):
@ -91,27 +87,19 @@ def quest_mst(old_path, languages):
.all()) .all())
quests = {} quests = {}
for x in result: for x in result:
quests[str(x.questMstId)] = { "Name": x.name, "Scenes": [d.questSceneMstId for d in x.scenes], "Enabled": False } quests[str(x.questMstId)] = { "Name": x.name, "Scenes": [d.questSceneMstId for d in x.scenes] }
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
with io.open(os.path.join(old_path, "XduQuest.json"), "w", newline='\n') as json_file: 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) json.dump(quests, json_file, ensure_ascii=False, indent='\t', sort_keys=True)
for l in languages: for l in languages:
out_dict = {} out_dict = {}
if l == "jpn": if l == "jpn":
for x in result: for x in result:
out_dict[str(x.questMstId)] = { "Name": x.name } out_dict[str(x.questMstId)] = { "Name": x.name, "Enabled": False }
else: else:
for x in result: 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)) langfile = os.path.join(old_path, "XduQuestNames_{}.json".format(l))
if os.path.isfile(langfile): if os.path.isfile(langfile):