From 9978bf41de7ec86ef4cf49fbc2d776ab89eb2f18 Mon Sep 17 00:00:00 2001 From: vvo <> Date: Sat, 25 Mar 2023 04:24:20 +0800 Subject: [PATCH] events json update, gene update, arena station 6 --- sdvx@asphyxia/data/exg.ts | 102 +- sdvx@asphyxia/handlers/webui.ts | 1089 +++++++++-------- sdvx@asphyxia/webui/asset/js/events.js | 16 +- sdvx@asphyxia/webui/asset/js/generator.js | 350 +++--- sdvx@asphyxia/webui/asset/json/events.json | 46 +- .../webui/profile_premium generator.pug | 2 +- .../webui/profile_valkyrie generator.pug | 3 +- 7 files changed, 873 insertions(+), 735 deletions(-) diff --git a/sdvx@asphyxia/data/exg.ts b/sdvx@asphyxia/data/exg.ts index 0283fb9..92db758 100644 --- a/sdvx@asphyxia/data/exg.ts +++ b/sdvx@asphyxia/data/exg.ts @@ -36,7 +36,8 @@ export const EVENT6 = [ 'MEGAMIX_ENABLE', 'VALGENE_ENABLE', 'ARENA_ENABLE', - 'DISP_PASELI_BANNER' + 'DISP_PASELI_BANNER', + 'S_PUC_EFFECT_ENABLE' ]; export const INFORMATION6 = { @@ -129,6 +130,21 @@ export const EVENT_SONGS6 = { ], "bpl2022_6": [ '1947', '1953' + ], + "bpl2022_7": [ + '1944', '1950' + ], + "bpl2022_8": [ + '1954', '1945' + ], + "bpl2022_9": [ + '1942' + ], + "bpl2022_10": [ + '1940' + ], + "bpl2022_11": [ + '1939' ] } @@ -184,6 +200,21 @@ export const RESTRICTED_SONGS6 = { ], "bpl2022_6": [ '1947', '1953' + ], + "bpl2022_7": [ + '1944', '1950' + ], + "bpl2022_8": [ + '1954', '1945' + ], + "bpl2022_9": [ + '1942' + ], + "bpl2022_10": [ + '1940' + ], + "bpl2022_11": [ + '1939' ] } @@ -634,6 +665,75 @@ export const ARENA = { param: 8, } ] + }, + 'Set 6 (02/16/23)': { + details: { + // season: 4, + time_start: BigInt(Date.parse('16 Feb 2023 00:00:00 GMT')), + time_end: BigInt(Date.parse('31 Dec 2099 23:59:59 GMT')), + shop_start: BigInt(Date.parse('16 Feb 2023 00:00:00 GMT')), + shop_end: BigInt(Date.parse('31 Dec 2099 23:59:59 GMT')), + is_open: 1, + is_shop: 1 + }, + arena_items: [ + { + catalog_id: 1, + catalog_type: 1, + price: 8000, + item_type: 0, + item_id: 1846, + param: 23, + }, + { + catalog_id: 1, + catalog_type: 1, + price: 8000, + item_type: 0, + item_id: 1743, + param: 23, + }, + { + catalog_id: 1, + catalog_type: 1, + price: 8000, + item_type: 0, + item_id: 342, + param: 8, + }, + { + catalog_id: 1, + catalog_type: 1, + price: 4000, + item_type: 0, + item_id: 131, + param: 8, + }, + { + catalog_id: 1, + catalog_type: 1, + price: 4000, + item_type: 0, + item_id: 612, + param: 8, + }, + { + catalog_id: 1, + catalog_type: 1, + price: 2000, + item_type: 0, + item_id: 8, + param: 8, + }, + { + catalog_id: 1, + catalog_type: 1, + price: 2000, + item_type: 0, + item_id: 323, + param: 8, + } + ] } // 'debug': { // details: { diff --git a/sdvx@asphyxia/handlers/webui.ts b/sdvx@asphyxia/handlers/webui.ts index 1722eeb..8de8eb3 100644 --- a/sdvx@asphyxia/handlers/webui.ts +++ b/sdvx@asphyxia/handlers/webui.ts @@ -1,544 +1,545 @@ -import { Profile } from '../models/profile'; -import { MusicRecord } from '../models/music_record'; -import { getVersion, IDToCode, GetCounter } from '../utils'; -import { Mix } from '../models/mix'; -import { PREGENE } from '../data/exg'; - -export const updateProfile = async (data: { - refid: string; - name?: string; - appeal?: string; - akaname?: string; - nemsys?: string; - bgm?: string; - subbg?: string; - stampA?: string; - stampB?: string; - stampC?: string; - stampD?: string; -}) => { - if (data.refid == null) return; - - const update: Update['$set'] = {}; - - if (data.name && data.name.length > 0) { - const validName = data.name - .toUpperCase() - .replace(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?#$&*\-\.\ ]/g, '') - .slice(0, 8); - if (validName.length > 0) update.name = validName; - } - - if (data.appeal && data.appeal.length > 0) { - const validAppeal = parseInt(data.appeal); - if (!_.isNaN(validAppeal)) update.appeal = validAppeal; - } - - if (data.akaname && data.akaname.length > 0) { - const validAka = parseInt(data.akaname); - if (!_.isNaN(validAka)) update.akaname = validAka; - } - - if (data.nemsys && data.nemsys.length > 0) { - const validNemsys = parseInt(data.nemsys); - if (!_.isNaN(validNemsys)) update.nemsys = validNemsys; - } - - if (data.subbg && data.subbg.length > 0) { - const validSubbg = parseInt(data.subbg); - if (!_.isNaN(validSubbg)) update.subbg = validSubbg; - } - - if (data.bgm && data.bgm.length > 0) { - const validBGM = parseInt(data.bgm); - if (!_.isNaN(validBGM)) update.bgm = validBGM; - } - - if (data.stampA && data.stampA.length > 0) { - const validStampA = parseInt(data.stampA); - if (!_.isNaN(validStampA)) update.stampA = validStampA; - } - - if (data.stampB && data.stampB.length > 0) { - const validStampB = parseInt(data.stampB); - if (!_.isNaN(validStampB)) update.stampB = validStampB; - } - - if (data.stampC && data.stampC.length > 0) { - const validStampC = parseInt(data.stampC); - if (!_.isNaN(validStampC)) update.stampC = validStampC; - } - - if (data.stampD && data.stampD.length > 0) { - const validStampD = parseInt(data.stampD); - if (!_.isNaN(validStampD)) update.stampD = validStampD; - } - - await DB.Update( - data.refid, - { collection: 'profile' }, - { $set: update } - ); -}; - -export const updateMix = async (data: { - code: string; - name?: string; - creator?: string; -}) => { - const update: Update['$set'] = {}; - - if (data.name && data.name.length > 0) { - if (data.name.length > 0) update.name = data.name; - } - - if (data.creator && data.creator.length > 0) { - // const validCreator = data.creator - // .toUpperCase() - // .replace(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?#$&*\-\.\ ]/g, '') - // .slice(0, 8); - if (data.creator.length > 0) update.creator = data.creator; - } - - await DB.Update( - { collection: 'mix', code: data.code }, - { $set: update } - ); -}; - -export const importMix = async (data: { json: string }) => { - if (data.json.startsWith('`')) { - data.json = data.json.slice(1); - } - - if (data.json.endsWith('`')) { - data.json = data.json.slice(0, data.json.length - 1); - } - - const mix: any[] = JSON.parse(data.json); - - let code = mix[0]; - while (await DB.FindOne({ collection: 'mix', code })) { - code = _.padStart(_.random(0, 999999999999).toString(), 12, '0'); - } - - const id = await GetCounter('mix'); - const musics = mix.slice(9); - - if (musics.length % 2 !== 0) return; - - const mdata = []; - - for (let i = 0; i < musics.length; i += 2) { - mdata.push({ - grade: musics[i + 1], - id: musics[i], - }); - } - - await DB.Insert({ - collection: 'mix', - code, - id, - name: mix[1], - creator: mix[2], - param: `{ "dbVer" : "${mix[3] - }", "gene" : { "params" : "{ \\"minorVer\\" : \\"${mix[4] - }\\", \\"seed\\" : ${mix[5]} }", "ver" : "${mix[6] - }" }, "musics" : ${JSON.stringify(mdata)}, "voxdj" : { "params" : "${mix[7] - }", "ver" : "${mix[8]}" } }`, - jacket: 0, - tag: 1, - }); -}; - -export const deleteMix = async (data: { code: string }) => { - await DB.Remove({ collection: 'mix', code: data.code }); -}; - - -export const copyResourcesFromGame = async (data: {}) => { - let mdbJsonFix = []; - let mdbJsonFixFinal; - let newJsonSongs = []; - let newVersionSongs = []; - let newXCDSongs = []; - let newNemsysData = [] - let newAPCardData = [] - let newSubBGData = [] - let newBGMData = [] - let newChatStampData = [] - let newValgeneItemFiles = [] - let newAkanames = [] - let runErrors = [] - let resourceJsonData = JSON.parse(U.DecodeString(await IO.ReadFile('webui/asset/json/data.json'), 'utf8')) - let apCardJsonData = JSON.parse(U.DecodeString(await IO.ReadFile('webui/asset/json/appeal.json'), 'utf8')) - - // Get new music data from music_db.xml - console.log('Getting new music_db info') - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/music_db.xml")) { - let ea3Config = [] - let version = '' - let mdb = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/music_db.xml"), "shift_jis"), false) - - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-config.xml")) { - console.log("Reading ea3-config.xml") - ea3Config = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-config.xml"), "shift_jis"), false) - version = ea3Config['ea3']['soft']['ext']['@content']; - } else if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-ident.xml")) { - console.log("Reading ea3-ident.xml") - ea3Config = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-ident.xml"), "shift_jis"), false) - version = ea3Config['ea3_conf']['soft']['ext']['@content']; - } - let prevAssetMdb = [] - if(IO.Exists('webui/asset/json/music_db.json')) { - prevAssetMdb = JSON.parse(U.DecodeString(await IO.ReadFile('webui/asset/json/music_db.json'), 'utf8')) - } - - mdb.mdb.music.forEach(musicValue => { - 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['@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['@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['@attr'].id, '[' + musicValue.info.distribution_date['@content'] + ' | ' + musicValue['@attr'].id + '] ' + musicValue.info.title_name['@content']]) - } - - mdbJsonFix.push({ - '@id': musicValue['@attr'].id, - 'info': { - 'title_name': musicValue.info.title_name['@content'], - 'version': { - '@__type': 'u8', - '#text': musicValue.info.version['@content'][0].toString() - }, - 'inf_ver': { - '@__type': 'u8', - '#text': musicValue.info.inf_ver['@content'][0].toString() - }, - 'distribution_date' : { - '#text': musicValue.info.distribution_date['@content'][0] - } - }, - 'difficulty': { - 'novice': { - 'difnum': { - '@__type': 'u8', - '#text': musicValue.difficulty.novice.difnum['@content'][0].toString() - } - }, - 'advanced': { - 'difnum': { - '@__type': 'u8', - '#text': musicValue.difficulty.advanced.difnum['@content'][0].toString() - } - }, - 'exhaust': { - 'difnum': { - '@__type': 'u8', - '#text': musicValue.difficulty.exhaust.difnum['@content'][0].toString() - } - }, - 'maximum': { - 'difnum': { - '@__type': 'u8', - '#text': musicValue.difficulty.maximum != undefined ? musicValue.difficulty.maximum.difnum['@content'][0].toString() : '0' - } - }, - 'infinite': { - 'difnum': { - '@__type': 'u8', - '#text': musicValue.difficulty.infinite != undefined ? musicValue.difficulty.infinite.difnum['@content'][0].toString() : '0' - } - } - } - }); - }) - - mdbJsonFixFinal = { - 'mdb': { - 'version': version, - 'music': mdbJsonFix - } - }; - IO.WriteFile('webui/asset/json/music_db.json', JSON.stringify(mdbJsonFixFinal, null, 4)); - if(!IO.Exists('webui/asset/json/music_db_' + version + '.json')){ - IO.WriteFile('webui/asset/json/music_db_' + version + '.json', JSON.stringify(mdbJsonFixFinal, null, 4)); - } - - } else { - console.log('Error reading music_db.xml. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[music_db] Error reading music_db.xml. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new nemsys files from gamedata - console.log("Copying new nemsys files from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys")) { - let nemsysFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys") - for await (const nemsys of nemsysFiles) { - let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys/" + nemsys.name) - if(!IO.Exists('webui/asset/nemsys/' + nemsys.name.substring(0, (nemsys.name.length - 4)) + ".png") && !IO.Exists('webui/asset/nemsys/' + nemsys.name.substring(0, (nemsys.name.length - 4)) + ".jpg")) { - IO.WriteFile('webui/asset/nemsys/' + nemsys.name, fileToWrite) - newNemsysData.push(nemsys.name) - } else { - console.log(nemsys.name + " exists") - } - } - - newNemsysData.forEach(fileName => { - if(fileName.match(/([0-9]+)/g) != undefined) { - let nemsysId = parseInt(fileName.match(/([0-9]+)/g)[0]) - if(nemsysId && resourceJsonData.nemsys.find(nem => nem.value == nemsysId) == undefined) { - resourceJsonData.nemsys.push({"value": nemsysId, "name": fileName + " (please rename)"}) - } - } - }) - } else { - console.log('Error reading nemsys directory. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[nemsys] Error reading nemsys directory. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new subbg files from gamedata - console.log("Copying new subbg files from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/submonitor_bg")) { - let subBGFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/submonitor_bg") - for await (const subbg of subBGFiles) { - if (subbg.name.match(/(\.png|\.jpg)/g)) { - let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/submonitor_bg/" + subbg.name) - if(!IO.Exists('webui/asset/submonitor_bg/' + subbg.name.substring(0, (subbg.name.length - 4)) + ".png") && !IO.Exists('webui/asset/submonitor_bg/' + subbg.name.substring(0, (subbg.name.length - 4)) + ".jpg")) { - IO.WriteFile('webui/asset/submonitor_bg/' + subbg.name, fileToWrite) - newSubBGData.push(subbg.name) - } else { - console.log(subbg.name + " exists") - } - } - } - - newSubBGData.forEach(fileName => { - let subbgId = parseInt(fileName.match(/([0-9]+)/g)[0]) - if(subbgId) { - let foundSubbg = resourceJsonData.subbg.find(subbg => subbg.value === subbgId) - if(foundSubbg == undefined) { - if(fileName.match(/(subbg_[0-9]+_[0-9]+)/g)) fileName = fileName.match(/(subbg_[0-9]+)/g) - resourceJsonData.subbg.push({"value": subbgId, "name": fileName + " (please rename)"}) - } - } - }) - } else { - console.log('Error reading submonitor_bg directory. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[submonitor_bg] Error reading submonitor_bg directory. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new bgm files from gamedata - console.log("Copying new bgm files from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/sound/custom")) { - let bgmFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/sound/custom") - for await (const bgm of bgmFiles) { - if (bgm.name.match(/(\.s3p)/g)) { - let folderName = bgm.name.match(/(custom|special)_([0-9]*)/g)[0] - if(folderName != '') { - let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/sound/custom/" + bgm.name) - if(!IO.Exists('webui/asset/audio/' + folderName)) { - IO.WriteFile('webui/asset/audio/' + folderName + '/' + bgm.name, fileToWrite) - newBGMData.push(bgm.name) - } else { - console.log(bgm.name + " exists") - } - } - } - } - - newBGMData.forEach(fileName => { - let bgmId = parseInt(fileName.match(/(?<=(custom|special)_)([0-9]*)/g)[0]) - if(bgmId && resourceJsonData.bgm.find(bgm => bgm.value == bgmId) == undefined) { - resourceJsonData.bgm.push({"value": bgmId, "name": fileName + " (please rename)"}) - } - }) - } else { - console.log('Error reading BGM directory. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[BGM] Error reading BGM directory. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new valgene_item files from gamedata - console.log("Copying new valgene_item files from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/valgene_item")) { - let valgeneItemFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/valgene_item") - for await (const valgeneItem of valgeneItemFiles) { - if (valgeneItem.name.substring(valgeneItem.name.length-4, valgeneItem.name.length).match(/(\.png|\.jpg)/g)) { - let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/valgene_item/" + valgeneItem.name) - if(!IO.Exists('webui/asset/valgene_item/' + valgeneItem.name.substring(0, (valgeneItem.name.length - 4)) + ".png") && !IO.Exists('webui/asset/valgene_item/' + valgeneItem.name.substring(0, (valgeneItem.name.length - 4)) + ".jpg")) { - IO.WriteFile('webui/asset/valgene_item/' + valgeneItem.name, fileToWrite) - newValgeneItemFiles.push(valgeneItem.name) - } else { - console.log(valgeneItem.name + " exists") - } - } - } - } else { - console.log('Error reading valgene_item directory. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[valgene_item] Error reading valgene_item directory. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new akanames from gamedata - console.log("Copying new akanames from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/akaname_parts.xml")) { - let akanameData = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/akaname_parts.xml"), "shift_jis"), false) - for(const akaname of akanameData.akaname_parts.part) { - if(resourceJsonData.akaname.find(aka => aka.value === akaname['@attr'].id) == undefined) { - resourceJsonData.akaname.push({"value": akaname['@attr'].id, "name": akaname.word['@content'] != undefined ? akaname.word['@content'] : '' }) - newAkanames.push(akaname['@attr'].id + ": " + akaname.word['@content']) - } - } - resourceJsonData.akaname.sort(function(a, b){return parseInt(a.value) - parseInt(b.value)}) - } else { - console.log('Error reading akaname xml file. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[akaname] Error reading akaname xml file. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new appeal card data from gamedata - console.log("Copying new appeal card data from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/appeal_card.xml")) { - let apCardData = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/appeal_card.xml"), "shift_jis"), false) - for(const apCard of apCardData.appeal_card_data.card) { - if(apCardJsonData.appeal_card_data.card.find(ap => ap['@id'] === apCard['@attr'].id) == undefined) { - apCardJsonData.appeal_card_data.card.push({"@id": apCard['@attr'].id, "info": {"texture": apCard.info['texture']['@content'], "title": apCard.info['title']['@content']}}) - newAPCardData.push(apCard['@attr'].id + ": " + apCard.info['texture']['@content'] + "(" + apCard.info['title']['@content'] + ")") - } - if(!IO.Exists('webui/asset/ap_card/' + apCard.info['texture']['@content'] + '.png') && !IO.Exists('webui/asset/ap_card/' + apCard.info['texture']['@content'] + '.jpg')) { - let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/ap_card/" + apCard.info['texture']['@content'] + ".png") - IO.WriteFile('webui/asset/ap_card/' + apCard.info['texture']['@content'] + '.png', fileToWrite) - } - } - apCardJsonData.appeal_card_data.card.sort(function(a, b){return parseInt(a['@id']) - parseInt(b['@id'])}) - } else { - console.log('Error reading appeal card xml file. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[appeal card] Error reading appeal card xml file. Check your "Exceed Gear Data Directory" config.') - } - - // Copying new chat stamps from gamedata - console.log("Copying new chat stamps from gamedata") - if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/chat_stamp.xml")) { - let chatStampData = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/chat_stamp.xml"), "shift_jis"), false) - // console.log(JSON.stringify(chatStampData.chat_stamp_data)) - for(const chatStamp of chatStampData.chat_stamp_data.info) { - if(resourceJsonData.stamp.find(stamp => stamp['value'] === chatStamp.id['@content'][0]) == undefined) { - resourceJsonData.stamp.push({"value": chatStamp.id['@content'][0], "name": chatStamp.filename['@content']}) - newChatStampData.push(chatStamp.id['@content'][0] + ": " + chatStamp.filename['@content']) - } - if(!IO.Exists('webui/asset/chat_stamp/' + chatStamp.filename['@content'] + '.png') && !IO.Exists('webui/asset/chat_stamp/' + chatStamp.filename['@content'] + '.png')) { - let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/chat_stamp/" + chatStamp.filename['@content'] + ".png") - IO.WriteFile('webui/asset/chat_stamp/' + chatStamp.filename['@content'] + '.png', fileToWrite) - } - } - resourceJsonData.stamp.sort(function(a, b){return a.value - b.value}) - } else { - console.log('Error reading chat stamp xml file. Check your "Exceed Gear Data Directory" config.') - runErrors.push('[chat stamp] Error reading chat stamp xml file. Check your "Exceed Gear Data Directory" config.') - } - - await IO.WriteFile('webui/asset/json/data.json', JSON.stringify(resourceJsonData, null, 4)) - await IO.WriteFile('webui/asset/json/appeal.json', JSON.stringify(apCardJsonData, null, 4)) - await IO.WriteFile('webui/asset/logs/copyResourcesFromGame.json', JSON.stringify({ - akaname: newAkanames, - nemsys: newNemsysData, - apCard: newAPCardData, - subbg: newSubBGData, - bgm: newBGMData, - chatStamp: newChatStampData, - valgeneItemFiles: newValgeneItemFiles, - 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 - }, null, 4)) -} - -export const preGeneRoll = async (data: { - set: number, - refid: string, - items: [] -}) => { - // prem_items_crew: DB.Find(refid, {collection:"item",type:11}) - // prem_items_stamp: DB.Find(refid, { collection:"item",type:17 }) - // prem_items_subbg: DB.Find(refid, { collection:"item",type:18 }) - // prem_items_bgm: DB.Find(refid, { collection:"item",type:19 }) - // prem_items_nemsys: DB.Find(refid, { collection:"item",type:20 }) - - let itemId = { - 'crew': 11, - 'stamp': 17, - 'subbg': 18, - 'bgm': 19, - 'nemsys': 20 - } - let preGeneSet = PREGENE.find(itemSet => itemSet.id === data.set) - let finishedRolling = false - if(preGeneSet != undefined) { - while(!finishedRolling) { - let rollWhat = 0 - let probability = Math.random(); - console.log("Rolling Premium Generator") - for(const probIndex in preGeneSet.probability) { - if(probability <= preGeneSet.probability[probIndex]) { - rollWhat = parseInt(probIndex); - break; - } - if(parseInt(probIndex) === preGeneSet.probability.length - 1) rollWhat = parseInt(probIndex); - } - - let unobtainedItems = preGeneSet.items[Object.keys(preGeneSet.items)[rollWhat]].map((x) => x) - data.items.forEach(item => { - let checkId = 0; - checkId = item['id'] - if(item['type'] == 17) checkId = (item['id'] / 4) - if(item['type'] == itemId[Object.keys(preGeneSet.items)[rollWhat]] && preGeneSet.items[Object.keys(preGeneSet.items)[rollWhat]].includes(checkId)) { - unobtainedItems.splice(unobtainedItems.indexOf(checkId), 1) - } - }) - if(unobtainedItems.length > 0) { - let randomItemIndex = Math.floor(Math.random() * unobtainedItems.length); - console.log("Rolled item id: " + unobtainedItems[randomItemIndex] + " | item type: " + itemId[Object.keys(preGeneSet.items)[rollWhat]]) - if(itemId[Object.keys(preGeneSet.items)[rollWhat]] == 17) { - for(let stampID = (unobtainedItems[randomItemIndex] * 4) - 3; stampID <= (unobtainedItems[randomItemIndex] * 4); stampID++) { - DB.Upsert(data.refid, { - "collection": "item", - "type": itemId[Object.keys(preGeneSet.items)[rollWhat]], - "id": stampID }, - {$set: {"param": 1}} - ) - } - } else { - DB.Upsert(data.refid, { - "collection": "item", - "type": itemId[Object.keys(preGeneSet.items)[rollWhat]], - "id": unobtainedItems[randomItemIndex] }, - {$set: {"param": 1}} - ) - } - let finalItemType = (Object.keys(preGeneSet.items)[rollWhat] === 'subbg') ? 'bg' : Object.keys(preGeneSet.items)[rollWhat] - await IO.WriteFile('webui/asset/logs/preGeneRollResult.json', JSON.stringify({'id': unobtainedItems[randomItemIndex], 'type': finalItemType})) - finishedRolling = true - } else { - console.log("No more " + Object.keys(preGeneSet.items)[rollWhat] + " items to get, will re-roll.") - } - } - } else console.log('pregeneset none') -} - -export const manageEvents = async (data: { - eventConfig: {} -}) => { - IO.WriteFile('webui/asset/config/events.json', JSON.stringify(data.eventConfig, null, 4)); -} +import { Profile } from '../models/profile'; +import { MusicRecord } from '../models/music_record'; +import { getVersion, IDToCode, GetCounter } from '../utils'; +import { Mix } from '../models/mix'; +import { PREGENE } from '../data/exg'; + +export const updateProfile = async (data: { + refid: string; + name?: string; + appeal?: string; + akaname?: string; + nemsys?: string; + bgm?: string; + subbg?: string; + stampA?: string; + stampB?: string; + stampC?: string; + stampD?: string; +}) => { + if (data.refid == null) return; + + const update: Update['$set'] = {}; + + if (data.name && data.name.length > 0) { + const validName = data.name + .toUpperCase() + .replace(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?#$&*\-\.\ ]/g, '') + .slice(0, 8); + if (validName.length > 0) update.name = validName; + } + + if (data.appeal && data.appeal.length > 0) { + const validAppeal = parseInt(data.appeal); + if (!_.isNaN(validAppeal)) update.appeal = validAppeal; + } + + if (data.akaname && data.akaname.length > 0) { + const validAka = parseInt(data.akaname); + if (!_.isNaN(validAka)) update.akaname = validAka; + } + + if (data.nemsys && data.nemsys.length > 0) { + const validNemsys = parseInt(data.nemsys); + if (!_.isNaN(validNemsys)) update.nemsys = validNemsys; + } + + if (data.subbg && data.subbg.length > 0) { + const validSubbg = parseInt(data.subbg); + if (!_.isNaN(validSubbg)) update.subbg = validSubbg; + } + + if (data.bgm && data.bgm.length > 0) { + const validBGM = parseInt(data.bgm); + if (!_.isNaN(validBGM)) update.bgm = validBGM; + } + + if (data.stampA && data.stampA.length > 0) { + const validStampA = parseInt(data.stampA); + if (!_.isNaN(validStampA)) update.stampA = validStampA; + } + + if (data.stampB && data.stampB.length > 0) { + const validStampB = parseInt(data.stampB); + if (!_.isNaN(validStampB)) update.stampB = validStampB; + } + + if (data.stampC && data.stampC.length > 0) { + const validStampC = parseInt(data.stampC); + if (!_.isNaN(validStampC)) update.stampC = validStampC; + } + + if (data.stampD && data.stampD.length > 0) { + const validStampD = parseInt(data.stampD); + if (!_.isNaN(validStampD)) update.stampD = validStampD; + } + + await DB.Update( + data.refid, + { collection: 'profile' }, + { $set: update } + ); +}; + +export const updateMix = async (data: { + code: string; + name?: string; + creator?: string; +}) => { + const update: Update['$set'] = {}; + + if (data.name && data.name.length > 0) { + if (data.name.length > 0) update.name = data.name; + } + + if (data.creator && data.creator.length > 0) { + // const validCreator = data.creator + // .toUpperCase() + // .replace(/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!?#$&*\-\.\ ]/g, '') + // .slice(0, 8); + if (data.creator.length > 0) update.creator = data.creator; + } + + await DB.Update( + { collection: 'mix', code: data.code }, + { $set: update } + ); +}; + +export const importMix = async (data: { json: string }) => { + if (data.json.startsWith('`')) { + data.json = data.json.slice(1); + } + + if (data.json.endsWith('`')) { + data.json = data.json.slice(0, data.json.length - 1); + } + + const mix: any[] = JSON.parse(data.json); + + let code = mix[0]; + while (await DB.FindOne({ collection: 'mix', code })) { + code = _.padStart(_.random(0, 999999999999).toString(), 12, '0'); + } + + const id = await GetCounter('mix'); + const musics = mix.slice(9); + + if (musics.length % 2 !== 0) return; + + const mdata = []; + + for (let i = 0; i < musics.length; i += 2) { + mdata.push({ + grade: musics[i + 1], + id: musics[i], + }); + } + + await DB.Insert({ + collection: 'mix', + code, + id, + name: mix[1], + creator: mix[2], + param: `{ "dbVer" : "${mix[3] + }", "gene" : { "params" : "{ \\"minorVer\\" : \\"${mix[4] + }\\", \\"seed\\" : ${mix[5]} }", "ver" : "${mix[6] + }" }, "musics" : ${JSON.stringify(mdata)}, "voxdj" : { "params" : "${mix[7] + }", "ver" : "${mix[8]}" } }`, + jacket: 0, + tag: 1, + }); +}; + +export const deleteMix = async (data: { code: string }) => { + await DB.Remove({ collection: 'mix', code: data.code }); +}; + + +export const copyResourcesFromGame = async (data: {}) => { + let mdbJsonFix = []; + let mdbJsonFixFinal; + let newJsonSongs = []; + let newVersionSongs = []; + let newXCDSongs = []; + let newNemsysData = [] + let newAPCardData = [] + let newSubBGData = [] + let newBGMData = [] + let newChatStampData = [] + let newValgeneItemFiles = [] + let newAkanames = [] + let runErrors = [] + let resourceJsonData = JSON.parse(U.DecodeString(await IO.ReadFile('webui/asset/json/data.json'), 'utf8')) + let apCardJsonData = JSON.parse(U.DecodeString(await IO.ReadFile('webui/asset/json/appeal.json'), 'utf8')) + + // Get new music data from music_db.xml + console.log('Getting new music_db info') + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/music_db.xml")) { + let ea3Config = [] + let version = '' + let mdb = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/music_db.xml"), "shift_jis"), false) + + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-config.xml")) { + console.log("Reading ea3-config.xml") + ea3Config = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-config.xml"), "shift_jis"), false) + version = ea3Config['ea3']['soft']['ext']['@content']; + } else if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-ident.xml")) { + console.log("Reading ea3-ident.xml") + ea3Config = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/prop/ea3-ident.xml"), "shift_jis"), false) + version = ea3Config['ea3_conf']['soft']['ext']['@content']; + } + let prevAssetMdb = [] + if(IO.Exists('webui/asset/json/music_db.json')) { + prevAssetMdb = JSON.parse(U.DecodeString(await IO.ReadFile('webui/asset/json/music_db.json'), 'utf8')) + } + + mdb.mdb.music.forEach(musicValue => { + 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['@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['@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['@attr'].id, '[' + musicValue.info.distribution_date['@content'] + ' | ' + musicValue['@attr'].id + '] ' + musicValue.info.title_name['@content']]) + } + + mdbJsonFix.push({ + '@id': musicValue['@attr'].id, + 'info': { + 'title_name': musicValue.info.title_name['@content'], + 'version': { + '@__type': 'u8', + '#text': musicValue.info.version['@content'][0].toString() + }, + 'inf_ver': { + '@__type': 'u8', + '#text': musicValue.info.inf_ver['@content'][0].toString() + }, + 'distribution_date' : { + '#text': musicValue.info.distribution_date['@content'][0] + } + }, + 'difficulty': { + 'novice': { + 'difnum': { + '@__type': 'u8', + '#text': musicValue.difficulty.novice.difnum['@content'][0].toString() + } + }, + 'advanced': { + 'difnum': { + '@__type': 'u8', + '#text': musicValue.difficulty.advanced.difnum['@content'][0].toString() + } + }, + 'exhaust': { + 'difnum': { + '@__type': 'u8', + '#text': musicValue.difficulty.exhaust.difnum['@content'][0].toString() + } + }, + 'maximum': { + 'difnum': { + '@__type': 'u8', + '#text': musicValue.difficulty.maximum != undefined ? musicValue.difficulty.maximum.difnum['@content'][0].toString() : '0' + } + }, + 'infinite': { + 'difnum': { + '@__type': 'u8', + '#text': musicValue.difficulty.infinite != undefined ? musicValue.difficulty.infinite.difnum['@content'][0].toString() : '0' + } + } + } + }); + }) + + mdbJsonFixFinal = { + 'mdb': { + 'version': version, + 'music': mdbJsonFix + } + }; + IO.WriteFile('webui/asset/json/music_db.json', JSON.stringify(mdbJsonFixFinal, null, 4)); + if(!IO.Exists('webui/asset/json/music_db_' + version + '.json')){ + IO.WriteFile('webui/asset/json/music_db_' + version + '.json', JSON.stringify(mdbJsonFixFinal, null, 4)); + } + + } else { + console.log('Error reading music_db.xml. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[music_db] Error reading music_db.xml. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new nemsys files from gamedata + console.log("Copying new nemsys files from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys")) { + let nemsysFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys") + for await (const nemsys of nemsysFiles) { + let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/game_nemsys/" + nemsys.name) + if(!IO.Exists('webui/asset/nemsys/' + nemsys.name.substring(0, (nemsys.name.length - 4)) + ".png") && !IO.Exists('webui/asset/nemsys/' + nemsys.name.substring(0, (nemsys.name.length - 4)) + ".jpg")) { + IO.WriteFile('webui/asset/nemsys/' + nemsys.name, fileToWrite) + newNemsysData.push(nemsys.name) + } else { + console.log(nemsys.name + " exists") + } + } + + newNemsysData.forEach(fileName => { + if(fileName.match(/([0-9]+)/g) != undefined) { + let nemsysId = parseInt(fileName.match(/([0-9]+)/g)[0]) + if(nemsysId && resourceJsonData.nemsys.find(nem => nem.value == nemsysId) == undefined) { + resourceJsonData.nemsys.push({"value": nemsysId, "name": fileName + " (please rename)"}) + } + } + }) + } else { + console.log('Error reading nemsys directory. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[nemsys] Error reading nemsys directory. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new subbg files from gamedata + console.log("Copying new subbg files from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/submonitor_bg")) { + let subBGFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/submonitor_bg") + for await (const subbg of subBGFiles) { + if (subbg.name.match(/(\.png|\.jpg)/g)) { + let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/submonitor_bg/" + subbg.name) + if(!IO.Exists('webui/asset/submonitor_bg/' + subbg.name.substring(0, (subbg.name.length - 4)) + ".png") && !IO.Exists('webui/asset/submonitor_bg/' + subbg.name.substring(0, (subbg.name.length - 4)) + ".jpg")) { + IO.WriteFile('webui/asset/submonitor_bg/' + subbg.name, fileToWrite) + newSubBGData.push(subbg.name) + } else { + console.log(subbg.name + " exists") + } + } + } + + newSubBGData.forEach(fileName => { + let subbgId = parseInt(fileName.match(/([0-9]+)/g)[0]) + if(subbgId) { + let foundSubbg = resourceJsonData.subbg.find(subbg => subbg.value === subbgId) + if(foundSubbg == undefined) { + if(fileName.match(/(subbg_[0-9]+_[0-9]+)/g)) fileName = fileName.match(/(subbg_[0-9]+)/g) + resourceJsonData.subbg.push({"value": subbgId, "name": fileName + " (please rename)"}) + } + } + }) + } else { + console.log('Error reading submonitor_bg directory. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[submonitor_bg] Error reading submonitor_bg directory. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new bgm files from gamedata + console.log("Copying new bgm files from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/sound/custom")) { + let bgmFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/sound/custom") + for await (const bgm of bgmFiles) { + if (bgm.name.match(/(\.s3p)/g)) { + let folderName = bgm.name.match(/(custom|special)_([0-9]*)/g)[0] + if(folderName != '') { + let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/sound/custom/" + bgm.name) + if(!IO.Exists('webui/asset/audio/' + folderName)) { + IO.WriteFile('webui/asset/audio/' + folderName + '/' + bgm.name, fileToWrite) + newBGMData.push(bgm.name) + } else { + console.log(bgm.name + " exists") + } + } + } + } + + newBGMData.forEach(fileName => { + let bgmId = parseInt(fileName.match(/(?<=(custom|special)_)([0-9]*)/g)[0]) + if(bgmId && resourceJsonData.bgm.find(bgm => bgm.value == bgmId) == undefined) { + resourceJsonData.bgm.push({"value": bgmId, "name": fileName + " (please rename)"}) + } + }) + } else { + console.log('Error reading BGM directory. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[BGM] Error reading BGM directory. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new valgene_item files from gamedata + console.log("Copying new valgene_item files from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/valgene_item")) { + let valgeneItemFiles = await IO.ReadDir(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/valgene_item") + for await (const valgeneItem of valgeneItemFiles) { + if (valgeneItem.name.substring(valgeneItem.name.length-4, valgeneItem.name.length).match(/(\.png|\.jpg)/g)) { + let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/valgene_item/" + valgeneItem.name) + if(!IO.Exists('webui/asset/valgene_item/' + valgeneItem.name.substring(0, (valgeneItem.name.length - 4)) + ".png") && !IO.Exists('webui/asset/valgene_item/' + valgeneItem.name.substring(0, (valgeneItem.name.length - 4)) + ".jpg")) { + IO.WriteFile('webui/asset/valgene_item/' + valgeneItem.name, fileToWrite) + newValgeneItemFiles.push(valgeneItem.name) + } else { + console.log(valgeneItem.name + " exists") + } + } + } + } else { + console.log('Error reading valgene_item directory. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[valgene_item] Error reading valgene_item directory. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new akanames from gamedata + console.log("Copying new akanames from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/akaname_parts.xml")) { + let akanameData = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/akaname_parts.xml"), "shift_jis"), false) + for(const akaname of akanameData.akaname_parts.part) { + if(resourceJsonData.akaname.find(aka => aka.value === akaname['@attr'].id) == undefined) { + resourceJsonData.akaname.push({"value": akaname['@attr'].id, "name": akaname.word['@content'] != undefined ? akaname.word['@content'] : '' }) + newAkanames.push(akaname['@attr'].id + ": " + akaname.word['@content']) + } + } + resourceJsonData.akaname.sort(function(a, b){return parseInt(a.value) - parseInt(b.value)}) + } else { + console.log('Error reading akaname xml file. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[akaname] Error reading akaname xml file. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new appeal card data from gamedata + console.log("Copying new appeal card data from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/appeal_card.xml")) { + let apCardData = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/appeal_card.xml"), "shift_jis"), false) + for(const apCard of apCardData.appeal_card_data.card) { + if(apCardJsonData.appeal_card_data.card.find(ap => ap['@id'] === apCard['@attr'].id) == undefined) { + apCardJsonData.appeal_card_data.card.push({"@id": apCard['@attr'].id, "info": {"texture": apCard.info['texture']['@content'], "title": apCard.info['title']['@content']}}) + newAPCardData.push(apCard['@attr'].id + ": " + apCard.info['texture']['@content'] + "(" + apCard.info['title']['@content'] + ")") + } + if(!IO.Exists('webui/asset/ap_card/' + apCard.info['texture']['@content'] + '.png') && !IO.Exists('webui/asset/ap_card/' + apCard.info['texture']['@content'] + '.jpg')) { + let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/ap_card/" + apCard.info['texture']['@content'] + ".png") + IO.WriteFile('webui/asset/ap_card/' + apCard.info['texture']['@content'] + '.png', fileToWrite) + } + } + apCardJsonData.appeal_card_data.card.sort(function(a, b){return parseInt(a['@id']) - parseInt(b['@id'])}) + } else { + console.log('Error reading appeal card xml file. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[appeal card] Error reading appeal card xml file. Check your "Exceed Gear Data Directory" config.') + } + + // Copying new chat stamps from gamedata + console.log("Copying new chat stamps from gamedata") + if(IO.Exists(U.GetConfig('sdvx_eg_root_dir') + "/data/others/chat_stamp.xml")) { + let chatStampData = U.parseXML(U.DecodeString(await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/others/chat_stamp.xml"), "shift_jis"), false) + // console.log(JSON.stringify(chatStampData.chat_stamp_data)) + for(const chatStamp of chatStampData.chat_stamp_data.info) { + if(resourceJsonData.stamp.find(stamp => stamp['value'] === chatStamp.id['@content'][0]) == undefined) { + resourceJsonData.stamp.push({"value": chatStamp.id['@content'][0], "name": chatStamp.filename['@content']}) + newChatStampData.push(chatStamp.id['@content'][0] + ": " + chatStamp.filename['@content']) + } + if(!IO.Exists('webui/asset/chat_stamp/' + chatStamp.filename['@content'] + '.png') && !IO.Exists('webui/asset/chat_stamp/' + chatStamp.filename['@content'] + '.png')) { + let fileToWrite = await IO.ReadFile(U.GetConfig('sdvx_eg_root_dir') + "/data/graphics/chat_stamp/" + chatStamp.filename['@content'] + ".png") + IO.WriteFile('webui/asset/chat_stamp/' + chatStamp.filename['@content'] + '.png', fileToWrite) + } + } + resourceJsonData.stamp.sort(function(a, b){return a.value - b.value}) + } else { + console.log('Error reading chat stamp xml file. Check your "Exceed Gear Data Directory" config.') + runErrors.push('[chat stamp] Error reading chat stamp xml file. Check your "Exceed Gear Data Directory" config.') + } + + await IO.WriteFile('webui/asset/json/data.json', JSON.stringify(resourceJsonData, null, 4)) + await IO.WriteFile('webui/asset/json/appeal.json', JSON.stringify(apCardJsonData, null, 4)) + await IO.WriteFile('webui/asset/logs/copyResourcesFromGame.json', JSON.stringify({ + akaname: newAkanames, + nemsys: newNemsysData, + apCard: newAPCardData, + subbg: newSubBGData, + bgm: newBGMData, + chatStamp: newChatStampData, + valgeneItemFiles: newValgeneItemFiles, + 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 + }, null, 4)) +} + +export const preGeneRoll = async (data: { + set: number, + refid: string, + geneEdition: string, + items: [] +}) => { + // prem_items_crew: DB.Find(refid, {collection:"item",type:11}) + // prem_items_stamp: DB.Find(refid, { collection:"item",type:17 }) + // prem_items_subbg: DB.Find(refid, { collection:"item",type:18 }) + // prem_items_bgm: DB.Find(refid, { collection:"item",type:19 }) + // prem_items_nemsys: DB.Find(refid, { collection:"item",type:20 }) + + let itemId = { + 'crew': 11, + 'stamp': 17, + 'subbg': 18, + 'bgm': 19, + 'nemsys': 20 + } + let preGeneSet = PREGENE.find(itemSet => itemSet.id === data.set) + let finishedRolling = false + if(preGeneSet != undefined) { + while(!finishedRolling) { + let rollWhat = 0 + let probability = Math.random(); + console.log("Rolling Premium Generator") + for(const probIndex in preGeneSet.probability) { + if(probability <= preGeneSet.probability[probIndex]) { + rollWhat = parseInt(probIndex); + break; + } + if(parseInt(probIndex) === preGeneSet.probability.length - 1) rollWhat = parseInt(probIndex); + } + + let unobtainedItems = preGeneSet.items[Object.keys(preGeneSet.items)[rollWhat]].map((x) => x) + data.items.forEach(item => { + let checkId = 0; + checkId = item['id'] + if(item['type'] == 17) checkId = (item['id'] / 4) + if(item['type'] == itemId[Object.keys(preGeneSet.items)[rollWhat]] && preGeneSet.items[Object.keys(preGeneSet.items)[rollWhat]].includes(checkId)) { + unobtainedItems.splice(unobtainedItems.indexOf(checkId), 1) + } + }) + if(unobtainedItems.length > 0) { + let randomItemIndex = Math.floor(Math.random() * unobtainedItems.length); + console.log("Rolled item id: " + unobtainedItems[randomItemIndex] + " | item type: " + itemId[Object.keys(preGeneSet.items)[rollWhat]]) + if(itemId[Object.keys(preGeneSet.items)[rollWhat]] == 17) { + for(let stampID = (unobtainedItems[randomItemIndex] * 4) - 3; stampID <= (unobtainedItems[randomItemIndex] * 4); stampID++) { + DB.Upsert(data.refid, { + "collection": "item", + "type": itemId[Object.keys(preGeneSet.items)[rollWhat]], + "id": stampID }, + {$set: {"param": 1}} + ) + } + } else { + DB.Upsert(data.refid, { + "collection": "item", + "type": itemId[Object.keys(preGeneSet.items)[rollWhat]], + "id": unobtainedItems[randomItemIndex] }, + {$set: {"param": 1}} + ) + } + let finalItemType = (Object.keys(preGeneSet.items)[rollWhat] === 'subbg') ? 'bg' : Object.keys(preGeneSet.items)[rollWhat] + await IO.WriteFile('webui/asset/logs/preGeneRollResult.json', JSON.stringify({'id': unobtainedItems[randomItemIndex], 'type': finalItemType})) + finishedRolling = true + } else { + console.log("No more " + Object.keys(preGeneSet.items)[rollWhat] + " items to get, will re-roll.") + } + } + } else console.log('pregeneset none') +} + +export const manageEvents = async (data: { + eventConfig: {} +}) => { + IO.WriteFile('webui/asset/config/events.json', JSON.stringify(data.eventConfig, null, 4)); +} diff --git a/sdvx@asphyxia/webui/asset/js/events.js b/sdvx@asphyxia/webui/asset/js/events.js index 0ba33b7..414d3d1 100644 --- a/sdvx@asphyxia/webui/asset/js/events.js +++ b/sdvx@asphyxia/webui/asset/js/events.js @@ -1,6 +1,8 @@ +let hiddenEvents = ['xrecord', 'bpl2021', 'bsb2021', 'sdvx10thstamp', 'reflecstamp', 'gmz2022', 'pcbevent', '2023appealstampevent', '11thannivappealstampevent'] + function generateEventToggles(eventInfo, eventConfig) { let cardContent = $('
') - if(!['bpl2022', 'konasute', 'xrecord'].includes(eventInfo['id'])) { + if(!['bpl2022', 'konasute'].includes(eventInfo['id'])) { cardContent.append( $('
').append( $('
') @@ -39,13 +41,12 @@ async function readEventsJsonFile() { } async function generateNewEventsConfigFile() { - let hiddenEvents = ['bpl2021', 'bsb2021', 'gmz2022', 'pcbevent'] let eventConfig = {} let eventData = await readEventsJsonFile() for(const eventIter in eventData['events']) { let hidden = false let toggle = false - if(['bpl2022', 'konasute', 'xrecord'].includes(eventData['events'][eventIter]['id'])) { + if(['bpl2022', 'konasute'].includes(eventData['events'][eventIter]['id'])) { toggle = {} for(const toggleIter in eventData['events'][eventIter]['info']) { toggle[eventData['events'][eventIter]['id'] + '_' + (parseInt(toggleIter) + 1)] = false @@ -59,7 +60,6 @@ async function generateNewEventsConfigFile() { 'toggle': toggle } } - console.log(eventConfig) return eventConfig } @@ -68,6 +68,14 @@ $(document).ready(async function() { let eventData = await readEventsJsonFile() let eventConfig = await readEventsConfigFile() for(const eventIter in eventData['events']) { + + // NEEDS MORE WORK FOR EVENTS WITH MULTIPLE TOGGLES EACH + if(!(eventData['events'][eventIter]['id'] in eventConfig)) { + eventConfig[eventData['events'][eventIter]['id']] = { + 'hidden': hiddenEvents.includes(eventData['events'][eventIter]['id']), + 'toggle': false + } + } if(!eventConfig[eventData['events'][eventIter]['id']]['hidden']) { $('div.main').append( $('

' + eventData['events'][eventIter]['name'] + '

') diff --git a/sdvx@asphyxia/webui/asset/js/generator.js b/sdvx@asphyxia/webui/asset/js/generator.js index 580279d..f5325be 100644 --- a/sdvx@asphyxia/webui/asset/js/generator.js +++ b/sdvx@asphyxia/webui/asset/js/generator.js @@ -1,168 +1,182 @@ -function countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) { - let obtained = 0, total = 0; - if('crew' in geneItems.items) { - obtained += items_crew.filter(crew => geneItems.items.crew.includes(crew['id'])).length - total += geneItems.items['crew'].length - } - if('stamp' in geneItems.items) { - obtained += items_stamp.filter(stamp => geneItems.items.stamp.includes(stamp['id'] / 4)).length - total += geneItems.items['stamp'].length - } - if('subbg' in geneItems.items) { - obtained += items_subbg.filter(subbg => geneItems.items.subbg.includes(subbg['id'])).length - total += geneItems.items['subbg'].length - } - if('bgm' in geneItems.items) { - obtained += items_bgm.filter(bgm => geneItems.items.bgm.includes(bgm['id'])).length - total += geneItems.items['bgm'].length - } - if('nemsys' in geneItems.items) { - obtained += items_nemsys.filter(nemsys => geneItems.items.nemsys.includes(nemsys['id'])).length - total += geneItems.items['nemsys'].length - } - - return [obtained, total] -} - -function loadImages(itemList, itemType, userItems) { - itemList.forEach(item => { - let itemBrightness = userItems.find(userItem => userItem.id == ((itemType !== 'stamp') ? item : (item * 4))) != undefined ? 1 : 0.25 - let imageUrl = 'static/asset/valgene_item/item_' + itemType + '_' + item + '.png' - $.get(imageUrl, function(data, textStatus) { - if (textStatus == "success") { - $('.' + itemType + '-items').append('') - } - }) - }) -} - -async function getGeneratorEditionItems(gene_edition, itemSet) { - let valGeneData = await $.getJSON( "static/asset/json/valgene_data.json", function(data) { - return data - }) - if(gene_edition === 'valkyrie') { - return valGeneData.valgene[itemSet - 1] - } else { - return valGeneData.pregene[itemSet - 1] - } -} - -async function loadItems(itemSet, gene_edition, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) { - let geneItems = await getGeneratorEditionItems(gene_edition, itemSet) - let itemCounts = countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) - if(itemCounts[0] >= itemCounts[1]) $('#pregene-roll').attr('disabled', 'disabled') - else $('#pregene-roll').removeAttr('disabled') - - $('.count').text('Unlocked items: ' + itemCounts[0] + "/" + itemCounts[1]) - if(itemSet === 1) { - $('.setinfo').append('

These items are only usable in Japan. Change region to Japan in the ea3-config.xml file.

') - } else { - $('.jpn-excl').remove() - } - - if('crew' in geneItems.items) { - $('.item_banners').append('

Nemsys Crew

') - $('.item_banners').append('

') - loadImages(geneItems.items['crew'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'crew', items_crew) - } - - if('stamp' in geneItems.items) { - $('.item_banners').append('

Appeal Stamp

') - $('.item_banners').append('

') - loadImages(geneItems.items['stamp'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'stamp', items_stamp) - } - - if('subbg' in geneItems.items) { - $('.item_banners').append('

Submonitor BG

') - $('.item_banners').append('

') - loadImages(geneItems.items['subbg'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'bg', items_subbg) - } - - if('bgm' in geneItems.items) { - $('.item_banners').append('

BGM

') - $('.item_banners').append('

') - loadImages(geneItems.items['bgm'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'bgm', items_bgm) - } - - if('nemsys' in geneItems.items) { - $('.item_banners').append('

Nemsys

') - $('.item_banners').append('

') - loadImages(geneItems.items['nemsys'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'nemsys', items_nemsys) - } -} - -async function loadValgeneData(gene_edition) { - let valGeneData = await $.getJSON( "static/asset/json/valgene_data.json", function(data) { - return data - }) - if(gene_edition === 'valkyrie') { - for(const valGeneDataIndex in valGeneData.valgene) { - $('#set_select').append('') - } - } else { - for(const pregeneDataIndex in valGeneData.pregene) { - $('#set_select').append('') - } - } - $('#set_select').val($("#set_select option").length) -} - -$(document).ready(async function() { - if(document.getElementById("data-pass-unlock-all").innerText === 'true') { - $('.card-content').text("The \"Unlock All Valkyrie and Premium Items\" option is enabled. You wouldn't need this.") - $('#pregene-roll').attr('disabled') - return 0; - } - - $('#roll-result').on('click', function(){location.reload()}) - - $('html').keypress(function(e){ - if([13, 27, 32].includes(e.keyCode) && $('.modal.is-active').length > 0) { - location.reload() - } - }) - - $('.input').hide() - $('.button').addClass('is-link') - let refid = document.getElementsByName("refid")[0].value - let items_crew = JSON.parse(document.getElementById("data-pass-crew").innerText); - let items_stamp = JSON.parse(document.getElementById("data-pass-stamp").innerText); - let items_subbg = JSON.parse(document.getElementById("data-pass-subbg").innerText); - let items_bgm = JSON.parse(document.getElementById("data-pass-bgm").innerText); - let items_nemsys = JSON.parse(document.getElementById("data-pass-nemsys").innerText); - let gene_edition = document.getElementById("generator-edition").innerText; - await loadValgeneData(gene_edition) - loadItems($('#set_select').val(), gene_edition, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) - - $('#set_select').change(function() { - $('.count').text('') - $('.item_banners').empty() - loadItems(parseInt($('#set_select').val()), gene_edition, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) - }) - - $('#pregene-roll').on('click', async function() { - $('#pregene-roll').attr('disabled', 'disabled') - if(gene_edition === 'premium' && window.location.search.match(/(premium)/g) != undefined) { - let geneItems = await getGeneratorEditionItems(gene_edition, parseInt($('#set_select').val())) - if(countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys)[0] >= countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys)[1]) { - alert("All items have been unlocked already.") - } else { - emit('preGeneRoll', { - set: parseInt(document.getElementById('set_select').value), - refid: refid, - items: items_crew.concat(items_stamp, items_subbg, items_bgm, items_nemsys) - }).then( - function() { - $.getJSON("static/asset/logs/preGeneRollResult.json", function(data) { - $('.modal-card-head').append('') - $('.modal-card-body').append('') - $('.modal-card-foot').append('') - $('.modal').addClass('is-active') - }) - }) - } - } else { - alert("Not premium generator: a precaution") - } - }) -}) +function countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) { + let obtained = 0, total = 0; + if('crew' in geneItems.items) { + obtained += items_crew.filter(crew => geneItems.items.crew.includes(crew['id'])).length + total += geneItems.items['crew'].length + } + if('stamp' in geneItems.items) { + obtained += items_stamp.filter(stamp => geneItems.items.stamp.includes(stamp['id'] / 4)).length + total += geneItems.items['stamp'].length + } + if('subbg' in geneItems.items) { + obtained += items_subbg.filter(subbg => geneItems.items.subbg.includes(subbg['id'])).length + total += geneItems.items['subbg'].length + } + if('bgm' in geneItems.items) { + obtained += items_bgm.filter(bgm => geneItems.items.bgm.includes(bgm['id'])).length + total += geneItems.items['bgm'].length + } + if('nemsys' in geneItems.items) { + obtained += items_nemsys.filter(nemsys => geneItems.items.nemsys.includes(nemsys['id'])).length + total += geneItems.items['nemsys'].length + } + + return [obtained, total] +} + +function loadImages(itemList, itemType, userItems) { + itemList.forEach(item => { + let itemBrightness = userItems.find(userItem => userItem.id == ((itemType !== 'stamp') ? item : (item * 4))) != undefined ? 1 : 0.25 + let imageUrl = 'static/asset/valgene_item/item_' + itemType + '_' + item + '.png' + $.get(imageUrl, function(data, textStatus) { + if (textStatus == "success") { + $('.' + itemType + '-items').append('') + } + }) + }) +} + +async function getGeneratorEditionItems(gene_edition, itemSet) { + let valGeneData = await $.getJSON( "static/asset/json/valgene_data.json", function(data) { + return data + }) + if(gene_edition === 'valkyrie') { + return valGeneData.valgene[itemSet - 1] + } else { + return valGeneData.pregene[itemSet - 1] + } +} + +async function loadItems(itemSet, gene_edition, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) { + console.log(gene_edition) + let geneItems = await getGeneratorEditionItems(gene_edition, itemSet) + let itemCounts = countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) + if(gene_edition === 'premium') { + console.log('naur') + if(itemCounts[0] >= itemCounts[1]) $('#pregene-roll').attr('disabled', 'disabled') + else $('#pregene-roll').removeAttr('disabled') + } else if(gene_edition === 'valkyrie') { + console.log('yes1') + if(itemSet >= 1 && itemSet <= 5) { + console.log('yes2') + if(itemCounts[0] >= itemCounts[1]) $('#valgene-roll').attr('disabled', 'disabled') + else $('#valgene-roll').removeAttr('disabled') + } else $('#valgene-roll').attr('disabled', 'disabled') + } + + + $('.count').text('Unlocked items: ' + itemCounts[0] + "/" + itemCounts[1]) + if(itemSet === 1) { + $('.setinfo').append('

These items are only usable in Japan. Change region to Japan in the ea3-config.xml file.

') + } else { + $('.jpn-excl').remove() + } + + if('crew' in geneItems.items) { + $('.item_banners').append('

Nemsys Crew

') + $('.item_banners').append('

') + loadImages(geneItems.items['crew'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'crew', items_crew) + } + + if('stamp' in geneItems.items) { + $('.item_banners').append('

Appeal Stamp

') + $('.item_banners').append('

') + loadImages(geneItems.items['stamp'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'stamp', items_stamp) + } + + if('subbg' in geneItems.items) { + $('.item_banners').append('

Submonitor BG

') + $('.item_banners').append('

') + loadImages(geneItems.items['subbg'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'bg', items_subbg) + } + + if('bgm' in geneItems.items) { + $('.item_banners').append('

BGM

') + $('.item_banners').append('

') + loadImages(geneItems.items['bgm'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'bgm', items_bgm) + } + + if('nemsys' in geneItems.items) { + $('.item_banners').append('

Nemsys

') + $('.item_banners').append('

') + loadImages(geneItems.items['nemsys'].sort(function(a, b){return parseInt(a.id) - parseInt(b.id)}), 'nemsys', items_nemsys) + } +} + +async function loadValgeneData(gene_edition) { + let valGeneData = await $.getJSON( "static/asset/json/valgene_data.json", function(data) { + return data + }) + if(gene_edition === 'valkyrie') { + for(const valGeneDataIndex in valGeneData.valgene) { + $('#set_select').append('') + } + } else { + for(const pregeneDataIndex in valGeneData.pregene) { + $('#set_select').append('') + } + } + $('#set_select').val($("#set_select option").length) +} + +$(document).ready(async function() { + if(document.getElementById("data-pass-unlock-all").innerText === 'true') { + $('.card-content').text("The \"Unlock All Valkyrie and Premium Items\" option is enabled. You wouldn't need this.") + $('#pregene-roll').attr('disabled') + return 0; + } + + $('#roll-result').on('click', function(){location.reload()}) + + $('html').keypress(function(e){ + if([13, 27, 32].includes(e.keyCode) && $('.modal.is-active').length > 0) { + location.reload() + } + }) + + $('.input').hide() + $('.button').addClass('is-link') + let refid = document.getElementsByName("refid")[0].value + let items_crew = JSON.parse(document.getElementById("data-pass-crew").innerText); + let items_stamp = JSON.parse(document.getElementById("data-pass-stamp").innerText); + let items_subbg = JSON.parse(document.getElementById("data-pass-subbg").innerText); + let items_bgm = JSON.parse(document.getElementById("data-pass-bgm").innerText); + let items_nemsys = JSON.parse(document.getElementById("data-pass-nemsys").innerText); + let gene_edition = document.getElementById("generator-edition").innerText; + await loadValgeneData(gene_edition) + loadItems($('#set_select').val(), gene_edition, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) + + $('#set_select').change(function() { + $('.count').text('') + $('.item_banners').empty() + loadItems(parseInt($('#set_select').val()), gene_edition, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys) + }) + + $('#pregene-roll, #valgene-roll').on('click', async function() { + console.log('cliucked') + $('#pregene-roll, #valgene-roll').attr('disabled', 'disabled') + if(gene_edition === 'premium' && window.location.search.match(/(premium)/g) != undefined) { + let geneItems = await getGeneratorEditionItems(gene_edition, parseInt($('#set_select').val())) + if(countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys)[0] >= countGeneItems(geneItems, items_crew, items_stamp, items_subbg, items_bgm, items_nemsys)[1]) { + alert("All items have been unlocked already.") + } else { + emit('preGeneRoll', { + set: parseInt(document.getElementById('set_select').value), + refid: refid, + geneEdition: gene_edition, + items: items_crew.concat(items_stamp, items_subbg, items_bgm, items_nemsys) + }).then( + function() { + $.getJSON("static/asset/logs/preGeneRollResult.json", function(data) { + $('.modal-card-head').append('') + $('.modal-card-body').append('') + $('.modal-card-foot').append('') + $('.modal').addClass('is-active') + }) + }) + } + } else { + alert("Not premium generator: a precaution") + } + }) +}) diff --git a/sdvx@asphyxia/webui/asset/json/events.json b/sdvx@asphyxia/webui/asset/json/events.json index bc425f1..9310a02 100644 --- a/sdvx@asphyxia/webui/asset/json/events.json +++ b/sdvx@asphyxia/webui/asset/json/events.json @@ -4,10 +4,7 @@ "id": "xrecord", "in_game_event": false, "name": "X-record", - "info": [ - "1st set of songs from X-record; originally unlocked by playing either SOUND VOLTEX on the Valkyrie model, or beatmaniaIIDX on the Lightning model.
Enable this option to have them automatically unlocked and saved to your account.", - "2nd set of songs from X-record; originally unlocked by playing either SOUND VOLTEX on the Valkyrie model, or beatmaniaIIDX on the Lightning model.
Enable this option to have them automatically unlocked and saved to your account." - ] + "info": "1st set of songs from X-record; originally unlocked by playing either SOUND VOLTEX on the Valkyrie model, or beatmaniaIIDX on the Lightning model.
Enable this option to activate this event.
(imho all cross events like this should be in a separate asphyxia plugin altogether)" }, { "id": "konasute", @@ -25,50 +22,67 @@ "id": "bpl2021", "in_game_event": false, "name": "BPL応援 楽曲解禁スタンプラリー (BPL ouen gakkyoku kaikin stamp rally)", - "info": "Songs in this event are originally unlocked by accessing the official BEMANI PRO LEAGUE 2021 website and obtaining the stamp by watching VODs of the BPL competition.
Enable this option to have them unlocked and saved to your account." + "info": "Songs in this event are originally unlocked by accessing the official BEMANI PRO LEAGUE 2021 website and obtaining the stamp by watching VODs of the BPL competition.
Enable this option to activate this event." }, { "id": "bsb2021", "in_game_event": false, "name": "BEMANI 2021真夏の歌合戦5番勝負 (BEMANI 2021 manatsu no utagassen 5 ban shoubu)", - "info": "This is a cross-BEMANI event. Songs are originally unlocked by playing participating BEMANI games and earn 'Yell' points.
Enable this option to have the songs unlocked and saved to your account." + "info": "This is a cross-BEMANI event. Songs are originally unlocked by playing participating BEMANI games and earn 'Yell' points.
Enable this option to activate this event." }, { "id": "sdvx10thstamp", "in_game_event": true, "name": "SOUND VOLTEX 10th Anniversary", - "info": "Stamp event to unlock 7 songs.
Enable this option to enable this stamp event." + "info": "Stamp event to unlock 7 songs.
Enable this option to enable this stamp event in-game." }, { "id": "reflecstamp", "in_game_event": true, "name": "REFLEC BEAT Song Stamp Event", - "info": "Stamp event to unlock 5 songs originally from the REFLEC BEAT game.
Enable this option to enable this stamp event." + "info": "Stamp event to unlock 5 songs originally from the REFLEC BEAT game.
Enable this option to enable this stamp event in-game." }, { "id": "gmz2022", "in_game_event": false, "name": "いちかのごちゃまぜMix UP! (Ichika no gochamaze Mix UP! )", - "info": "This is a cross-BEMANI event. Songs include some that are shared from other BEMANI games and some that are mashup/remixes of the shared songs. These are originally unlocked by playing participating BEMANI games and earning points to fill different gauges.

Enable this option to have the songs unlocked and saved to your account." + "info": "This is a cross-BEMANI event. Songs include some that are shared from other BEMANI games and some that are mashup/remixes of the shared songs. These are originally unlocked by playing participating BEMANI games and earning points to fill different gauges.

Enable this option to activate this event." }, { "id": "bpl2022", "in_game_event": false, "name": "BEMANI PRO LEAGUE -SEASON 2-! Original Song", "info": [ - "Enable this option to have songs from the 1st week unlocked on the next login.
Otherwise, the songs are still unlockable through BLASTER GATE.", - "Enable this option to have songs from the 2nd week unlocked on the next login.
Otherwise, the songs are still unlockable through BLASTER GATE.", - "Enable this option to have songs from the 3rd week unlocked on the next login.
Otherwise, the songs are still unlockable through BLASTER GATE.", - "Enable this option to have songs from the 4th week unlocked on the next login.
Otherwise, the songs are still unlockable through BLASTER GATE.", - "Enable this option to have songs from the 5th week unlocked on the next login.
Otherwise, the songs are still unlockable through BLASTER GATE.", - "Enable this option to have songs from the 6th week unlocked on the next login.
Otherwise, the songs are still unlockable through BLASTER GATE." + "Week 1 songs: 'Chat perché' and 'WINNING ROAD'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 2 songs: 'ENDGAME' and 'ИADIR'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 3 songs: 'Ice Fortress' and 'MURASAME'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 4 songs: 'Initiating League' and 'Scat Jazz Dance'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 5 songs: '最果ての勇者にラブソングを' and '灼ナル刃、破カヰ譜'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 6 songs: 'Fl0ating:' and 'Petit espoir'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 7 songs: 'Paradigm Shift' and 'イグノアザーズ'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 8 songs: 'Thousand Triggers' and 'trea→journey'
Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 9 songs: 'MILITARY R04D'
Enable this option to have this song unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 10 songs: 'DEUX EX MĀXHINĀ'
Enable this option to have this song unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.", + "Week 11 songs: 'All We Need is HAPPY END!!!'
Enable this option to have this song unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE." ] }, { "id": "pcbevent", "in_game_event": true, "name": "PCB Stamp Event", - "info": "Stamp event to earn PCB.
Enable this option to enable this stamp event." + "info": "Stamp event to earn PCB.
Enable this option to activate this stamp event in-game." + }, + { + "id": "2023appealstampevent", + "in_game_event": true, + "name": "新春スタンプボーナス (2023 New Year Stamp Bonus Event)", + "info": "Stamp event to unlock a special appeal card to commemorate the new year (2023).
Enable this option to activate this stamp event in-game." + }, + { + "id": "11thannivappealstampevent", + "in_game_event": true, + "name": "11周年記念スタンプ (SDVX 11th Anniversary Appeal Card Stamp Bonus Event)", + "info": "Stamp event to unlock a special appeal card to commemorate the 11th anniversary of SOUND VOLTEX.
Enable this option to activate this stamp event in-game." } ] } \ No newline at end of file diff --git a/sdvx@asphyxia/webui/profile_premium generator.pug b/sdvx@asphyxia/webui/profile_premium generator.pug index 604e1dc..3200a1b 100644 --- a/sdvx@asphyxia/webui/profile_premium generator.pug +++ b/sdvx@asphyxia/webui/profile_premium generator.pug @@ -35,7 +35,7 @@ div .select select(name="set_select" id="set_select") // option(value="1") Premium Generator 1 (Aqua Set) - div(style="padding: 15px; text-align: center;") + div(id="roll-div" style="padding: 15px; text-align: center;") div.setinfo(style="padding: 5px") h3.count() input.input(type="text" name="refid", value=refid readonly) diff --git a/sdvx@asphyxia/webui/profile_valkyrie generator.pug b/sdvx@asphyxia/webui/profile_valkyrie generator.pug index 69fdcee..97a59b8 100644 --- a/sdvx@asphyxia/webui/profile_valkyrie generator.pug +++ b/sdvx@asphyxia/webui/profile_valkyrie generator.pug @@ -28,10 +28,11 @@ div .control .select select(name="set_select" id="set_select") - div(style="padding: 15px; text-align: center;") + div(id="roll-div" style="padding: 15px; text-align: center;") div(style="padding: 5px") h3.count() input.input(type="text" name="refid", value=refid readonly) + button.button(id="valgene-roll" style="font-size: 20px") Roll br() div.item_banners()