sdvx: added WIP features - arena save, valgene, common.ts updates, webui features
This commit is contained in:
+434
-244
@@ -1,263 +1,453 @@
|
||||
import { EVENT4, COURSES4, EXTENDS4 } from '../data/hvn';
|
||||
import { EVENT5, COURSES5, EXTENDS5 } from '../data/vvw';
|
||||
import { EVENT6, COURSES6, EXTENDS6 } from '../data/exg';
|
||||
import { EVENT6, COURSES6, EXTENDS6, APRILFOOLSSONGS, XRECORDSONGS,
|
||||
KONASTESONGS, BEMANI2021EVENTSONGS, BPLSTAMPRALLYSONGS, SDVX10THSTAMPSONGS,
|
||||
REFLECBEATSTAMPSONGS, VALKYRIEEXCLUSIVESONGS, MISSINGSONGS6, ARENA, VALGENE
|
||||
} from '../data/exg';
|
||||
import { COURSE2 } from '../data/inf';
|
||||
import {getVersion, getRandomIntInclusive} from '../utils';
|
||||
|
||||
function writeLog(log){
|
||||
if(U.GetConfig('debug_log_toggle')) {
|
||||
console.log(log);
|
||||
}
|
||||
}
|
||||
|
||||
export const common: EPR = async (info, data, send) => {
|
||||
let events = [];
|
||||
let courses = [];
|
||||
let extend = [];
|
||||
console.log("Calling common function");
|
||||
|
||||
const version = parseInt(info.model.split(":")[4]);
|
||||
try {
|
||||
IO.ReadFile('webui\\asset\\json\\music_db.json').then(
|
||||
function(value) {
|
||||
let events = [];
|
||||
let courses = [];
|
||||
let extend = [];
|
||||
let date = new Date();
|
||||
let currentYMDDate = parseInt([date.getFullYear(), ((date.getMonth() + 1) > 9 ? '' : '0') + (date.getMonth() + 1), (date.getDate() > 9 ? '' : '0') + date.getDate()].join(''));
|
||||
let currentDate = date.toLocaleDateString()
|
||||
writeLog("Calling common function");
|
||||
|
||||
const version = parseInt(info.model.split(":")[4]);
|
||||
|
||||
if (version <= 2013052900) {
|
||||
return send.pugFile('templates/booth/common.pug');
|
||||
}
|
||||
|
||||
if (version <= 2014112000) {
|
||||
courses = COURSE2;
|
||||
return send.pugFile('templates/infiniteinfection/common.pug',{
|
||||
courses,
|
||||
});
|
||||
}
|
||||
if (version <= 2013052900) {
|
||||
writeLog('Game: Booth')
|
||||
return send.pugFile('templates/booth/common.pug');
|
||||
}
|
||||
|
||||
if (version <= 2014112000) {
|
||||
writeLog('Game: Infinite Infection')
|
||||
courses = COURSE2;
|
||||
return send.pugFile('templates/infiniteinfection/common.pug',{
|
||||
courses,
|
||||
});
|
||||
}
|
||||
|
||||
switch (info.method) {
|
||||
case 'sv4_common': {
|
||||
events = EVENT4;
|
||||
courses = COURSES4;
|
||||
//extend = EXTENDS4;
|
||||
EXTENDS4.forEach(val => extend.push(Object.assign({}, val)));
|
||||
break;
|
||||
}
|
||||
case 'sv5_common': {
|
||||
events = EVENT5;
|
||||
courses = COURSES5;
|
||||
//extend = EXTENDS5;
|
||||
EXTENDS5.forEach(val => extend.push(Object.assign({}, val)));
|
||||
break;
|
||||
}
|
||||
case 'sv6_common': {
|
||||
//events = EVENT6;
|
||||
EVENT6.forEach(val => events.push(val));
|
||||
courses = COURSES6;
|
||||
EXTENDS6.forEach(val => extend.push(Object.assign({}, val)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
let songs = [];
|
||||
switch (info.method) {
|
||||
case 'sv4_common': {
|
||||
writeLog('Game: Heavenly Haven')
|
||||
events = EVENT4;
|
||||
courses = COURSES4;
|
||||
//extend = EXTENDS4;
|
||||
EXTENDS4.forEach(val => extend.push(Object.assign({}, val)));
|
||||
break;
|
||||
}
|
||||
case 'sv5_common': {
|
||||
writeLog('Game: Vivid Wave')
|
||||
events = EVENT5;
|
||||
courses = COURSES5;
|
||||
//extend = EXTENDS5;
|
||||
EXTENDS5.forEach(val => extend.push(Object.assign({}, val)));
|
||||
break;
|
||||
}
|
||||
case 'sv6_common': {
|
||||
writeLog('Game: Exceed Gear')
|
||||
//events = EVENT6;
|
||||
EVENT6.forEach(val => events.push(val));
|
||||
courses = COURSES6;
|
||||
// IO.ReadFile('webui\\asset\\json\\course_data.json').then(
|
||||
// function(yesData){
|
||||
// console.log('yes')
|
||||
// let courseData = JSON.parse(yesData)
|
||||
// courses = courseData.courseData.find(data => data.version == 6).info;
|
||||
// },
|
||||
// function(noData){
|
||||
// console.log(noData)
|
||||
// })
|
||||
EXTENDS6.forEach(val => extend.push(Object.assign({}, val)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
let songs = [];
|
||||
const gameVersion = getVersion(info);
|
||||
let songNum = 2000;
|
||||
if(gameVersion === 2) songNum = 554;
|
||||
if(gameVersion === 3) songNum = 954;
|
||||
if(gameVersion === 4) songNum = 1368;
|
||||
|
||||
if (U.GetConfig('unlock_all_songs')) {
|
||||
console.log("Unlocking songs");
|
||||
const gameVersion = getVersion(info);
|
||||
let songNum = 2000;
|
||||
if(gameVersion === 2) songNum = 554;
|
||||
if(gameVersion === 3) songNum = 954;
|
||||
if(gameVersion === 4) songNum = 1368;
|
||||
for (let i = 1; i < songNum; ++i) {
|
||||
for (let j = 0; j < 5; ++j) {
|
||||
songs.push({
|
||||
music_id: K.ITEM('s32', i),
|
||||
music_type: K.ITEM('u8', j),
|
||||
limited: K.ITEM('u8', 3),
|
||||
});
|
||||
if(U.GetConfig('unlock_all_songs')) {
|
||||
writeLog("Unlocking songs");
|
||||
for (let i = 1; i < songNum; ++i) {
|
||||
for (let j = 0; j < 5; ++j) {
|
||||
songs.push({
|
||||
music_id: K.ITEM('s32', i),
|
||||
music_type: K.ITEM('u8', j),
|
||||
limited: K.ITEM('u8', 3),
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let RESTRICT_SONGS = XRECORDSONGS.concat(KONASTESONGS, BEMANI2021EVENTSONGS, BPLSTAMPRALLYSONGS, SDVX10THSTAMPSONGS, REFLECBEATSTAMPSONGS);
|
||||
let mdb = JSON.parse(value);
|
||||
|
||||
let limitedNo = 2;
|
||||
for (let i = 0; i < songNum; i++) {
|
||||
var foundSongIndex = mdb.mdb.music.map(function(x) {return x['@id']; }).indexOf(i.toString());
|
||||
if(foundSongIndex != -1) {
|
||||
var songData = mdb.mdb.music[foundSongIndex];
|
||||
if(gameVersion === 6 || gameVersion === -6) {
|
||||
if(!RESTRICT_SONGS.includes(i.toString())) {
|
||||
if(songData.info.version['#text'] === '6' && currentYMDDate >= parseInt(songData.info.distribution_date['#text'])) {
|
||||
if(parseInt(songData.info.distribution_date['#text']) >= parseInt(version.toString().substring(0,8))) {
|
||||
writeLog("Found new song for version " + version + ": " + songData.info.title_name + "(" + songData.info.distribution_date['#text'] + ")");
|
||||
}
|
||||
limitedNo = 2;
|
||||
if(MISSINGSONGS6.includes(i.toString())) {
|
||||
limitedNo += 1;
|
||||
}
|
||||
else if(!U.GetConfig('enable_valk_songs') && (VALKYRIEEXCLUSIVESONGS.includes(i.toString()) && (info.model.split(":")[2] != 'G' || info.model.split(":")[2] != 'H'))){
|
||||
limitedNo -= 1;
|
||||
}
|
||||
for(let j = 0; j < 5; j++) {
|
||||
songs.push({
|
||||
music_id: K.ITEM('s32', i),
|
||||
music_type: K.ITEM('u8', j),
|
||||
limited: K.ITEM('u8', limitedNo),
|
||||
});
|
||||
}
|
||||
} else if (songData.info.inf_ver['#text'] === '6') {
|
||||
songs.push({
|
||||
music_id: K.ITEM('s32', i),
|
||||
music_type: K.ITEM('u8', 3),
|
||||
limited: K.ITEM('u8', limitedNo),
|
||||
});
|
||||
}
|
||||
} else {
|
||||
writeLog("Restricted song: " + songData.info.title_name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(U.GetConfig('use_information')){
|
||||
console.log("Sending server information");
|
||||
let time = new Date();
|
||||
let tempDate = time.getDate();
|
||||
const currentTime = parseInt((time.getTime()/100000) as unknown as string)*100;
|
||||
extend.push({
|
||||
id: 1,
|
||||
type: 1,
|
||||
params: [
|
||||
1,
|
||||
currentTime,
|
||||
1,
|
||||
1,
|
||||
31,
|
||||
'[f:0]SERVER INFORMATION',
|
||||
'[sz:120] [olc:555555][ol:4][c:ff3333,3333ff,77ff77]Asphyxia\n'+
|
||||
'[sz:75] CORE\n[sz:30]'+
|
||||
'[sz:30][c:ffffff,888888] \n \n'+
|
||||
' [c:00d5ff,888888]ASPHYXIA CORE'+CORE_VERSION+'\n'+
|
||||
' [c:e5f3ff,a3d5ff]SDVX Plugin ver 6.0.0\n \n \n'+
|
||||
'\n\n [f:0][c:ff3333,ffffff]FREE SOFTWARE. BEWARE OF SCAMMERS.\n'+
|
||||
'[c:ffffff,888888] If you bought this software, request refund immediately.\n \n \n[/ol]'+
|
||||
'[br:10][c:00FFFF][sz:50]メリー。。。クリスマス、です。。。'+
|
||||
'\n \n \n \n[sz:32][c:560000,FC0000]DO NOT STREAM OR DISTRIBUTE THIS GAME IN PUBLIC',
|
||||
//'[img:test]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
if(U.GetConfig('new_year_special')){
|
||||
events.push('NEW_YEAR_2022');
|
||||
}
|
||||
if(U.GetConfig('use_information')){
|
||||
writeLog("Sending server information");
|
||||
let time = new Date();
|
||||
let tempDate = time.getDate();
|
||||
const currentTime = parseInt((time.getTime()/100000) as unknown as string)*100;
|
||||
extend.push({
|
||||
id: 1,
|
||||
type: 1,
|
||||
params: [
|
||||
1,
|
||||
currentTime,
|
||||
1,
|
||||
1,
|
||||
31,
|
||||
'[f:0]SERVER INFORMATION',
|
||||
'[sz:120] [olc:555555][ol:4][c:ff3333,3333ff,77ff77]Asphyxia\n'+
|
||||
'[sz:75] CORE\n[sz:30]'+
|
||||
'[sz:30][c:ffffff,888888] \n \n'+
|
||||
' [c:00d5ff,888888]ASPHYXIA CORE'+CORE_VERSION+'\n'+
|
||||
' [c:e5f3ff,a3d5ff]SDVX Plugin ver 6.0.0\n \n \n'+
|
||||
'\n\n [f:0][c:ff3333,ffffff]FREE SOFTWARE. BEWARE OF SCAMMERS.\n'+
|
||||
'[c:ffffff,888888] If you bought this software, request refund immediately.\n \n \n[/ol]'+
|
||||
'[br:10][c:00FFFF][sz:50]メリー。。。クリスマス、です。。。'+
|
||||
'\n \n \n \n[sz:32][c:560000,FC0000]DO NOT STREAM OR DISTRIBUTE THIS GAME IN PUBLIC',
|
||||
//'[img:test]',
|
||||
'',
|
||||
'',
|
||||
'',
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
if(U.GetConfig('use_asphyxia_gameover')){
|
||||
let time = new Date();
|
||||
let tempDate = time.getDate();
|
||||
const currentTime = parseInt((time.getTime()/100000) as unknown as string)*100;
|
||||
let rightCharater = [
|
||||
"go_bansui","go_bof","go_cannon","go_chinema","go_chocopla",
|
||||
"go_dd","go_ekusa","go_esp","go_flowry","go_fukuryu",
|
||||
"go_gorilla","go_grace","go_grace_rori","go_grace_ver06","go_haelequin",
|
||||
"go_haruka","go_joyeuse","go_kino","go_kisa","go_mai",
|
||||
"go_makina","go_makishima","go_left","go_makishima_ver06","go_mitsuru","go_miyako",
|
||||
"go_nana","go_natsuhi","go_noisia","go_left_ver06","go_ondine","go_pannakotta",
|
||||
"go_psychoholic","go_rain","go_rain02","go_ribbon","go_right",
|
||||
"go_riot","go_rishna","go_rouge","go_sakurako","go_satan",
|
||||
"go_tama","go_torako","go_vela","go_vertex","go_wabutan",
|
||||
"go_wanlove","go_yusya",
|
||||
];
|
||||
let leftCharater = [
|
||||
"go_akane","go_apex4sis","go_candy","go_capsaicin","go_chikage",
|
||||
"go_evileye","go_fluorine","go_gangara","go_gin","go_hero",
|
||||
"go_hiryubiren","go_hiyuki","go_hotaru","go_inoten","go_kamito",
|
||||
"go_kanade","go_kemuri","go_kokona","go_konoha","go_kouki",
|
||||
"go_kureha","go_left_bag","go_madholic",
|
||||
"go_mimiko","go_mion","go_mitsuruco","go_nathanael","go_nishinippori",
|
||||
"go_ortlinde","go_pico","go_pilica","go_profession","go_rasis",
|
||||
"go_rasis_ver06","go_right_ver06","go_rimuru","go_rowa","go_saigawara",
|
||||
"go_setu","go_shelly","go_soul","go_tamaneko","go_toraipuru",
|
||||
"go_tsubaki","go_tsumabuki","go_tsumabuki_ver06","go_yuki","go_yukito",
|
||||
];
|
||||
let middleCharater = ["go_cat","go_cawoashi","go_iruyoru","go_neno",];
|
||||
// Pattern 1 Left Right Left
|
||||
// Pattern 2 Right Left Right
|
||||
// Pattern 3 Right Middle Left
|
||||
// Pattern 4 Left Middle Right
|
||||
// switch(getVersion(info)){
|
||||
// case 5:{
|
||||
// break;
|
||||
// }
|
||||
// case 6:{
|
||||
// rightCharater.push();
|
||||
// leftCharater.push();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
var charaString = "characters: ";
|
||||
let pattern = getRandomIntInclusive(1,4);
|
||||
switch(pattern){
|
||||
case 1:{
|
||||
var chara1 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
var chara2 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
var chara3 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
charaString += "chara01/"+chara1+" chara02/"+chara2+" chara01/"+chara3;
|
||||
break;
|
||||
}
|
||||
case 2:{
|
||||
var chara1 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
var chara2 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
var chara3 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
charaString += "chara02/"+chara1+" chara01/"+chara2+" chara02/"+chara3;
|
||||
break;
|
||||
}
|
||||
case 3:{
|
||||
var chara1 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
var chara2 = middleCharater[getRandomIntInclusive(0,middleCharater.length-1)]
|
||||
var chara3 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
charaString += "chara02/"+chara1+" chara03/"+chara2+" chara01/"+chara3;
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
var chara1 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
var chara2 = middleCharater[getRandomIntInclusive(0,middleCharater.length-1)];
|
||||
var chara3 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
charaString += "chara01/"+chara1+" chara03/"+chara2+" chara02/"+chara3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(U.GetConfig('use_asphyxia_gameover')){
|
||||
let time = new Date();
|
||||
let tempDate = time.getDate();
|
||||
const currentTime = parseInt((time.getTime()/100000) as unknown as string)*100;
|
||||
let rightCharater = [
|
||||
"go_bansui","go_bof","go_cannon","go_chinema","go_chocopla",
|
||||
"go_dd","go_ekusa","go_esp","go_flowry","go_fukuryu",
|
||||
"go_gorilla","go_grace","go_grace_rori","go_grace_ver06","go_haelequin",
|
||||
"go_haruka","go_joyeuse","go_kino","go_kisa","go_mai",
|
||||
"go_makina","go_makishima","go_left","go_makishima_ver06","go_mitsuru","go_miyako",
|
||||
"go_nana","go_natsuhi","go_noisia","go_left_ver06","go_ondine","go_pannakotta",
|
||||
"go_psychoholic","go_rain","go_rain02","go_ribbon","go_right",
|
||||
"go_riot","go_rishna","go_rouge","go_sakurako","go_satan",
|
||||
"go_tama","go_torako","go_vela","go_vertex","go_wabutan",
|
||||
"go_wanlove","go_yusya",
|
||||
];
|
||||
let leftCharater = [
|
||||
"go_akane","go_apex4sis","go_candy","go_capsaicin","go_chikage",
|
||||
"go_evileye","go_fluorine","go_gangara","go_gin","go_hero",
|
||||
"go_hiryubiren","go_hiyuki","go_hotaru","go_inoten","go_kamito",
|
||||
"go_kanade","go_kemuri","go_kokona","go_konoha","go_kouki",
|
||||
"go_kureha","go_left_bag","go_madholic",
|
||||
"go_mimiko","go_mion","go_mitsuruco","go_nathanael","go_nishinippori",
|
||||
"go_ortlinde","go_pico","go_pilica","go_profession","go_rasis",
|
||||
"go_rasis_ver06","go_right_ver06","go_rimuru","go_rowa","go_saigawara",
|
||||
"go_setu","go_shelly","go_soul","go_tamaneko","go_toraipuru",
|
||||
"go_tsubaki","go_tsumabuki","go_tsumabuki_ver06","go_yuki","go_yukito",
|
||||
];
|
||||
let middleCharater = ["go_cat","go_cawoashi","go_iruyoru","go_neno",];
|
||||
// Pattern 1 Left Right Left
|
||||
// Pattern 2 Right Left Right
|
||||
// Pattern 3 Right Middle Left
|
||||
// Pattern 4 Left Middle Right
|
||||
// switch(getVersion(info)){
|
||||
// case 5:{
|
||||
// break;
|
||||
// }
|
||||
// case 6:{
|
||||
// rightCharater.push();
|
||||
// leftCharater.push();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
var charaString = "characters: ";
|
||||
let pattern = getRandomIntInclusive(1,4);
|
||||
switch(pattern){
|
||||
case 1:{
|
||||
var chara1 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
var chara2 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
var chara3 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
charaString += "chara01/"+chara1+" chara02/"+chara2+" chara01/"+chara3;
|
||||
break;
|
||||
}
|
||||
case 2:{
|
||||
var chara1 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
var chara2 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
var chara3 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
charaString += "chara02/"+chara1+" chara01/"+chara2+" chara02/"+chara3;
|
||||
break;
|
||||
}
|
||||
case 3:{
|
||||
var chara1 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
var chara2 = middleCharater[getRandomIntInclusive(0,middleCharater.length-1)]
|
||||
var chara3 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
charaString += "chara02/"+chara1+" chara03/"+chara2+" chara01/"+chara3;
|
||||
break;
|
||||
}
|
||||
case 4:{
|
||||
var chara1 = leftCharater[getRandomIntInclusive(0,leftCharater.length-1)];
|
||||
var chara2 = middleCharater[getRandomIntInclusive(0,middleCharater.length-1)];
|
||||
var chara3 = rightCharater[getRandomIntInclusive(0,rightCharater.length-1)];
|
||||
charaString += "chara01/"+chara1+" chara03/"+chara2+" chara02/"+chara3;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(Math.abs(getVersion(info)) == 6){//Due to older version misses newer characters, not supported on older versions
|
||||
extend.push({
|
||||
id: 3,
|
||||
type: 1,
|
||||
params: [
|
||||
3,
|
||||
currentTime,
|
||||
0,
|
||||
60,
|
||||
0,
|
||||
'[GAMEOVER]',
|
||||
'[ol:6][olc:FFFFFF][ds:4][dsc:000000][sz:32][c:99FF00A8]Thank You For Using Asphyxia CORE!!!',
|
||||
'[ol:6][olc:FFFFFF][ds:4][dsc:000000][sz:32][c:990D46F2]For more information please visit our Discord!',
|
||||
'[ol:6][olc:FFFFFF][ds:4][dsc:000000][sz:32][c:99ED4F39]Nice Play!!!',
|
||||
//'characters: chara01/go_rasis_ver06 chara02/go_left_ver06 chara01/go_right_ver06',
|
||||
charaString,
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
if(Math.abs(getVersion(info)) == 6){//Due to older version misses newer characters, not supported on older versions
|
||||
extend.push({
|
||||
id: 3,
|
||||
type: 1,
|
||||
params: [
|
||||
3,
|
||||
currentTime,
|
||||
0,
|
||||
60,
|
||||
0,
|
||||
'[GAMEOVER]',
|
||||
'[ol:6][olc:FFFFFF][ds:4][dsc:000000][sz:32][c:99FF00A8]Thank You For Using Asphyxia CORE!!!',
|
||||
'[ol:6][olc:FFFFFF][ds:4][dsc:000000][sz:32][c:990D46F2]For more information please visit our Discord!',
|
||||
'[ol:6][olc:FFFFFF][ds:4][dsc:000000][sz:32][c:99ED4F39]Nice Play!!!',
|
||||
//'characters: chara01/go_rasis_ver06 chara02/go_left_ver06 chara01/go_right_ver06',
|
||||
charaString,
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
console.log("Sending common objects");
|
||||
send.object(
|
||||
{
|
||||
event: {
|
||||
info: events.map(e => ({
|
||||
event_id: K.ITEM('str', e),
|
||||
})),
|
||||
writeLog("Sending common objects");
|
||||
|
||||
let arena_catalog_items = []
|
||||
let catalog = []
|
||||
let campaign = []
|
||||
|
||||
if(U.GetConfig('arena_szn') == 'debug') {
|
||||
for(let xxx = 0; xxx<=20; xxx++){
|
||||
arena_catalog_items.push({
|
||||
catalog_id: K.ITEM('s32', 1),
|
||||
catalog_type: K.ITEM('s32', 1),
|
||||
price: K.ITEM('s32', 1000),
|
||||
item_type: K.ITEM('s32', U.GetConfig('arena_debug_item_type')),
|
||||
item_id: K.ITEM('s32', xxx),
|
||||
param: K.ITEM('s32', 1),
|
||||
})
|
||||
}
|
||||
}
|
||||
else{
|
||||
for (let catalog_item in ARENA[U.GetConfig('arena_szn')].arena_items) {
|
||||
arena_catalog_items.push({
|
||||
catalog_id: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].arena_items[catalog_item].catalog_id),
|
||||
catalog_type: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].arena_items[catalog_item].catalog_type),
|
||||
price: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].arena_items[catalog_item].price),
|
||||
item_type: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].arena_items[catalog_item].item_type),
|
||||
item_id: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].arena_items[catalog_item].item_id),
|
||||
param: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].arena_items[catalog_item].param),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
let valgene_info = []
|
||||
let valgene_items = []
|
||||
VALGENE.info.forEach(val => valgene_info.push({
|
||||
valgene_name: K.ITEM('str', val.valgene_name),
|
||||
valgene_name_english: K.ITEM('str', val.valgene_name_english),
|
||||
valgene_id: K.ITEM('s32', val.valgene_id)
|
||||
}))
|
||||
VALGENE.catalog.forEach((val) => {
|
||||
val.items.forEach((itemVal) => {
|
||||
itemVal.item_ids.forEach((item_id) => {
|
||||
valgene_items.push({
|
||||
valgene_id: K.ITEM('s32', val.volume),
|
||||
rarity: K.ITEM('s32', VALGENE.rarity[itemVal.type.toString()]),
|
||||
item_type: K.ITEM('s32', itemVal.type),
|
||||
item_id: K.ITEM('s32', item_id)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
if(U.GetConfig('april_fools') || currentDate.substring(0,3) === '4/1') {
|
||||
writeLog('Using April Fools Event')
|
||||
events.push('APRIL_GRACE');
|
||||
events.push('EVENTDATE_APRILFOOL');
|
||||
for (const afsong in APRILFOOLSSONGS) {
|
||||
for (let j = 0; j < 5; ++j) {
|
||||
songs.push({
|
||||
music_id: K.ITEM('s32', parseInt(APRILFOOLSSONGS[afsong])),
|
||||
music_type: K.ITEM('u8', j),
|
||||
limited: K.ITEM('u8', 3),
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(U.GetConfig('new_year_special')){
|
||||
writeLog('Using New Year Special BGM')
|
||||
events.push('NEW_YEAR_2022');
|
||||
}
|
||||
|
||||
console.log(courses[0].id)
|
||||
send.object(
|
||||
{
|
||||
valgene: {
|
||||
info: valgene_info,
|
||||
catalog: valgene_items
|
||||
},
|
||||
arena: {
|
||||
season: K.ITEM('s32', ARENA[U.GetConfig('arena_szn')].details.season),
|
||||
time_start: K.ITEM('u64', ARENA[U.GetConfig('arena_szn')].details.time_start),
|
||||
time_end: K.ITEM('u64', ARENA[U.GetConfig('arena_szn')].details.time_end),
|
||||
shop_start: K.ITEM('u64', ARENA[U.GetConfig('arena_szn')].details.shop_start),
|
||||
shop_end: K.ITEM('u64', ARENA[U.GetConfig('arena_szn')].details.shop_end),
|
||||
is_open: K.ITEM('bool', ARENA[U.GetConfig('arena_szn')].details.is_open),
|
||||
is_shop: K.ITEM('bool', ARENA[U.GetConfig('arena_szn')].details.is_shop),
|
||||
catalog: arena_catalog_items
|
||||
},
|
||||
event: {
|
||||
info: events.map(e => ({
|
||||
event_id: K.ITEM('str', e),
|
||||
})),
|
||||
},
|
||||
extend: {
|
||||
info: extend.map(e => ({
|
||||
extend_id: K.ITEM('u32', e.id),
|
||||
extend_type: K.ITEM('u32', e.type),
|
||||
param_num_1: K.ITEM('s32', e.params[0]),
|
||||
param_num_2: K.ITEM('s32', e.params[1]),
|
||||
param_num_3: K.ITEM('s32', e.params[2]),
|
||||
param_num_4: K.ITEM('s32', e.params[3]),
|
||||
param_num_5: K.ITEM('s32', e.params[4]),
|
||||
param_str_1: K.ITEM('str', e.params[5]),
|
||||
param_str_2: K.ITEM('str', e.params[6]),
|
||||
param_str_3: K.ITEM('str', e.params[7]),
|
||||
param_str_4: K.ITEM('str', e.params[8]),
|
||||
param_str_5: K.ITEM('str', e.params[9]),
|
||||
})),
|
||||
},
|
||||
music_limited: { info: songs },
|
||||
skill_course: {
|
||||
info: courses.reduce(
|
||||
(acc, s) =>
|
||||
acc.concat(
|
||||
s.courses.map(c => ({
|
||||
season_id: K.ITEM('s32', s.id),
|
||||
season_name: K.ITEM('str', s.name),
|
||||
season_new_flg: K.ITEM('bool', s.isNew),
|
||||
course_type: K.ITEM('s16', 0),
|
||||
course_id: K.ITEM('s16', c.id),
|
||||
course_name: K.ITEM('str', c.name),
|
||||
skill_level: K.ITEM('s16', c.level),
|
||||
skill_name_id: K.ITEM('s16', c.nameID),
|
||||
matching_assist: K.ITEM('bool', c.assist),
|
||||
clear_rate: K.ITEM('s32', 5000),
|
||||
avg_score: K.ITEM('u32', 15000000),
|
||||
track: c.tracks.map(t => ({
|
||||
track_no: K.ITEM('s16', t.no),
|
||||
music_id: K.ITEM('s32', t.mid),
|
||||
music_type: K.ITEM('s8', t.mty),
|
||||
})),
|
||||
}))
|
||||
),
|
||||
[]
|
||||
),
|
||||
},
|
||||
},
|
||||
{ encoding: 'utf8' }
|
||||
);
|
||||
},
|
||||
extend: {
|
||||
info: extend.map(e => ({
|
||||
extend_id: K.ITEM('u32', e.id),
|
||||
extend_type: K.ITEM('u32', e.type),
|
||||
param_num_1: K.ITEM('s32', e.params[0]),
|
||||
param_num_2: K.ITEM('s32', e.params[1]),
|
||||
param_num_3: K.ITEM('s32', e.params[2]),
|
||||
param_num_4: K.ITEM('s32', e.params[3]),
|
||||
param_num_5: K.ITEM('s32', e.params[4]),
|
||||
param_str_1: K.ITEM('str', e.params[5]),
|
||||
param_str_2: K.ITEM('str', e.params[6]),
|
||||
param_str_3: K.ITEM('str', e.params[7]),
|
||||
param_str_4: K.ITEM('str', e.params[8]),
|
||||
param_str_5: K.ITEM('str', e.params[9]),
|
||||
})),
|
||||
},
|
||||
music_limited: { info: songs },
|
||||
skill_course: {
|
||||
info: courses.reduce(
|
||||
(acc, s) =>
|
||||
acc.concat(
|
||||
s.courses.map(c => ({
|
||||
season_id: K.ITEM('s32', s.id),
|
||||
season_name: K.ITEM('str', s.name),
|
||||
season_new_flg: K.ITEM('bool', s.isNew),
|
||||
course_type: K.ITEM('s16', 0),
|
||||
course_id: K.ITEM('s16', c.id),
|
||||
course_name: K.ITEM('str', c.name),
|
||||
skill_level: K.ITEM('s16', c.level),
|
||||
skill_name_id: K.ITEM('s16', c.nameID),
|
||||
matching_assist: K.ITEM('bool', c.assist),
|
||||
clear_rate: K.ITEM('s32', 5000),
|
||||
avg_score: K.ITEM('u32', 15000000),
|
||||
track: c.tracks.map(t => ({
|
||||
track_no: K.ITEM('s16', t.no),
|
||||
music_id: K.ITEM('s32', t.mid),
|
||||
music_type: K.ITEM('s8', t.mty),
|
||||
})),
|
||||
}))
|
||||
),
|
||||
[]
|
||||
),
|
||||
},
|
||||
},
|
||||
{ encoding: 'utf8' }
|
||||
);
|
||||
function(error) {
|
||||
writeLog('read error: ' + error)
|
||||
}
|
||||
);
|
||||
} catch (error) {
|
||||
writeLog(error)
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export const log: EPR = async (info, data, send) => {
|
||||
send.success();
|
||||
send.success();
|
||||
}
|
||||
|
||||
export const unhandledt: EPR = async (info, data, send) => {
|
||||
writeLog("Unhandled: " + info.method + " | " + info.model + " | " + info.module)
|
||||
writeLog("Info:")
|
||||
for (let key in info) {
|
||||
type ObjectKey = keyof typeof info;
|
||||
const myVar = key as ObjectKey;
|
||||
if (typeof info[key] === 'object') {
|
||||
writeLog(key + ' - ' + JSON.stringify(info[key]));
|
||||
} else writeLog(key + ' - ' + info[key]);
|
||||
}
|
||||
writeLog("")
|
||||
writeLog("Data:")
|
||||
for (let key in data) {
|
||||
type ObjectKey = keyof typeof data;
|
||||
const myVar = key as ObjectKey;
|
||||
if (typeof data[key] === 'object') {
|
||||
writeLog(key + ' - ' + JSON.stringify(data[key]));
|
||||
} else writeLog(key + ' - ' + data[key]);
|
||||
}
|
||||
writeLog("")
|
||||
writeLog("Send:")
|
||||
for (let key in send) {
|
||||
type ObjectKey = keyof typeof send;
|
||||
const myVar = key as ObjectKey;
|
||||
if (typeof send[key] === 'object') {
|
||||
writeLog(key + ' - ' + JSON.stringify(send[key]));
|
||||
} else writeLog(key + ' - ' + send[key]);
|
||||
}
|
||||
writeLog('')
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import { Skill } from '../models/skill';
|
||||
import { SDVX_AUTOMATION_SONGS } from '../data/vvw';
|
||||
import { Item } from '../models/item';
|
||||
import { Param } from '../models/param';
|
||||
import { Arena } from '../models/arena';
|
||||
import { MusicRecord } from '../models/music_record';
|
||||
import { CourseRecord } from '../models/course_record';
|
||||
import { Profile } from '../models/profile';
|
||||
@@ -33,7 +34,7 @@ function unlockAppealCards(items: Partial<Item>[]) {
|
||||
export const loadScore: EPR = async (info, data, send) => {
|
||||
console.log("Now loading score");
|
||||
const version = Math.abs(getVersion(info));
|
||||
console.log("Got version:" + version);
|
||||
console.log("Got version: " + version);
|
||||
let refid = $(data).str('refid', $(data).attr().dataid);
|
||||
if (version === 2) refid = $(data).str('dataid', '0');
|
||||
//console.log('loading score');
|
||||
@@ -365,6 +366,7 @@ export const saveCourse: EPR = async (info, data, send) => {
|
||||
};
|
||||
|
||||
export const save: EPR = async (info, data, send) => {
|
||||
console.log($(data))
|
||||
const refid = $(data).str('refid', $(data).attr().refid);
|
||||
if (!refid) return send.deny();
|
||||
|
||||
@@ -404,6 +406,9 @@ export const save: EPR = async (info, data, send) => {
|
||||
|
||||
// Save Profile
|
||||
if (version === 6) {
|
||||
console.log(JSON.stringify($(data)))
|
||||
console.log("packet: " + $(data).number('earned_gamecoin_packet'))
|
||||
console.log("block: " + $(data).number('earned_gamecoin_block'))
|
||||
await DB.Update<Profile>(
|
||||
refid,
|
||||
{ collection: 'profile' },
|
||||
@@ -433,6 +438,15 @@ export const save: EPR = async (info, data, send) => {
|
||||
blocks: $(data).number('earned_gamecoin_block'),
|
||||
blasterEnergy: $(data).number('earned_blaster_energy'),
|
||||
extrackEnergy: $(data).number('earned_extrack_energy'),
|
||||
playCount: 1,
|
||||
dayCount: 1,
|
||||
todayCount: 1,
|
||||
playChain: 1,
|
||||
maxPlayChain: 1,
|
||||
weekCount: 1,
|
||||
weekPlayCount: 1,
|
||||
weekChain: 1,
|
||||
maxWeekChain: 1
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -466,6 +480,15 @@ export const save: EPR = async (info, data, send) => {
|
||||
packets: $(data).number('earned_gamecoin_packet'),
|
||||
blocks: $(data).number('earned_gamecoin_block'),
|
||||
blasterEnergy: $(data).number('earned_blaster_energy'),
|
||||
playCount: 1,
|
||||
dayCount: 1,
|
||||
todayCount: 1,
|
||||
playChain: 1,
|
||||
maxPlayChain: 1,
|
||||
weekCount: 1,
|
||||
weekPlayCount: 1,
|
||||
weekChain: 1,
|
||||
maxWeekChain: 1
|
||||
},
|
||||
}
|
||||
);
|
||||
@@ -545,6 +568,35 @@ export const save: EPR = async (info, data, send) => {
|
||||
}
|
||||
);
|
||||
|
||||
// Save Arena Data
|
||||
const arena_data = $(data).elements('arena');
|
||||
for (const are of arena_data) {
|
||||
const earnedUR = are.number('earned_ultimate_rate');
|
||||
const earnedSP = are.number('earned_shop_point');
|
||||
const earnedRP = are.number('earned_rank_point');
|
||||
const earnedLE = are.number('earned_live_energy');
|
||||
const rankPlay = are.str('rank_play') == 'true' ? 1 : 0;
|
||||
const ultimatePlay = are.str('ultimate_play') == 'true' ? 1 : 0;
|
||||
await DB.Upsert<Arena>(
|
||||
refid,
|
||||
{
|
||||
collection: 'arena'
|
||||
},
|
||||
{
|
||||
$inc: {
|
||||
ultimateRate: _.isNil(earnedUR) ? 0 : earnedUR,
|
||||
shopPoint: _.isNil(earnedSP) ? 0 : earnedSP,
|
||||
rankPoint: _.isNil(earnedRP) ? 0 : earnedRP,
|
||||
liveEnergy: _.isNil(earnedLE) ? 0 : earnedLE,
|
||||
rankCount: rankPlay,
|
||||
ultimateCount: ultimatePlay
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
console.log(earnedSP)
|
||||
}
|
||||
|
||||
return send.success();
|
||||
};
|
||||
|
||||
@@ -554,8 +606,8 @@ export const load: EPR = async (info, data, send) => {
|
||||
if (!refid) return send.deny();
|
||||
|
||||
const version = Math.abs(getVersion(info));
|
||||
console.log("Got version" + version);
|
||||
console.log("DataID" + refid);
|
||||
console.log("Got version: " + version);
|
||||
console.log("DataID: " + refid);
|
||||
if (version == 0) return send.deny();
|
||||
|
||||
const profile = await DB.FindOne<Profile>(refid, {
|
||||
@@ -575,6 +627,7 @@ export const load: EPR = async (info, data, send) => {
|
||||
const courses = await DB.Find<CourseRecord>(refid, { collection: 'course', version });
|
||||
const items = await DB.Find<Item>(refid, { collection: 'item' });
|
||||
const params = await DB.Find<Param>(refid, { collection: 'param' });
|
||||
const arena = await DB.FindOne<Arena>(refid, { collection: 'arena' });
|
||||
let time = new Date();
|
||||
let tempHour = time.getHours();
|
||||
let tempDate = time.getDate();
|
||||
@@ -614,7 +667,7 @@ export const load: EPR = async (info, data, send) => {
|
||||
|
||||
const customize = [];
|
||||
customize.push(bgm, subbg, nemsys, stampA, stampB, stampC, stampD);
|
||||
|
||||
console.log("ARENA POINTS: " + arena['shopPoint'])
|
||||
|
||||
var tempCustom = params.findIndex((e) => (e.type == 2 && e.id == 2))
|
||||
|
||||
@@ -650,6 +703,7 @@ export const load: EPR = async (info, data, send) => {
|
||||
blasterpass,
|
||||
automation: version == 5 ? SDVX_AUTOMATION_SONGS : [],
|
||||
code: IDToCode(profile.id),
|
||||
arena,
|
||||
...profile,
|
||||
});
|
||||
};
|
||||
@@ -702,7 +756,9 @@ export const create: EPR = async (info, data, send) => {
|
||||
sortType: 0,
|
||||
expPoint: 0,
|
||||
mUserCnt: 0,
|
||||
boothFrame: [0, 0, 0, 0, 0]
|
||||
boothFrame: [0, 0, 0, 0, 0],
|
||||
|
||||
playCount: 0
|
||||
};
|
||||
|
||||
await DB.Upsert(refid, { collection: 'profile' }, profile);
|
||||
@@ -710,6 +766,7 @@ export const create: EPR = async (info, data, send) => {
|
||||
};
|
||||
|
||||
export const buy: EPR = async (info, data, send) => {
|
||||
console.log("buying")
|
||||
const refid = $(data).str('refid');
|
||||
if (!refid) return send.deny();
|
||||
|
||||
@@ -777,3 +834,24 @@ export const print: EPR = async (info, data, send) => {
|
||||
}))
|
||||
}), { status: "0" };
|
||||
}
|
||||
|
||||
export const saveValgene: EPR = async (info, data, send) => {
|
||||
console.log("Saving Valkyrie Generator Item")
|
||||
const refid = $(data).str('refid');
|
||||
const items = $(data).elements('item.info');
|
||||
|
||||
for (const i of items) {
|
||||
const type = i.number('type');
|
||||
const id = i.number('id');
|
||||
const param = i.number('param');
|
||||
|
||||
if (_.isNil(type) || _.isNil(id) || _.isNil(param)) continue;
|
||||
|
||||
await DB.Upsert<Item>(
|
||||
refid,
|
||||
{ collection: 'item', type, id },
|
||||
{ $set: { param } }
|
||||
);
|
||||
}
|
||||
return send.object({ result: K.ITEM('u8', 0) });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user