added events page to unlock various limited time events

This commit is contained in:
vvo
2022-12-31 19:47:18 +08:00
parent 16f425d1e9
commit 577c6e30d9
6 changed files with 198 additions and 106 deletions
+113 -29
View File
@@ -47,6 +47,7 @@ export const INFORMATION6 = {
'2022081600': ['[img:ver06/info_psd.ifs:hexa_diver_220714]', '[img:ver06/info_psd.ifs:hexa_diver_220818]'],
'2022083000': ['[img:ver06/info_psd.ifs:hexa_diver_220714]', '[img:ver06/info_psd.ifs:hexa_diver_220818]', '[img:ver06/info_psd.ifs:paseli_present_220901]'],
'2022101800': ['[img:ver06/info_psd.ifs:hexa_diver_220714]', '[img:ver06/info_psd.ifs:hexa_diver_220818]', '[img:ver06/info_psd.ifs:paseli_present_220901]'],
'2022122001': ['[img:info/konosuba_221006.png]', '[img:info/bemaniautumn_221101.png]', '[img:info/paseli_festival_221220.png]', '[img:info/pregene_kureha_221222.png]', '[img:info/voltefactory_221201.png]']
}
export const MISSINGSONGS6 = [
@@ -60,36 +61,119 @@ export const MISSINGSONGS6 = [
'1903', '1904', '1911', '1916', '1917'
]
export const XRECORDSONGS = [
// 1st edition
'1736', // discordia_penorerihumer
'1737', // chewingood_toriena
'1738', // verflucht_tirfing
// 2nd edition
'1848', // fegrix
'1847', // 2 beasts unchained
'1849', // piano kyousoukyoku
]
export const EVENT_SONGS6 = {
// X-Record songs
'xrecord_1': [
// 1st edition
'1736', // discordia_penorerihumer
'1737', // chewingood_toriena
'1738', // verflucht_tirfing
],
'xrecord_2': [
// 2nd edition
'1848', // fegrix
'1847', // 2 beasts unchained
'1849', // piano kyousoukyoku
],
// Konaste songs
'konasute_1': [
'1762'
],
'konasute_2': [
'1763'
],
'konasute_3': [
'1764'
],
'konasute_4': [
'1765'
],
'konasute_5': [
'1811'
],
// BPL2021 songs
'bpl2021': [
'1808', '1809'
],
// BSB2021 songs
'bsb2021': [
'1802', '1803', '1804', '1805', '1806', '1807'
],
// SDVX 10th anniversary stamp event songs
'sdvx10thstamp': [
'1838', '1839', '1840', '1841', '1842', '1843', '1844'
],
// REFLECT BEAT stamp event songs
'reflecstamp': [
'1850', '1851', '1852', '1853', '1854'
],
// BEMANI ichika 2022 event songs
'gmz2022': [
'1906', '1907', '1908', '1909', '1910'
],
// BPL2022 songs
"bpl2022_1": [
'1952', '1943'
],
"bpl2022_2": [
'1948', '1951'
],
"bpl2022_3": [
'1956', '1949'
],
"bpl2022_4": [
'1946', '1958'
]
}
export const KONASTESONGS = [
'1762', '1763', '1764', '1765', '1811'
]
export const BEMANI2021EVENTSONGS = [
'1802', '1803', '1804', '1805', '1806', '1807'
]
export const BPLSTAMPRALLYSONGS = [
'1808', '1809'
]
export const SDVX10THSTAMPSONGS = [
'1838', '1839', '1840', '1841', '1842', '1843', '1844'
]
export const REFLECBEATSTAMPSONGS = [
'1850', '1851', '1852', '1853', '1854'
]
export const RESTRICTED_SONGS6 = {
// X-Record songs
'xrecord_1': [
// 1st edition
'1736', // discordia_penorerihumer
'1737', // chewingood_toriena
'1738', // verflucht_tirfing
],
'xrecord_2': [
// 2nd edition
'1848', // fegrix
'1847', // 2 beasts unchained
'1849', // piano kyousoukyoku
],
// BPL2021 songs
// 'bpl2021': [
// '1808', '1809'
// ],
// BSB2021 songs
'bsb2021': [
'1802', '1803', '1804', '1805', '1806', '1807'
],
// SDVX 10th anniversary stamp event songs
'sdvx10thstamp': [
'1838', '1839', '1840', '1841', '1842', '1843', '1844'
],
// REFLECT BEAT stamp event songs
'reflecstamp': [
'1850', '1851', '1852', '1853', '1854'
],
// BEMANI ichika 2022 event songs
'gmz2022': [
'1906', '1907', '1908', '1909', '1910'
],
// BPL2022 songs
"bpl2022_1": [
'1952', '1943'
],
"bpl2022_2": [
'1948', '1951'
],
"bpl2022_3": [
'1956', '1949'
],
"bpl2022_4": [
'1946', '1958'
]
}
export const APRILFOOLSSONGS = [
'840', '1219', '1751'
+12 -6
View File
@@ -1,9 +1,7 @@
import { EVENT4, COURSES4, EXTENDS4 } from '../data/hvn';
import { EVENT5, COURSES5, EXTENDS5 } from '../data/vvw';
import { EVENT6, COURSES6, EXTENDS6, APRILFOOLSSONGS, XRECORDSONGS,
KONASTESONGS, BEMANI2021EVENTSONGS, BPLSTAMPRALLYSONGS, SDVX10THSTAMPSONGS,
REFLECBEATSTAMPSONGS, VALKYRIEEXCLUSIVESONGS, MISSINGSONGS6, ARENA, VALGENE,
INFORMATION6
import { EVENT6, COURSES6, EXTENDS6, APRILFOOLSSONGS, VALKYRIEEXCLUSIVESONGS,
MISSINGSONGS6, ARENA, VALGENE, INFORMATION6, RESTRICTED_SONGS6, EVENT_SONGS6
} from '../data/exg';
import { COURSE2 } from '../data/inf';
import {getVersion, getRandomIntInclusive} from '../utils';
@@ -89,7 +87,15 @@ export const common: EPR = async (info, data, send) => {
}
}
} else {
let RESTRICT_SONGS = KONASTESONGS.concat(BEMANI2021EVENTSONGS, BPLSTAMPRALLYSONGS, SDVX10THSTAMPSONGS, REFLECBEATSTAMPSONGS);
let RESTRICT_SONGS = [] //KONASTESONGS.concat(BEMANI2021EVENTSONGS, BPLSTAMPRALLYSONGS, SDVX10THSTAMPSONGS, REFLECBEATSTAMPSONGS);
let EVENT_SONGS = []
for(const keyIter in Object.keys(RESTRICTED_SONGS6)) {
RESTRICT_SONGS = RESTRICT_SONGS.concat(RESTRICTED_SONGS6[Object.keys(RESTRICTED_SONGS6)[keyIter]])
}
for(const keyIter in Object.keys(EVENT_SONGS6)) {
EVENT_SONGS = EVENT_SONGS.concat(EVENT_SONGS6[Object.keys(EVENT_SONGS6)[keyIter]])
}
let mdb = JSON.parse(music_db);
let limitedNo = 2;
@@ -98,7 +104,7 @@ export const common: EPR = async (info, data, send) => {
if(foundSongIndex != -1) {
var songData = mdb.mdb.music[foundSongIndex];
if(gameVersion === 6 || gameVersion === -6) {
if(!RESTRICT_SONGS.includes(i.toString()) && parseInt(songData['info']['distribution_date']['#text']) <= currentYMDDate) {
if((!RESTRICT_SONGS.includes(i.toString()) || EVENT_SONGS.includes(i.toString())) && parseInt(songData['info']['distribution_date']['#text']) <= currentYMDDate) {
limitedNo = 2;
if(songData.info.version['#text'] === '6') { // if song is released during exceed gear
if(MISSINGSONGS6.includes(i.toString())) {
+57 -70
View File
@@ -3,13 +3,12 @@ import { SDVX_AUTOMATION_SONGS } from '../data/vvw';
import { Item } from '../models/item';
import { Param } from '../models/param';
import { Arena } from '../models/arena';
import { XRecord } from '../models/xrecord';
import { MusicRecord } from '../models/music_record';
import { CourseRecord } from '../models/course_record';
import { Profile } from '../models/profile';
import { getVersion, IDToCode } from '../utils';
import { Mix } from '../models/mix';
import { ARENA } from '../data/exg';
import { ARENA, EVENT_SONGS6, RESTRICTED_SONGS6 } from '../data/exg';
async function getAutomationMixes(params: Param[]) {
const mixids = params
@@ -615,35 +614,6 @@ export const save: EPR = async (info, data, send) => {
);
}
// Add X-Record points
if(U.GetConfig('x_record')) {
let addLM = 1
let addVM = 10
let xrData = await DB.FindOne(refid, {collection: 'x-record'})
if (xrData != null) {
if(xrData['lm'] + 1 > 200) {
addLM = 0
console.log('LM Points Capped')
}
if(xrData['vm'] + 10 > 200) {
addVM = 10 - ((xrData['vm'] + 10) - 200)
console.log('VM Points Capped')
}
}
await DB.Upsert<XRecord>(
refid,
{
collection: 'x-record'
},
{
$inc: {
lm: addLM,
vm: addVM
}
}
);
}
return send.success();
};
@@ -675,7 +645,6 @@ export const load: EPR = async (info, data, send) => {
const courses = await DB.Find<CourseRecord>(refid, { collection: 'course', version });
const params = await DB.Find<Param>(refid, { collection: 'param' });
const arena = await DB.FindOne<Arena>(refid, { collection: 'arena', season: Object.keys(ARENA).findIndex(data => data == U.GetConfig('arena_szn')) + 1 });
const xrecord = await DB.FindOne<XRecord>(refid, { collection: 'x-record' });
let time = new Date();
let tempHour = time.getHours();
let tempDate = time.getDate();
@@ -734,53 +703,71 @@ export const load: EPR = async (info, data, send) => {
var tempItem = U.GetConfig('unlock_all_navigators') ? unlockNavigators(items) : items;
tempItem = U.GetConfig('unlock_all_appeal_cards') ? unlockAppealCards(items) : items;
tempItem = removeStampItems(tempItem)
let eventData = JSON.parse(await IO.ReadFile('webui/asset/json/events.json'))
let eventConfig = JSON.parse(await IO.ReadFile('webui/asset/config/events.json'))
let presents = []
for(const eventIter in eventData['events']) {
if(!eventData['events'][eventIter]['in_game_event']) {
if(typeof eventConfig[eventData['events'][eventIter]['id']]['toggle'] === "boolean") {
if(eventConfig[eventData['events'][eventIter]['id']]['toggle']) {
for(const itemIter in EVENT_SONGS6[eventData['events'][eventIter]['id']]) {
let itemId = parseInt(EVENT_SONGS6[eventData['events'][eventIter]['id']][itemIter])
if(await DB.Count(refid, {collection:'item', id: itemId}) === 0) {
await DB.Upsert(
refid,
{collection: 'item', type: 0, id: itemId},
{$set: { param: 23 }}
)
presents.push({
id: itemId,
type: 0,
param: 23
})
tempItem.push({ collection: 'item', type: 0, id: itemId, param: 23 })
}
}
}
} else{
// eventConfig[eventData['events'][eventIter]['id']]['toggle']
for(const toggleKeys in Object.keys(eventConfig[eventData['events'][eventIter]['id']]['toggle'])) {
if(eventConfig[eventData['events'][eventIter]['id']]['toggle'][Object.keys(eventConfig[eventData['events'][eventIter]['id']]['toggle'])[toggleKeys]]) {
for(const itemIter in EVENT_SONGS6[Object.keys(eventConfig[eventData['events'][eventIter]['id']]['toggle'])[toggleKeys]]) {
let itemId = parseInt(EVENT_SONGS6[Object.keys(eventConfig[eventData['events'][eventIter]['id']]['toggle'])[toggleKeys]][itemIter])
if(await DB.Count(refid, {collection:'item', id: itemId}) === 0) {
await DB.Upsert(
refid,
{collection: 'item', type: 0, id: itemId},
{$set: { param: 23 }}
)
presents.push({
id: itemId,
type: 0,
param: 23
})
tempItem.push({ collection: 'item', type: 0, id: itemId, param: 23 })
}
}
}
}
}
}
}
// Make generator power always 100%,
for (let i = 0; i < 50; i++) {
const tempGene: Item = { collection: 'item', type: 7, id: i, param: 10 };
tempItem.push(tempGene);
}
// Check X-record data and unlock songs based on points
if(U.GetConfig('x_record') && (info.model.split(":")[2].match(/^(G|H)$/g) != null || U.GetConfig('enable_valk_songs'))) {
// '1736', // discordia_penorerihumer - 150
// '1737', // chewingood_toriena - 0
// '1738', // verflucht_tirfing - 50
// '1847', // 2 beasts unchained - 200
// '1848', // fegrix - 0
// '1849', // piano kyousoukyoku -100
let unlockedXRecordSongs = [1737, 1848]
if(xrecord != null) {
if(xrecord.lm >= 50) {
unlockedXRecordSongs.push(1738)
}
if(xrecord.lm >= 100) {
unlockedXRecordSongs.push(1849)
}
if(xrecord.lm >= 150) {
unlockedXRecordSongs.push(1736)
}
if(xrecord.lm >= 200) {
unlockedXRecordSongs.push(1847)
}
}
unlockedXRecordSongs.forEach(song => {
console.log("Unlocking xrecord song: " + song)
tempItem.push({
id: song,
type: 0,
param: 23,
});
})
}
return send.pugFile('templates/load.pug', {
courses,
items: tempItem,
present: presents,
params,
skill,
currentTime,
+6
View File
@@ -523,3 +523,9 @@ export const preGeneRoll = async (data: {
}
} else console.log('pregeneset none')
}
export const manageEvents = async (data: {
eventConfig: {}
}) => {
IO.WriteFile('webui/asset/config/events.json', JSON.stringify(data.eventConfig, null, 4));
}
+3 -1
View File
@@ -6,7 +6,8 @@ import {
importMix,
deleteMix,
copyResourcesFromGame,
preGeneRoll
preGeneRoll,
manageEvents
} from './handlers/webui';
import {
load,
@@ -45,6 +46,7 @@ export function register() {
R.WebUIEvent('copyResourcesFromGame', copyResourcesFromGame);
R.WebUIEvent('preGeneRoll', preGeneRoll);
R.WebUIEvent('manageEvents', manageEvents);
R.WebUIEvent('updateProfile', updateProfile);
R.WebUIEvent('updateMix', updateMix);
R.WebUIEvent('importMix', importMix);
+7
View File
@@ -72,6 +72,13 @@ game
id(__type="u32") #{song}
param(__type="u32") 1
present
each item in present
info
type(__type="u8") #{item.type}
id(__type="u32") #{item.id}
param(__type="u32") #{item.param}
param
each param in params
info