merge conflict fix

This commit is contained in:
vvo
2023-04-25 22:41:43 +08:00
9 changed files with 631 additions and 368 deletions
+62 -48
View File
@@ -1,8 +1,6 @@
let hiddenEvents = ['xrecord', 'bpl2021', 'bsb2021', 'sdvx10thstamp', 'reflecstamp', 'gmz2022', 'pcbevent', '2023appealstampevent', '11thannivappealstampevent']
function generateEventToggles(eventInfo, eventConfig) {
function generateEventToggles(eventInfo, eventConfig, eventEnabled) {
let cardContent = $('<div class="card-content">')
if(!['bpl2022', 'konasute'].includes(eventInfo['id'])) {
if(typeof eventInfo['info'] === 'string') {
cardContent.append(
$('<div class="field is-horizontal">').append(
$('<div class="field-label is-normal"><label class="label" for="' + eventInfo['id'] + '">Enable</label></div>')
@@ -24,13 +22,34 @@ function generateEventToggles(eventInfo, eventConfig) {
return cardContent
}
async function readEventsConfigFile() {
async function generateNewEventsConfigFile(eventData) {
let eventConfig = {}
for(const eventIter in eventData['events']) {
eventConfig[eventData['events'][eventIter]['id']] = await insertNewEventConfig(eventData, eventIter, eventData['events'][eventIter]['id'])
}
return eventConfig
}
async function insertNewEventConfig(eventData, eventIter, eventID) {
let toggle = false
if(typeof eventData['events'][eventIter]['info'] !== 'string') {
toggle = {}
for(const toggleIter in eventData['events'][eventIter]['info']) {
toggle[eventData['events'][eventIter]['id'] + '_' + (parseInt(toggleIter) + 1)] = false
}
}
return {
'toggle': toggle
}
}
async function readEventsConfigFile(eventData) {
try {
return await $.getJSON("static/asset/config/events.json", function(data) {
return data
})
} catch {
return await generateNewEventsConfigFile()
return await generateNewEventsConfigFile(eventData)
}
}
@@ -40,53 +59,30 @@ async function readEventsJsonFile() {
})
}
async function generateNewEventsConfigFile() {
let eventConfig = {}
let eventData = await readEventsJsonFile()
for(const eventIter in eventData['events']) {
let hidden = false
let toggle = false
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
}
}
if(hiddenEvents.includes(eventData['events'][eventIter]['id'])) {
hidden = true
}
eventConfig[eventData['events'][eventIter]['id']] = {
'hidden': hidden,
'toggle': toggle
}
}
return eventConfig
}
$(document).ready(async function() {
let eventData = await readEventsJsonFile()
let eventConfig = await readEventsConfigFile()
let eventConfig = await readEventsConfigFile(eventData)
for(const eventIter in eventData['events']) {
if(eventConfig[eventData['events'][eventIter]['id']] === undefined) {
eventConfig[eventData['events'][eventIter]['id']] = await insertNewEventConfig(eventData, eventIter, eventData['events'][eventIter]['id'])
}
// 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(eventData['events'][eventIter]['enabled']) {
if(eventData['events'][eventIter]['type'] === 'stamp') {
$('#stampevent_select').append(
'<option value=' + eventData['events'][eventIter]['id'] + '>' + eventData['events'][eventIter]['name'] + '</option>'
)
} else if(eventData['events'][eventIter]['type'] === 'gift') {
$('#giftevent_select').append(
'<option value=' + eventData['events'][eventIter]['id'] + '>' + eventData['events'][eventIter]['name'] + '</option>'
)
} else if(eventData['events'][eventIter]['type'] === 'cross_online') {
$('#crossevent_select').append(
'<option value=' + eventData['events'][eventIter]['id'] + '>' + eventData['events'][eventIter]['name'] + '</option>'
)
}
}
if(!eventConfig[eventData['events'][eventIter]['id']]['hidden']) {
$('div.main').append(
$('<header class="card-header"><p class="card-header-title"><span class="icon"><i class="mdi mdi-calendar-clock"></i></span>' + eventData['events'][eventIter]['name'] + '</p></header>')
).append(
generateEventToggles(eventData['events'][eventIter], eventConfig[eventData['events'][eventIter]['id']])
)
}
}
$('div.main').append(
$('<div class="field is-grouped"><div class="control is-expanded"></div><div class="control"><button class="button is-link" id="event-submit">Apply</button></div></div>')
)
$('#event-submit').on('click', async function() {
$.each($('span.check'), function(index, value) {
@@ -106,11 +102,29 @@ $(document).ready(async function() {
await emit("manageEvents", {eventConfig: eventConfig}).then(
function(response) {
alert('saved')
alert('Saved.')
},
function(error) {
console.log(error)
}
)
})
})
$('select').change(async function(event) {
let selectClass = '#' + $(this).attr('id')
let listClasses = {'#stampevent_select': 'stamp', '#giftevent_select': 'gift', '#crossevent_select': 'cross'}
$('.' + listClasses[selectClass] + '.list').empty()
for(const eventIter in eventData['events']) {
if(eventData['events'][eventIter]['id'] === $(selectClass).val()) {
$('.' + listClasses[selectClass] + '.list').append(
generateEventToggles(eventData['events'][eventIter], eventConfig[eventData['events'][eventIter]['id']], eventData['events'][eventIter]['enabled'])
)
$('div.main').append(
$('<div class="field is-grouped"><div class="control is-expanded"></div><div class="control"><button class="button is-link" id="event-submit">Apply</button></div></div>')
)
}
}
})
})
+37 -23
View File
@@ -2,13 +2,18 @@
"events": [
{
"id": "xrecord",
"in_game_event": false,
"type": "cross_online",
"enabled": 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.<br>Enable this option to activate this event.<br>(imho all cross events like this should be in a separate asphyxia plugin altogether)"
"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.<br>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.<br>Enable this option to have them automatically unlocked and saved to your account."
]
},
{
"id": "konasute",
"in_game_event": false,
"type": "gift",
"enabled": true,
"name": "グレイスからの挑戦状!! (GRACE kara no chousenjou!!)",
"info": [
"Enables unlock for the song 'ドゥサンコオデッセイ!!' by cosMo@暴走P upon logging in.<br>This song is originally unlocked by having played it first on the コナステ (Konasute) version of Sound Voltex.",
@@ -20,37 +25,43 @@
},
{
"id": "bpl2021",
"in_game_event": false,
"type": "cross_online",
"enabled": 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.<br>Enable this option to activate this event."
},
{
"id": "bsb2021",
"in_game_event": false,
"type": "cross_online",
"enabled": 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.<br>Enable this option to activate this event."
},
{
"id": "sdvx10thstamp",
"in_game_event": true,
"type": "stamp",
"enabled": true,
"name": "SOUND VOLTEX 10th Anniversary",
"info": "Stamp event to unlock 7 songs.<br>Enable this option to enable this stamp event in-game."
"info": "Stamp event to unlock 7 songs.<br>Toggle this on to enable this stamp event."
},
{
"id": "reflecstamp",
"in_game_event": true,
"type": "stamp",
"enabled": true,
"name": "REFLEC BEAT Song Stamp Event",
"info": "Stamp event to unlock 5 songs originally from the REFLEC BEAT game.<br>Enable this option to enable this stamp event in-game."
"info": "Stamp event to unlock 5 songs originally from the REFLEC BEAT game series.<br>Toggle this on to enable this stamp event."
},
{
"id": "gmz2022",
"in_game_event": false,
"type": "cross_online",
"enabled": 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.<br><br>Enable this option to activate this event."
},
{
"id": "bpl2022",
"in_game_event": false,
"type": "gift",
"enabled": true,
"name": "BEMANI PRO LEAGUE -SEASON 2-! Original Song",
"info": [
"Week 1 songs: 'Chat perché' and 'WINNING ROAD'<br>Enable this option to have these songs unlocked on the next login. Otherwise, the songs are still unlockable through BLASTER GATE.",
@@ -68,21 +79,24 @@
},
{
"id": "pcbevent",
"in_game_event": true,
"name": "PCB Stamp Event",
"info": "Stamp event to earn PCB.<br>Enable this option to activate this stamp event in-game."
"type": "stamp",
"enabled": false,
"name": "PCBおかわりスタンプイベント | PCB Refill Stamp Event",
"info": "Stamp event to earn PCB. Once the stamp goal is complete, it will start over and you can earn more PCB.<br>Toggle this on to enable this stamp event."
},
{
"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).<br>Enable this option to activate this stamp event in-game."
"id": "2023stamp",
"type": "stamp",
"enabled": true,
"name": "んだんだぺったん☆二〇二三 | New Year 2023 Stamp Event",
"info": "Stamp event to unlock the んだんだぺったん☆二〇二三 appeal card.<br>Toggle this on to enable this stamp event."
},
{
"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.<br>Enable this option to activate this stamp event in-game."
"id": "himehina",
"type": "stamp",
"enabled": true,
"name": "HIMEHINAコラボイベント | HIMEHINA Collab Stamp Event",
"info": "Stamp event to unlock the HIMEHINA crew.<br>Toggle this on to enable this stamp event."
}
]
}
}
@@ -1,5 +0,0 @@
-
link(rel="stylesheet" href="static/asset/css/datatables.css")
div.main
script(src="static/asset/js/events.js")
+48
View File
@@ -0,0 +1,48 @@
-
link(rel="stylesheet" href="static/asset/css/datatables.css")
div
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-star
| Stamp Events
.card-content
.field
.control
.select
select(name="stampevent_select" id="stampevent_select")
option(name="none" id="none") Select Stamp Event
.stamp.list
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-star
| Gift Events
.card-content
.field
.control
.select
select(name="giftevent_select" id="giftevent_select")
option(name="none" id="none") Select Gift Event
.gift.list
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-star
| Cross Events
.card-content
.field
.control
.select
select(name="crossevent_select" id="crossevent_select")
option(name="none" id="none") Select Cross Event
.cross.list
div.field.is-grouped
div.control.is-expanded
div.control
button.button.is-link(id="event-submit") Apply
script(src="static/asset/js/events.js")
@@ -1,65 +1,65 @@
div
.card
button.collapse() Notes
.card-info.collapsible-card
p.card-header-info
h5() Notes:
ul
li() For use with Exceed Gear arcade data.
li() Use this if you have arcade data that can be used. It wouldn't work otherwise.
li() Make sure you have your 'Exceed Gear Data Directory' in the plugin settings properly configured.
li() Update your datacode in the ea3-config.xml file.
br
p.card-header-bgm-guide
h5() BGM asset guide
p() This feature pulls BGM files from the data, however they are in unplayable s3p format. For BGM preview to work, we need to extract the audio files from the s3p, and convert it to mp3.
p() For Windows, there is a bgm_convert.bat script in the SDVX plugin root directory but it requires 2 things:
ul
li() <a href="https://github.com/mon/s3p_extract/releases/latest">s3p_extract</a> - download the .exe file from the latest release and put in the same directory as the bat script
li() <a href="https://www.gyan.dev/ffmpeg/builds/">ffmpeg</a> - download and extract ffmpeg.exe and put it in the same directory as the bat script (or put ffmpeg.exe in PATH environment variable)
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-account-edit
| Update WebUI Resources (pull from game files)
.card-content
.field
button.button.is-primary(type="update" id="updateResources")
span.icon
i.mdi.mdi-check
span Update
.field
textarea.log-field(rows="50" id="logtextarea" name="logtextarea" disabled)
script(src="https://requirejs.org/docs/release/2.3.5/minified/require.js")
script(type="text/javascript" src="static/asset/js/updateResources.js")
style(type='text/css').
.collapse {
background-color: #4a4a4a;
color: white;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 20px;
}
.collapse:hover {
background-color: #777;
}
.collapsible-card {
padding:15px;
}
.log-field {
width: 100%;
height: 100%;
background: #4a4a4a;
color: #ffffff;
border-radius: 6px;
padding: 5px;
font-size: 15px;
div
.card
button.collapse() Notes
.card-info.collapsible-card
p.card-header-info
h5() Notes:
ul
li() For use with Exceed Gear arcade data.
li() Use this if you have arcade data that can be used. It wouldn't work otherwise.
li() Make sure you have your 'Exceed Gear Data Directory' in the plugin settings properly configured.
li() Update your datacode in the ea3-config.xml file.
br
p.card-header-bgm-guide
h5() BGM asset guide
p() This feature pulls BGM files from the data, however they are in unplayable s3p format. For BGM preview to work, we need to extract the audio files from the s3p, and convert it to mp3.
p() For Windows, there is a bgm_convert.bat script in the SDVX plugin root directory but it requires 2 things:
ul
li() <a href="https://github.com/mon/s3p_extract/releases/latest">s3p_extract</a> - download the .exe file from the latest release and put in the same directory as the bat script
li() <a href="https://www.gyan.dev/ffmpeg/builds/">ffmpeg</a> - download and extract ffmpeg.exe and put it in the same directory as the bat script (or put ffmpeg.exe in PATH environment variable)
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-account-edit
| Update WebUI Assets (pull from game files)
.card-content
.field
button.button.is-primary(type="update" id="updateResources")
span.icon
i.mdi.mdi-check
span Update
.field
textarea.log-field(rows="50" id="logtextarea" name="logtextarea" disabled)
script(src="https://requirejs.org/docs/release/2.3.5/minified/require.js")
script(type="text/javascript" src="static/asset/js/updateResources.js")
style(type='text/css').
.collapse {
background-color: #4a4a4a;
color: white;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 20px;
}
.collapse:hover {
background-color: #777;
}
.collapsible-card {
padding:15px;
}
.log-field {
width: 100%;
height: 100%;
background: #4a4a4a;
color: #ffffff;
border-radius: 6px;
padding: 5px;
font-size: 15px;
}