metadata changes and quest selector

This commit is contained in:
louis f 2019-05-17 05:20:02 -04:00
parent 526d0a51cc
commit 25f7d90951
7 changed files with 343 additions and 202 deletions

View File

@ -6,7 +6,15 @@
"extends": "eslint:recommended", "extends": "eslint:recommended",
"globals": { "globals": {
"Atomics": "readonly", "Atomics": "readonly",
"SharedArrayBuffer": "readonly" "SharedArrayBuffer": "readonly",
"PIXI": "readonly",
"UtageInfo": "readonly",
"TextFunctions": "readonly",
"Player": "readonly",
"Shaders": "readonly",
"baseDimensions": "readonly",
"commonFunctions": "readonly",
"audioController": "readonly"
}, },
"parserOptions": { "parserOptions": {
"ecmaVersion": 2018, "ecmaVersion": 2018,
@ -14,7 +22,8 @@
}, },
"rules": { "rules": {
"no-console": "off", "no-console": "off",
"no-unused-vars": [2, { "argsIgnorePattern": "^(success|event|resource|delta|reject)$"}], "no-unused-vars": [2, { "vars": "local", "argsIgnorePattern": "^(success|event|resource|delta|reject)$"}],
"no-empty": ["error", { "allowEmptyCatch": true }] "no-empty": ["error", { "allowEmptyCatch": true }],
"no-mixed-spaces-and-tabs": "off"
} }
} }

View File

@ -31,3 +31,6 @@ Fix noise\_disappearance commands
Macro support Macro support
DivaMovie DivaMovie
Changed metadata to include quests
Per-language quest enabling
Sort scenes into quests to reduce clutter

View File

@ -122,9 +122,11 @@ body { margin: 0; height: 100%; }
#title-container { padding: 2px 0; } #title-container { padding: 2px 0; }
#other-controls-container { padding-bottom: 4px; display: flex; width: 550px; justify-content: center; align-items: center; z-index: 10; } #other-controls-container { padding-bottom: 4px; display: flex; width: 100%; justify-content: center; align-items: center; z-index: 10; }
#select-mission { min-width: 0; } #select-quest { min-width: 0; width: 25% }
#select-scene { min-width: 0; width: 25% }
#select-language { margin-left: 10px; } #select-language { margin-left: 10px; }

@ -1 +1 @@
Subproject commit e45642773aa255babfde41b770ce1e4c78ca5251 Subproject commit e92af8f0d0c0d4246e44dd0b63508f9e460fe3a8

View File

@ -16,10 +16,11 @@ let bodyLoaded = false;
let utageLoaded = false; let utageLoaded = false;
let languagesLoaded = false; let languagesLoaded = false;
let selectedLang = "eng"; let selectedLang = "eng";
let currentMission = undefined; let currentScene = {};
let currentMissionMst = 0; let currentSceneId = "";
let currentMissionIndex = 0; let scenePlaylist = [];
let currentMissionList = []; let currentPart = "";
let partPlaylist = [];
let urlParams = {}; let urlParams = {};
let screenw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); let screenw = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
let screenh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); let screenh = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
@ -27,7 +28,8 @@ let screenSizeTimeout = undefined;
let isMuted = false; let isMuted = false;
let volume = 0.5; let volume = 0.5;
let fullScreen = false; let fullScreen = false;
let prevMission = '{Select}'; let prevScene = '{Select}';
let prevQuest = '{Select}';
const emoji = { const emoji = {
LoudSound: String.fromCodePoint(0x1f50a), LoudSound: String.fromCodePoint(0x1f50a),
@ -76,7 +78,8 @@ function onBodyLoaded() {
function onAllLoaded(success) { function onAllLoaded(success) {
textFunc.findTextElements(); textFunc.findTextElements();
buildMissionSelectList(); buildQuestSelectList();
buildSceneSelectList();
buildLanguageList(); buildLanguageList();
let appContainer = document.getElementById('app-container'); let appContainer = document.getElementById('app-container');
appContainer.appendChild(pixiApp.app.view); appContainer.appendChild(pixiApp.app.view);
@ -124,27 +127,79 @@ function loadLocalStorage() {
} }
} }
function buildMissionSelectList() { function buildQuestSelectList() {
let selectBox = document.getElementById('select-mission'); let questBox = document.getElementById('select-quest');
selectBox.innerHTML = ''; questBox.innerHTML = '';
for(let i = -1; i < utage.missionsList.length; ++i) { for (let i = -1; i < utage.questList.length; ++i) {
let opt = document.createElement('option'); let opt = document.createElement('option')
if(i === -1) { if (i === -1) {
opt.setAttribute('value', '{Select}'); opt.setAttribute('value', '{Select}');
opt.innerText = 'Select Mission'; opt.innerText = 'Select Event';
} else { } else {
let m = utage.missionsList[i]; let q = utage.questList[i];
if(!Object.keys(utage.groupedMissions[m.MstId].Missions).some((mis) => { return utage.groupedMissions[m.MstId].Missions[mis].Enabled === true })) { let cust = q.IsCustom ? 'Custom' : 'Stock';
let name = q.Name;
let tl_key = utage.questTranslations[cust][q.QuestMstId];
if (!tl_key) {
console.log("Failed to build quest list: missing translations");
return;
}
if (!tl_key.Enabled && !utage.quests[cust][q.QuestMstId].Scenes.some((s) => { return utage.sceneTranslations[cust][s].Enabled === true })) {
continue; continue;
} }
opt.setAttribute('value', m.MstId); name = tl_key.Name || name;
let name = m.Name; opt.setAttribute('value', `${cust}|${q.QuestMstId}`);
if(utage.missionTranslations[m.MstId]) {
name = utage.missionTranslations[m.MstId].Name || name;
}
opt.innerText = name; opt.innerText = name;
} }
selectBox.appendChild(opt); questBox.appendChild(opt);
}
}
function buildSceneSelectList() {
let sceneBox = document.getElementById('select-scene');
let questBox = document.getElementById('select-quest');
sceneBox.innerHTML = '';
let opt = document.createElement('option');
opt.setAttribute('value', '{Select}');
opt.innerText = "Select Scene";
if (questBox.value === '{Select}') {
sceneBox.appendChild(opt);
sceneBox.setAttribute("disabled", "true");
return;
} else {
sceneBox.removeAttribute("disabled");
}
let cust = questBox.value.split("|")[0];
let questMstId = questBox.value.split("|")[1];
for (let i = -2; i < utage.quests[cust][questMstId].Scenes.length; ++i) {
let opt = document.createElement('option');
if (i === -2) {
opt.setAttribute('value', '{Select}');
opt.innerText = 'Select Scene';
} else if (i === -1) {
opt.setAttribute('value', '{All}');
opt.innerText = 'Play All';
} else {
let questSceneMstId = utage.quests[cust][questMstId].Scenes[i];
let s = utage.scenes[cust][questSceneMstId];
opt.setAttribute('value', `${cust}|${questSceneMstId}`);
let name = s.Name;
let tl_key = utage.sceneTranslations[cust][questSceneMstId];
if (!tl_key) {
console.log("Failed to build scene list: missing translations");
return;
}
if (!tl_key.Enabled) {
continue;
}
name = tl_key.Name || name;
opt.innerText = name;
}
sceneBox.appendChild(opt);
} }
} }
@ -162,29 +217,71 @@ function buildLanguageList() {
function checkQueryParameters() { function checkQueryParameters() {
urlParams = commonFunctions.readQueryParameters(); urlParams = commonFunctions.readQueryParameters();
if(urlParams['mstid'] && urlParams['id'] && utage.groupedMissions[urlParams['mstid']] && utage.groupedMissions[urlParams['mstid']].Missions[urlParams['id']]) { let cust;
if (urlParams['custom'] && urlParams['custom'] === "1") {
cust = 'Custom';
} else {
cust = 'Stock';
}
let playable = (urlParams['questSceneMstId'] &&
utage.scenes[cust][urlParams['questSceneMstId']] &&
utage.sceneTranslations[cust][urlParams['questSceneMstId']] &&
utage.sceneTranslations[cust][urlParams['questSceneMstId']].Enabled);
if(playable) {
document.getElementById('play-from-query').style.cssText = "position: fixed; z-index: 15; text-align: center; top: 50%; left: 50%; display: block;"; document.getElementById('play-from-query').style.cssText = "position: fixed; z-index: 15; text-align: center; top: 50%; left: 50%; display: block;";
} }
} }
function playFromQuery(event) { function playFromQuery(event) {
missionChanged(urlParams['mstid'], urlParams['id']); let cust;
if (urlParams['custom'] && urlParams['custom'] === "1") {
cust = 'Custom';
} else {
cust = 'Stock';
}
sceneSet(urlParams['questSceneMstId'], cust);
document.getElementById('play-from-query').style.cssText = "display: none;"; document.getElementById('play-from-query').style.cssText = "display: none;";
} }
function missionDropDownChanged(event) { function questDropDownChanged(event) {
if(!event || !event.currentTarget || !event.currentTarget.value) { return; }
buildSceneSelectList();
}
function sceneDropDownChanged(event) {
if(!event || !event.currentTarget || !event.currentTarget.value || event.currentTarget.value === '{Select}') { return; } if(!event || !event.currentTarget || !event.currentTarget.value || event.currentTarget.value === '{Select}') { return; }
if (event.currentTarget.value === '{All}') {
let quest = document.getElementById("select-quest");
let cust = quest.value.split("|")[0];
let questMstId = quest.value.split("|")[1];
let scene = utage.quests[cust][questMstId].Scenes;
resetPlaylist();
for (const s of scene) {
utage.scenes[cust][s]['QuestSceneMstId'] = s;
scenePlaylist.push(utage.scenes[cust][s]);
}
playNext();
return;
}
let cont = document.getElementById("modal-container"); let cont = document.getElementById("modal-container");
let misId = event.currentTarget.value;
let mis = utage.groupedMissions[misId]; let cust = event.currentTarget.value.split("|")[0];
if(!mis) { console.log(`Mission ${misId} not found`); return; } let questSceneMstId = event.currentTarget.value.split("|")[1];
let name = mis.Name;
let summary = mis.SummaryText; let scene = utage.scenes[cust][questSceneMstId];
if(!scene) { console.log(`Scene ${questSceneMstId} not found`); return; }
let name = scene.Name;
let summary = scene.SummaryText;
let credits = ""; let credits = "";
if(utage.missionTranslations[mis.MstId]) { let tl_key = utage.sceneTranslations[cust][questSceneMstId];
name = utage.missionTranslations[mis.MstId].Name || name;
summary = utage.missionTranslations[mis.MstId].SummaryText || summary; if(tl_key) {
credits = utage.missionTranslations[mis.MstId].Credits || credits; name = tl_key.Name || name;
summary = tl_key.SummaryText || summary;
credits = tl_key.Credits || credits;
} }
if(!credits) { if(!credits) {
if(selectedLang === "eng") { if(selectedLang === "eng") {
@ -193,15 +290,15 @@ function missionDropDownChanged(event) {
credits = "None"; credits = "None";
} }
} }
let chapterSelect = '<div><span>Chapter Select:</span><select id="ChapterSelect">'; let chapterSelect = '<div><span>Chapter Select:</span><select id="ChapterSelect">';
for(let k of Object.keys(mis.Missions)) { chapterSelect += `<option value="{All}">Play All</option>`
var m = mis.Missions[k]; for (const p of scene.Parts) {
if(m.Enabled) { chapterSelect += `<option value="${cust}|${p}">${p}</option>`
chapterSelect += `<option value="${m.Id}">${m.Id}</option>`
}
} }
let detailSrc = `${utage.rootDirectory}${(mis.IsCustom ? "CustomData" : "XDUData")}/Asset/Image/Quest/Snap/Detail/${mis.MstId}.png`;
let iconSrc = `${utage.rootDirectory}${(mis.IsCustom ? "CustomData" : "XDUData")}/Asset/Image/Quest/Snap/Icon/${mis.MstId}.png`; let detailSrc = `${utage.rootDirectory}${(scene.IsCustom ? "CustomData" : "XDUData")}/Asset/Image/Quest/Snap/Detail/${questSceneMstId}.png`;
let iconSrc = `${utage.rootDirectory}${(scene.IsCustom ? "CustomData" : "XDUData")}/Asset/Image/Quest/Snap/Icon/${questSceneMstId}.png`;
chapterSelect += '</select></div>'; chapterSelect += '</select></div>';
cont.innerHTML = ` cont.innerHTML = `
<div id="mission-modal" class="modal"> <div id="mission-modal" class="modal">
@ -216,8 +313,8 @@ function missionDropDownChanged(event) {
</div> </div>
<div id="modal-buttons"> <div id="modal-buttons">
<button onclick="closeMissionModal(event, false)">Close</button> <button onclick="closeMissionModal(event, false)">Close</button>
<span>MstId: ${mis.MstId}</span> <span>MstId: ${questSceneMstId}</span>
<button onclick="missionChanged(${mis.MstId})">Play</button> <button onclick="sceneSet('${questSceneMstId}', '${cust}')">Play</button>
</div> </div>
</div>`; </div>`;
document.getElementById("click-catcher").style.cssText = 'display: flex;'; document.getElementById("click-catcher").style.cssText = 'display: flex;';
@ -226,10 +323,18 @@ function missionDropDownChanged(event) {
function closeMissionModal(event, wasStarted) { function closeMissionModal(event, wasStarted) {
if(!wasStarted) { if(!wasStarted) {
document.getElementById('select-mission').value = prevMission; document.getElementById('select-scene').value = prevScene;
document.getElementById('select-quest').value = prevQuest;
} else { } else {
prevMission = document.getElementById('select-mission').value; prevScene = document.getElementById('select-scene').value;
prevQuest = document.getElementById('select-quest').value;
} }
if (prevScene === '{Select}') {
document.getElementById('select-scene').setAttribute("disabled", "true");
} else {
document.getElementById('select-scene').removeAttribute("disabled");
}
closeModal(event); closeModal(event);
} }
@ -240,67 +345,82 @@ function closeModal(event) {
cont.innerHTML = ''; cont.innerHTML = '';
} }
function missionChanged(mstId, value) { function sceneSet(questSceneMstId, cust) {
let mst = utage.groupedMissions[mstId]; resetPlaylist();
let name = mst.Name; let part = document.getElementById('ChapterSelect').value;
if(utage.missionTranslations[mstId]) { utage.scenes[cust][questSceneMstId]['QuestSceneMstId'] = questSceneMstId;
name = utage.missionTranslations[mstId].Name || name; if (part === '{All}') {
scenePlaylist.push(utage.scenes[cust][questSceneMstId]);
} else {
partPlaylist.push(part);
currentScene = utage.scenes[cust][questSceneMstId];
} }
if(!value) {
value = document.getElementById("ChapterSelect").value; playNext();
}
function playNext() {
if (!partPlaylist.length) {
if (!scenePlaylist.length) {
resetPlaylist();
return; // we're probably done
}
currentScene = scenePlaylist.shift();
partPlaylist = currentScene.Parts.slice();
} }
partChanged(partPlaylist.shift());
}
function partChanged(part) {
let cust = currentScene.IsCustom ? 'Custom' : 'Stock';
let name = currentScene.Name;
let tl_key = utage.sceneTranslations[cust][currentScene.QuestSceneMstId];
if(tl_key) {
name = tl_key.Name || name;
}
if(!audio) { if(!audio) {
audio = new audioController(utage); audio = new audioController(utage);
audio.changeVolume(volume); audio.changeVolume(volume);
audio.mute(isMuted); audio.mute(isMuted);
player.audio = audio; player.audio = audio;
} }
player.resetAll() player.resetAll()
.then((success) => { .then((success) => {
let newMission = mst.Missions[value]; if (scenePlaylist.length || partPlaylist.length) {
checkMissionList(mst.Missions, value); document.getElementById("skip-button").style.cssText = "display: inline-block;";
currentMission = newMission; } else {
currentMissionMst = mstId; document.getElementById("skip-button").style.cssText = "display: none;";
if(!currentMission.Enabled) {
//Check for the next enabled mission. If there are none just reset.
for(let i = currentMissionIndex + 1; i < currentMissionList.length; ++i) {
const mis = mst.Missions[currentMissionList[i]];
if(mis && mis.Enabled) {
missionChanged(currentMissionMst, mis.Id);
return;
}
}
//If we got through the loop there are no more enabled so just end
resetMissions();
return;
} }
let promises = []; let promises = [];
if(newMission.IsCustom) { if(currentScene.IsCustom) {
promises.push(utage.parseMissionFile(`${utage.rootDirectory}CustomData/${newMission.Path.replace('Asset/', '').replace('.utage', '').replace('.tsv', '_t.tsv')}`)); promises.push(utage.parseMissionFile(`${utage.rootDirectory}CustomData/Utage/${currentScene.Folder}/Scenario/${part}_t.tsv`));
promises.push(utage.loadMissionTranslation(`${utage.rootDirectory}Js/Translations/MissionsCustom/${currentScene.Folder}/${part}_translations_${selectedLang}.json`));
} else { } else {
promises.push(utage.parseMissionFile(`${utage.rootDirectory}XDUData/${newMission.Path.replace('Asset/', '').replace('.utage', '').replace('.tsv', '_t.tsv')}`)); promises.push(utage.parseMissionFile(`${utage.rootDirectory}XDUData/Utage/${currentScene.Folder}/Scenario/${part}_t.tsv`));
promises.push(utage.loadMissionTranslation(`${utage.rootDirectory}Js/Translations/Missions/${currentScene.Folder}/${part}_translations_${selectedLang}.json`));
} }
promises.push(utage.loadMissionTranslation(`${utage.rootDirectory}Js/Translations/Missions/${currentMission.Path.replace('Asset/Utage/', '').replace('Scenario/', '').replace('.utage', '').replace('.tsv', `_translations_${selectedLang}.json`)}`))
closeMissionModal(undefined, true); closeMissionModal(undefined, true);
Promise.all(promises) Promise.all(promises)
.then((success) => { .then((success) => {
document.getElementById("playing-title").innerText = `${name} (${value})`; document.getElementById("playing-title").innerText = `${name} (${part})`;
document.getElementById("title-tag").innerText = name; document.getElementById("title-tag").innerText = name;
currentPart = part;
player.playFile() player.playFile()
.then((success) => { .then((success) => {
if(currentMissionIndex !== currentMissionList.length - 1) { playNext();
missionChanged(currentMissionMst, mst.Missions[currentMissionList[currentMissionIndex+1]].Id);
} else {
player.resetAll();
resetMissions();
}
}, (failure) => { }, (failure) => {
player.resetAll(); player.resetAll();
resetMissions(); resetPlaylist();
console.log(failure); console.log(failure);
}); });
}, (failure) => { }, (failure) => {
resetMissions(); resetPlaylist();
console.log(failure); console.log(failure);
}); });
}, (failure) => { }, (failure) => {
@ -312,43 +432,32 @@ function languageChanged(event) {
if(!event || !event.currentTarget || !event.currentTarget.value || event.currentTarget.value === '{Select}' || !languages.includes(event.currentTarget.value)) { return; } if(!event || !event.currentTarget || !event.currentTarget.value || event.currentTarget.value === '{Select}' || !languages.includes(event.currentTarget.value)) { return; }
selectedLang = event.currentTarget.value; selectedLang = event.currentTarget.value;
let missionPath = ''; let missionPath = '';
if(currentMission) { if(currentPart) {
missionPath = `${utage.rootDirectory}Js/Translations/Missions/${currentMission.Path.replace('Asset/Utage/', '').replace('Scenario/', '').replace('.utage', '').replace('.tsv', `_translations_${selectedLang}.json`)}`; if (currentScene.IsCustom) {
missionPath = `${utage.rootDirectory}Js/Translations/CustomMissions/${currentScene.Folder}/${currentPart}_translations_${selectedLang}.json`;
} else {
missionPath = `${utage.rootDirectory}Js/Translations/Missions/${currentScene.Folder}/${currentPart}_translations_${selectedLang}.json`;
}
} }
utage.setTranslationLanguage(selectedLang, missionPath) utage.setTranslationLanguage(selectedLang, missionPath)
.then((success) => { .then((success) => {
document.getElementById('text-container').className = selectedLang; document.getElementById('text-container').className = selectedLang;
buildMissionSelectList(); buildQuestSelectList();
buildSceneSelectList();
localStorage.setItem('language', selectedLang); localStorage.setItem('language', selectedLang);
}); });
} }
function checkMissionList(missions, currentvalue) { function resetPlaylist() {
currentMissionList = []; currentScene = {};
let i = 0; scenePlaylist = [];
for(var m of Object.keys(missions)) { currentPart = "";
currentMissionList.push(m); partPlaylist = [];
if(m === currentvalue) {
currentMissionIndex = i;
}
++i;
}
if(currentMissionIndex + 1 === currentMissionList.length) {
document.getElementById("skip-button").style.cssText = "display: none;";
} else {
document.getElementById("skip-button").style.cssText = "display: inline-block;";
}
}
function resetMissions() {
currentMissionIndex = 0;
currentMissionList = [];
currentMission = undefined;
currentMissionMst = 0;
document.getElementById("skip-button").style.cssText = "display: inline-block;"; document.getElementById("skip-button").style.cssText = "display: inline-block;";
document.getElementById("playing-title").innerText = 'None'; document.getElementById("playing-title").innerText = 'None';
document.getElementById("title-tag").innerText = version; document.getElementById("title-tag").innerText = version;
document.getElementById('select-mission').value = '{Select}'; document.getElementById("select-quest").value = '{Select}';
buildSceneSelectList();
} }
function onMainClick(event) { function onMainClick(event) {
@ -362,20 +471,10 @@ function hideUiClicked(event) {
function skipClicked(event) { function skipClicked(event) {
if(player.uiHidden) { if(player.uiHidden) {
player.hideUiClicked(event); player.hideUiClicked(event);
} else if(player.runEvent && currentMissionIndex !== currentMissionList.length - 1) { } else if(player.runEvent) {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
//Find the next enabled mission playNext();
for(let i = currentMissionIndex + 1; i < currentMissionList.length; ++i) {
const mis = utage.groupedMissions[currentMissionMst].Missions[currentMissionList[i]];
if(mis && mis.Enabled) {
//missionChanged(currentMissionMst, utage.groupedMissions[currentMissionMst].Missions[currentMissionList[currentMissionIndex+1]].Id);
missionChanged(currentMissionMst, mis.Id);
return;
}
}
//If we got through the loop there are no more enabled so just end
resetMissions();
} }
} }
@ -421,7 +520,13 @@ function openHelpModal(event) {
iOS: 11+, no audio<br/> iOS: 11+, no audio<br/>
</div> </div>
</div> </div>
<a style="margin-top: auto; text-align: center; "href="https://discord.gg/fpQZQ8g">YameteTomete Discord</a> <table style="text-align: center; width: 100%; table-layout: fixed; margin-top: auto">
<tr><th colspan="2">Follow YameteTomete</th></tr>
<tr>
<td><a style="margin-top: auto; text-align: center; "href="https://discord.gg/fpQZQ8g" target="_blank" >Discord</a></td>
<td><a style="margin-top: auto; text-align: center; "href="https://twitter.com/YameteTomete" target="_blank">Twitter</a></td>
</tr>
</table>
<div style="margin-top: auto; text-align: center;">All Symphogear content belongs to its respective owners</div> <div style="margin-top: auto; text-align: center;">All Symphogear content belongs to its respective owners</div>
<div id="modal-buttons"> <div id="modal-buttons">
<button onclick="closeModal(event)">Close</button> <button onclick="closeModal(event)">Close</button>
@ -499,4 +604,4 @@ function onWindowResize(event, delay = 400) {
player.updateResolution(res); player.updateResolution(res);
document.getElementById('app-container').style.cssText = `width: ${res.width}px; height: ${res.height}px;`; document.getElementById('app-container').style.cssText = `width: ${res.width}px; height: ${res.height}px;`;
}, delay); }, delay);
} }

View File

@ -6,7 +6,9 @@ class UtageInfo {
this.currentPlayingFile = []; this.currentPlayingFile = [];
this.rootDirectory = ``; this.rootDirectory = ``;
this.groupedMissions = {}; this.groupedMissions = {};
this.missionsList = []; this.quests = {};
this.questList = [];
this.scenes = {};
this.characterInfo = {}; this.characterInfo = {};
this.layerInfo = {}; this.layerInfo = {};
this.localizeInfo = {}; this.localizeInfo = {};
@ -16,7 +18,8 @@ class UtageInfo {
this.currentTranslation = 'eng'; this.currentTranslation = 'eng';
this.translationsInner = {}; this.translationsInner = {};
this.charTranslationsInner = {}; this.charTranslationsInner = {};
this.missionTranslationsInner = {}; this.questTranslationsInner = {};
this.sceneTranslationsInner = {};
this.bgmLoopData = {}; this.bgmLoopData = {};
this.macros = {}; this.macros = {};
} }
@ -24,48 +27,62 @@ class UtageInfo {
loadUtageSettings() { loadUtageSettings() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let promises = [ let promises = [
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduMissions.json`), //0 commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduQuest.json`), //0
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Character.tsv`), //1 commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduScene.json`), //1
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Layer.tsv`), //2 commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Character.tsv`), //2
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Localize.tsv`), //3 commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Layer.tsv`), //3
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Localize.tsv`), //4
//commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Param.tsv`), //commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Param.tsv`),
//commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Scenario.tsv`), //commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Scenario.tsv`),
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Sound.tsv`), //4 commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Sound.tsv`), //5
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Texture.tsv`), //5 commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Settings/Texture.tsv`), //6
commonFunctions.getFileJson(`${this.rootDirectory}Js/BgmLoop.json`), //6 commonFunctions.getFileJson(`${this.rootDirectory}Js/BgmLoop.json`), //7
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduMissionsCustom.json`), //7 commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduQuestCustom.json`), //8
commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomCharacter.tsv`), //8 commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduSceneCustom.json`), //9
commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomSound.tsv`), //9 commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomCharacter.tsv`), //10
commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomTexture.tsv`), //10 commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomSound.tsv`), //11
commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Scenario/Macro.tsv`), //11 commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomTexture.tsv`), //12
commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomMacro.tsv`), //12 commonFunctions.getFileText(`${this.rootDirectory}XDUData/Utage/Diva/Scenario/Macro.tsv`), //13
commonFunctions.getFileText(`${this.rootDirectory}CustomData/Utage/Diva/Settings/CustomMacro.tsv`), //14
]; ];
Promise.all(promises) Promise.all(promises)
.then((success) => { .then((success) => {
this.groupMissions(success[0], success[7]); this.quests['Stock'] = success[0];
this.missionsList = Object.keys(this.groupedMissions).map((k) => { this.questList = Object.keys(this.quests['Stock']).map((k) => {
return {Name: this.groupedMissions[k].Name, MstId: this.groupedMissions[k].MstId}; return {QuestMstId: k, Name: this.quests['Stock'][k].Name, IsCustom: false};
}); });
this.missionsList.sort(); this.quests['Custom'] = success[8];
this.parseCharacterInfo(success[1]); for (const k of Object.keys(this.quests['Custom'])) {
this.parseLayerInfo(success[2]); this.questList.push({QuestMstId: k, Name: this.quests['Custom'][k].Name, IsCustom: true});
this.parseLocalizeInfo(success[3]); }
this.questList.sort((a, b) => { return a.QuestMstId - b.QuestMstId });
this.scenes['Stock'] = success[1];
for (const k of Object.keys(this.scenes['Stock'])) {
this.scenes['Stock'][k]['IsCustom'] = false;
}
this.parseCharacterInfo(success[2]);
this.parseLayerInfo(success[3]);
this.parseLocalizeInfo(success[4]);
//this.parseParamInfo(success[4]); //this.parseParamInfo(success[4]);
this.parseSoundInfo(success[4]); this.parseSoundInfo(success[5]);
this.parseTextureInfo(success[5]); this.parseTextureInfo(success[6]);
this.bgmLoopData = success[6]; this.bgmLoopData = success[7];
this.parseCharacterInfo(success[8], true); this.scenes['Custom'] = success[9];
this.parseSoundInfo(success[9], true); for (const k of Object.keys(this.scenes['Custom'])) {
this.parseTextureInfo(success[10], true); this.scenes['Custom'][k]['IsCustom'] = true;
this.parseMacroFile(success[11]); }
this.parseMacroFile(success[12]); this.parseCharacterInfo(success[10], true);
this.parseSoundInfo(success[11], true);
this.parseTextureInfo(success[12], true);
this.parseMacroFile(success[13]);
this.parseMacroFile(success[14]);
resolve(); resolve();
}, (failure) => { }, (failure) => {
reject(failure); reject(failure);
}); });
}); });
} }
parseMissionFile(file) { parseMissionFile(file) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
commonFunctions.getFileText(file) commonFunctions.getFileText(file)
@ -92,39 +109,6 @@ class UtageInfo {
}); });
} }
groupMissions(missions, customMissions) {
for(let key of Object.keys(missions)) {
let mis = missions[key];
if(!this.groupedMissions[mis.MstId]) {
this.groupedMissions[mis.MstId] = {
Name: mis.Name,
SummaryText: mis.SummaryText,
MstId: mis.MstId,
Missions: {}
}
this.groupedMissions[mis.MstId].Missions[mis.Id] = { Id: mis.Id, Path: mis.Path, Enabled: mis.Enabled };
} else {
this.groupedMissions[mis.MstId].Missions[mis.Id] = { Id: mis.Id, Path: mis.Path, Enabled: mis.Enabled };
}
}
for(let key of Object.keys(customMissions)) {
let mis = customMissions[key];
mis.IsCustom = true;
if(!this.groupedMissions[mis.MstId]) {
this.groupedMissions[mis.MstId] = {
IsCustom: true,
Name: mis.Name,
SummaryText: mis.SummaryText,
MstId: mis.MstId,
Missions: {}
}
this.groupedMissions[mis.MstId].Missions[mis.Id] = { Id: mis.Id, Path: mis.Path, Enabled: mis.Enabled, IsCustom: true };
} else {
this.groupedMissions[mis.MstId].Missions[mis.Id] = { Id: mis.Id, Path: mis.Path, Enabled: mis.Enabled, IsCustom: true };
}
}
}
get translations() { get translations() {
return this.translationsInner[this.currentTranslation]; return this.translationsInner[this.currentTranslation];
} }
@ -133,20 +117,35 @@ class UtageInfo {
return this.charTranslationsInner[this.currentTranslation]; return this.charTranslationsInner[this.currentTranslation];
} }
get missionTranslations() { get questTranslations() {
return this.missionTranslationsInner[this.currentTranslation]; return this.questTranslationsInner[this.currentTranslation];
}
get sceneTranslations() {
return this.sceneTranslationsInner[this.currentTranslation];
} }
setTranslationLanguage(key, missionPath) { setTranslationLanguage(key, missionPath) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.currentTranslation = key; this.currentTranslation = key;
let promises = [this.loadCharacterTranslations(key), let promises = [this.loadCharacterTranslations(key),
this.loadMissionNamesTranslations(key)]; this.loadQuestNamesTranslations(key),
this.loadSceneNamesTranslations(key)];
if(missionPath) { if(missionPath) {
promises.push(this.loadMissionTranslation(missionPath, key)); promises.push(this.loadMissionTranslation(missionPath, key));
} }
Promise.all(promises) Promise.all(promises)
.then((success) => { .then((success) => {
// propagate language-based enables downwards from quests to scenes
for (const c of ['Custom', 'Stock']) {
for (const k of Object.keys(this.questTranslationsInner[this.currentTranslation][c])) {
if (this.questTranslationsInner[this.currentTranslation][c][k].Enabled) {
for (const s of this.quests[c][k].Scenes) {
this.sceneTranslationsInner[this.currentTranslation][c][s].Enabled = true;
}
}
}
}
resolve(); resolve();
}, (failure) => { }, (failure) => {
console.log(failure); console.log(failure);
@ -189,21 +188,43 @@ class UtageInfo {
}); });
} }
loadMissionNamesTranslations() { loadQuestNamesTranslations() {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if(this.missionTranslationsInner[this.currentTranslation]) { if(this.questTranslationsInner[this.currentTranslation]) {
resolve(); resolve();
} else { } else {
var promises = [ var promises = [
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduMissionsNames_${this.currentTranslation}.json`), commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduQuestNames_${this.currentTranslation}.json`),
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduMissionsNamesCustom_${this.currentTranslation}.json`) commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduQuestNamesCustom_${this.currentTranslation}.json`)
]; ];
Promise.all(promises) Promise.all(promises)
.then((success) => { .then((success) => {
for(let m of Object.keys(success[1])) { this.questTranslationsInner[this.currentTranslation] = {};
success[0][m] = success[1][m]; this.questTranslationsInner[this.currentTranslation]['Stock'] = success[0];
} this.questTranslationsInner[this.currentTranslation]['Custom'] = success[1];
this.missionTranslationsInner[this.currentTranslation] = success[0]; resolve();
}, (failure) => {
console.log(failure);
resolve();
});
}
});
}
loadSceneNamesTranslations() {
return new Promise((resolve, reject) => {
if(this.sceneTranslationsInner[this.currentTranslation]) {
resolve();
} else {
var promises = [
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduSceneNames_${this.currentTranslation}.json`),
commonFunctions.getFileJson(`${this.rootDirectory}Js/Translations/XduSceneNamesCustom_${this.currentTranslation}.json`)
];
Promise.all(promises)
.then((success) => {
this.sceneTranslationsInner[this.currentTranslation] = {};
this.sceneTranslationsInner[this.currentTranslation]['Stock'] = success[0];
this.sceneTranslationsInner[this.currentTranslation]['Custom'] = success[1];
resolve(); resolve();
}, (failure) => { }, (failure) => {
console.log(failure); console.log(failure);

View File

@ -28,7 +28,8 @@
<span onclick="toggleMute(event)" id="mute-button">&#128266;</span> <!-- loud_sound --> <span onclick="toggleMute(event)" id="mute-button">&#128266;</span> <!-- loud_sound -->
<input onchange="onVolumeChange(event)" id="volume-range" value="50" type="range" min="0" max="100" step="1"/> <input onchange="onVolumeChange(event)" id="volume-range" value="50" type="range" min="0" max="100" step="1"/>
</div> </div>
<select id="select-mission" onchange="missionDropDownChanged(event);"></select> <select id="select-quest" onchange="questDropDownChanged(event);"></select>
<select id="select-scene" disabled="true" onchange="sceneDropDownChanged(event);"></select>
<select id="select-language" onchange="languageChanged(event);"></select> <select id="select-language" onchange="languageChanged(event);"></select>
<a style="font-size: 20px; margin-left: 5px;" title="info/help" onclick="openHelpModal(event)">?</a> <a style="font-size: 20px; margin-left: 5px;" title="info/help" onclick="openHelpModal(event)">?</a>
</div> </div>