From 9abedaed595a7e42abd71417517b8ca13f7d46b1 Mon Sep 17 00:00:00 2001 From: vvo <> Date: Sun, 9 Oct 2022 19:36:31 +0800 Subject: [PATCH] updateResources update --- sdvx@asphyxia/utils.ts | 20 +++++++++++++------ .../webui/asset/js/updateResources.js | 14 +++++++++++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/sdvx@asphyxia/utils.ts b/sdvx@asphyxia/utils.ts index 2137f05..0b3d46a 100644 --- a/sdvx@asphyxia/utils.ts +++ b/sdvx@asphyxia/utils.ts @@ -37,6 +37,7 @@ export const copyResourcesFromGame = async (data: {}) => { let mdbJsonFixFinal; let newJsonSongs = []; let newVersionSongs = []; + let newXCDSongs = []; let newNemsysData = [] let newAPCardData = [] let newSubBGData = [] @@ -60,17 +61,23 @@ export const copyResourcesFromGame = async (data: {}) => { if(Object.keys(prevAssetMdb).length > 0) { if(prevAssetMdb['mdb']['music'].find(item => parseInt(item['@id']) == parseInt(musicValue.info.label['@content'])) == undefined) { console.log("New song added to json: " + musicValue.info.title_name['@content'] + " (" + musicValue.info.distribution_date['@content'] + ")") - newJsonSongs.push('[' + musicValue.info.distribution_date['@content'] + '] ' + musicValue.info.title_name['@content']) + newJsonSongs.push([ musicValue['@attr'].id, '[' + musicValue.info.distribution_date['@content'] + ' | ' + musicValue['@attr'].id + '] ' + musicValue.info.title_name['@content']]) } } else { console.log("New song added to json: " + musicValue.info.title_name['@content'] + " (" + musicValue.info.distribution_date['@content'] + ")") - newJsonSongs.push('[' + musicValue.info.distribution_date['@content'] + '] ' + musicValue.info.title_name['@content']) + newJsonSongs.push([ musicValue['@attr'].id, '[' + musicValue.info.distribution_date['@content'] + ' | ' + musicValue['@attr'].id + '] ' + musicValue.info.title_name['@content']]) + } + + if(musicValue.info.inf_ver['@content'] == '6') { + console.log("New XCD difficulty song: " + musicValue.info.title_name['@content'] + " (" + musicValue.info.distribution_date['@content'] + ")") + newXCDSongs.push([ musicValue['@attr'].id, '[' + musicValue.info.distribution_date['@content'] + ' | ' + musicValue['@attr'].id + '] ' + musicValue.info.title_name['@content']]) } if(parseInt(musicValue.info.distribution_date['@content'][0]) >= parseInt(version.substring(0,8))) { console.log("Found new song for version " + version + ": " + musicValue.info.title_name['@content'] + " (" + musicValue.info.distribution_date['@content'] + ")"); - newVersionSongs.push('[' + musicValue.info.distribution_date['@content'] + '] ' + musicValue.info.title_name['@content']) + newVersionSongs.push([ musicValue['@attr'].id, '[' + musicValue.info.distribution_date['@content'] + ' | ' + musicValue['@attr'].id + '] ' + musicValue.info.title_name['@content']]) } + mdbJsonFix.push({ '@id': musicValue['@attr'].id, 'info': { @@ -164,7 +171,7 @@ export const copyResourcesFromGame = async (data: {}) => { // Copying new appeal card files from gamedata (disabled for now) // console.log("Copying new appeal card files from gamedata") - // if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys")) { + // if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/ap_card")) { // let apCardFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/ap_card") // for await (const apCard of apCardFiles) { // let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/ap_card/" + apCard.name) @@ -285,8 +292,9 @@ export const copyResourcesFromGame = async (data: {}) => { subbg: newSubBGData, bgm: newBGMData, chatStamp: newChatStampData, - versionSongs: newVersionSongs, - jsonSongs: newJsonSongs, + versionSongs: newVersionSongs.sort((a, b) => a[0] - b[0]), + jsonSongs: newJsonSongs.sort((a, b) => a[0] - b[0]), + xcdSongs: newXCDSongs.sort((a, b) => a[0] - b[0]), errors: runErrors })) } diff --git a/sdvx@asphyxia/webui/asset/js/updateResources.js b/sdvx@asphyxia/webui/asset/js/updateResources.js index 27a5614..d9440d2 100644 --- a/sdvx@asphyxia/webui/asset/js/updateResources.js +++ b/sdvx@asphyxia/webui/asset/js/updateResources.js @@ -8,6 +8,7 @@ $(document).ready(async function() { $('.collapsible-card').css('display', 'block') } else $('.collapsible-card').css('display', 'none') }) + $( "#updateResources" ).click(async function() { answer = confirm("Clicking OK would mean that you have already updated the datacode in your ea3-config.xml file. Would you like to proceed?"); if (answer == true) { @@ -68,15 +69,24 @@ $(document).ready(async function() { if(data['versionSongs'].length > 0) { document.getElementById("logtextarea").textContent += 'New songs in latest data: \n' $.each(data['versionSongs'], function(key, val) { - document.getElementById("logtextarea").textContent += "- " + val + '\n' + document.getElementById("logtextarea").textContent += "- " + val[1] + '\n' }) document.getElementById("logtextarea").textContent += '\n\n' } + if(data['jsonSongs'].length > 0) { document.getElementById("logtextarea").textContent += 'New songs added to mdb asset: \n' $.each(data['jsonSongs'], function(key, val) { - document.getElementById("logtextarea").textContent += "- " + val + '\n' + document.getElementById("logtextarea").textContent += "- " + val[1] + '\n' + }) + document.getElementById("logtextarea").textContent += '\n\n' + } + + if(data['xcdSongs'].length > 0) { + document.getElementById("logtextarea").textContent += 'XCD songs: \n' + $.each(data['xcdSongs'], function(key, val) { + document.getElementById("logtextarea").textContent += "- " + val[1] + '\n' }) document.getElementById("logtextarea").textContent += '\n\n' }