webui stuff

This commit is contained in:
vvo
2024-10-03 12:00:53 +08:00
parent d07f822f70
commit f6b0115fea
12 changed files with 20033 additions and 101 deletions
+19467
View File
File diff suppressed because it is too large Load Diff
+75
View File
@@ -0,0 +1,75 @@
let clearRank = ['AAA', 'AA+', 'AA', 'AA-', 'A+', 'A', 'A-', 'B+', 'B', 'B-', 'C+', 'C', 'C-', 'D+', 'D', 'E']
let clearKind = ['-', 'Fail', 'Assisted Clear', 'Clear', 'Life4 Clear (1)', 'Life4 Clear (2)', 'Life4 Clear', 'FC', 'GFC', 'PFC', 'MFC']
let flareRank = ['None', 'I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'IX', 'EX']
async function populateScoreTable(scores, style, info) {
let scoreTableData = []
let scoreIndex = 0
let mdbData = []
await emit('getMDB', {}).then(
function(response) {
mdbData = response.data.mdb
}
)
scores.forEach(score => {
let scoreIndex = scoreTableData.findIndex(scoreData => scoreData.songId === score.songId)
if(scoreIndex < 0 && style === score.style && score.songId !== 38707) {
let m = mdbData.find(m => m.mcode === score.songId)
scoreTableData.push({
'songId': score.songId,
'songTitle': m.title,
'0': '-',
'1': '-',
'2': '-',
'3': '-',
'4': '-'
})
}
scoreIndex = scoreTableData.findIndex(scoreData => scoreData.songId === score.songId && style === score.style)
if(scoreIndex > -1) {
if(info === 0) scoreTableData[scoreIndex][score.difficulty] = score.score
if(info === 1) scoreTableData[scoreIndex][score.difficulty] = clearRank[score.rank]
if(info === 2) scoreTableData[scoreIndex][score.difficulty] = clearKind[score.clearKind]
if(info === 3) scoreTableData[scoreIndex][score.difficulty] = (score.flareForce > -1) ? flareRank[score.flareForce] : '-'
}
})
$('#musicdata').DataTable().clear().destroy()
$('#musicdata').DataTable({
data: scoreTableData,
columns: [
{ data: 'songTitle' },
{ data: '0' },
{ data: '1' },
{ data: '2' },
{ data: '3' },
{ data: '4' }
],
pageLength: 100,
columnDefs: [
{
targets: 0,
width: "1px"
}
],
responsive: {
details: {
display: $.fn.dataTable.Responsive.display.modal({
header: function(row) {
var data = row.data();
return 'Scores for song: ' + data.songId;
}
})
}
}
});
}
$(document).ready(async function() {
let scores = JSON.parse(document.getElementById("score-pass").innerText)
populateScoreTable(scores, parseInt($('#style_select').val()), parseInt($('#info_select').val()))
$('#style_select,#info_select').change(async function() {
await populateScoreTable(scores, parseInt($('#style_select').val()), parseInt($('#info_select').val()));
})
})
+182
View File
@@ -0,0 +1,182 @@
let flareMatrix = {
"1": [145, 153, 162, 171, 179, 188, 197, 205, 214, 223, 232],
"2": [155, 164, 182, 192, 201, 210, 220, 220, 229, 238, 248],
"3": [170, 180, 190, 200, 210, 221, 231, 241, 251, 261, 272],
"4": [185, 196, 207, 218, 229, 240, 251, 262, 273, 284, 296],
"5": [205, 217, 229, 241, 254, 266, 278, 291, 303, 315, 328],
"6": [230, 243, 257, 271, 285, 299, 312, 326, 340, 354, 368],
"7": [255, 270, 285, 300, 316, 331, 346, 362, 377, 392, 408],
"8": [290, 307, 324, 342, 359, 377, 394, 411, 429, 446, 464],
"9": [335, 355, 375, 395, 415, 435, 455, 475, 495, 515, 536],
"10": [400, 424, 448, 472, 496, 520, 544, 568, 592, 616, 640],
"11": [465, 492, 520, 548, 576, 604, 632, 660, 688, 716, 744],
"12": [510, 540, 571, 601, 632, 663, 693, 724, 754, 785, 816],
"13": [545, 577, 610, 643, 675, 708, 741, 773, 806, 839, 872],
"14": [575, 609, 644, 678, 713, 747, 782, 816, 851, 885, 920],
"15": [600, 636, 672, 708, 744, 780, 816, 852, 888, 924, 960],
"16": [620, 657, 694, 731, 768, 806, 843, 880, 917, 954, 992],
"17": [635, 673, 711, 749, 787, 825, 863, 901, 939, 977, 1016],
"18": [650, 689, 728, 767, 806, 845, 884, 923, 962, 1001, 1040],
"19": [665, 704, 744, 784, 824, 864, 904, 944, 984, 1024, 1064]
}
let flareSkill = [
["NONE", 0, 500, 1000, 1500],
["MERCURY", 2000, 3000, 4000, 5000],
["VENUS", 6000, 7000, 8000, 9000],
["EARTH", 10000, 11500, 13000, 14500],
["MARS", 16000, 18000, 20000, 22000],
["JUPITER", 24000, 26500, 29000, 31500],
["SATURN", 34000, 36750, 39500, 42250],
["URANUS", 45000, 48750, 52500, 56250],
["NEPTUNE", 60000, 63750, 67500, 71250],
["SUN", 75000, 78750, 82500, 86250],
["WORLD", 90000]
]
let area = ["Unknown", "Hokkaido", "Aomori", "Iwate", "Miyagi", "Akita", "Yamagata", "Fukushima", "Ibaraki", "Tochigi", "Gunma", "Saitama", "Chiba", "Tokyo", "Kanagawa", "Niigata", "Toyama", "Ishikawa", "Fukui", "Yamanashi",
"Nagano", "Gifu", "Shizuoka", "Aichi", "Mie", "Shiga", "Kyoto", "Osaka", "Hyogo", "Nara", "Wakayama", "Tottori", "Shimane", "Okayama", "Hiroshima", "Yamaguchi", "Tokushima", "Kagawa", "Ehime", "Kochi", "Fukuoka", "Saga",
"Nagasaki", "Kumamoto", "Oita", "Miyazaki", "Kagoshima", "Okinawa", "Hong Kong", "Korea", "Taiwan", "USA", "Europe", "Overseas", "Alaska", "Alabama", "Arkansas", "Arizona", "California", "Colorado", "Connecticut", "Delaware",
"Florida", "Georgia", "Hawaii", "Iowa", "Idaho", "Illinois", "Indiana", "Kansas", "Kentucky", "Louisiana", "Massachusetts", "Maryland", "Maine", "Michigan", "Minnesota", "Missouri", "Mississippi", "Montana", "Nebraska",
"North Carolina", "North Dakota", "New Hampshire", "New Jersey", "New Mexico", "Nevada", "New York", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
"Virginia", "Vermont", "Washington", "Wisconsin", "West Virginia", "Wyoming", "Washington D.C.", "Japan", "Canada", "Singapore", "Thailand", "Australia", "New Zealand", "UK", "Italy", "Spain", "Germany", "France", "Portugal", "Indonesia",
"Philippines"
]
$(document).ready(async function() {
// classic 1-13 white 14-17 gold 18-21
let profile = JSON.parse(document.getElementById("profile3-pass").innerText)
let scores = JSON.parse(document.getElementById("score-pass").innerText)
let mdbData = []
let flareTopScores = {'sg': [], 'db': []}
let totalSgFlare = 0
let totalDbFlare = 0
let classicSgTop30 = []
let classicSgFlare = 0
let classicDbTop30 = []
let classicDbFlare = 0
let whiteSgTop30 = []
let whiteSgFlare = 0
let whiteDbTop30 = []
let whiteDbFlare = 0
let goldSgTop30 = []
let goldSgFlare = 0
let goldDbTop30 = []
let goldDbFlare = 0
await emit('getMDB', {}).then(
function(response) {
mdbData = response.data.mdb
}
)
$("#area").append(
$("<td>").append(area[profile.area])
)
if(mdbData !== undefined) {
scores.forEach(score => {
let songIndex = mdbData.findIndex(m => m.mcode === score.songId)
if(songIndex > -1 && score.songId != 38707 && score.flareForce >= 0) {
if(score.style === 0) {
flareTopScores.sg.push({
flare: flareMatrix[mdbData[songIndex]['diffLv'][score.difficulty]][score.flareForce],
series: mdbData[songIndex]['series']
})
} else {
flareTopScores.db.push({
flare: flareMatrix[mdbData[songIndex]['diffLv'][score.difficulty]][score.flareForce],
series: mdbData[songIndex]['series']
})
}
}
})
classicSgTop30 = flareTopScores.sg.filter(ft => ft.series <= 13).sort((a, b) => b.flare - a.flare)
if(classicSgTop30.length > 30) classicSgTop30.slice(0, 30)
classicSgFlare = classicSgTop30.reduce((n, {flare}) => n + flare, 0)
whiteSgTop30 = flareTopScores.sg.filter(ft => ft.series >= 14 && ft.series <= 17).sort((a, b) => b.flare - a.flare)
if(whiteSgTop30.length > 30) whiteSgTop30.slice(0, 30)
whiteSgFlare = whiteSgTop30.reduce((n, {flare}) => n + flare, 0)
goldSgTop30 = flareTopScores.sg.filter(ft => ft.series >= 18).sort((a, b) => b.flare - a.flare)
if(goldSgTop30.length > 30) goldSgTop30.slice(0, 30)
goldSgFlare = goldSgTop30.reduce((n, {flare}) => n + flare, 0)
totalSgFlare = classicSgTop30.concat(whiteSgTop30, goldSgTop30).reduce((n, {flare}) => n + flare, 0)
classicDbTop30 = flareTopScores.db.filter(ft => ft.series <= 13).sort((a, b) => b.flare - a.flare)
if(classicDbTop30.length > 30) classicDbTop30.slice(0, 30)
classicDbFlare = classicDbTop30.reduce((n, {flare}) => n + flare, 0)
whiteDbTop30 = flareTopScores.db.filter(ft => ft.series >= 14 && ft.series <= 17).sort((a, b) => b.flare - a.flare)
if(whiteDbTop30.length > 30) whiteDbTop30.slice(0, 30)
whiteDbFlare = whiteDbTop30.reduce((n, {flare}) => n + flare, 0)
goldDbTop30 = flareTopScores.db.filter(ft => ft.series >= 18).sort((a, b) => b.flare - a.flare)
if(goldDbTop30.length > 30) goldDbTop30.slice(0, 30)
goldDbFlare = goldDbTop30.reduce((n, {flare}) => n + flare, 0)
totalDbFlare = classicDbTop30.concat(whiteDbTop30, goldDbTop30).reduce((n, {flare}) => n + flare, 0)
let skillGet = false
let sgSkill = ''
let dbSkill = ''
let skillPlus = '+++'
flareSkill.forEach(fs => {
if(!skillGet) {
for(let sctr = 1; sctr < fs.length; sctr++) {
if(totalSgFlare >= fs[sctr]) {
sgSkill = fs[0]
if(sctr > 1) sgSkill = sgSkill + skillPlus.substring(0, sctr - 1)
}
else skillGet = true
}
}
})
console.log(sgSkill + " (" + totalSgFlare + ")")
skillGet = false
flareSkill.forEach(fs => {
if(!skillGet) {
for(let sctr = 1; sctr < fs.length; sctr++) {
if(totalDbFlare >= fs[sctr]) {
dbSkill = fs[0]
if(sctr > 1) dbSkill = dbSkill + skillPlus.substring(0, sctr - 1)
}
else skillGet = true
}
}
})
console.log(dbSkill + " (" + totalDbFlare + ")")
$("#skillrank").append(
$("<td>").append(sgSkill)
).append(
$("<td>").append(dbSkill)
)
$("#skilltotal").append(
$("<td>").append(totalSgFlare)
).append(
$("<td>").append(totalDbFlare)
)
}
$("#skillclassic").append(
$("<td>").append(classicSgFlare + ' (' + classicSgTop30.length + ' / 30)')
).append(
$("<td>").append(classicDbFlare + ' (' + classicDbTop30.length + ' / 30)')
)
$("#skillwhite").append(
$("<td>").append(whiteSgFlare + ' (' + whiteSgTop30.length + ' / 30)')
).append(
$("<td>").append(whiteDbFlare + ' (' + whiteDbTop30.length + ' / 30)')
)
$("#skillgold").append(
$("<td>").append(goldSgFlare + ' (' + goldSgTop30.length + ' / 30)')
).append(
$("<td>").append(goldDbFlare + ' (' + goldDbTop30.length + ' / 30)')
)
})
+21 -15
View File
@@ -12,21 +12,6 @@ $('#change-weight').on('click', () => {
emit('updateWeight', { refid, weight }).then(() => location.reload());
});
$('#change-name3').on('click', () => {
const name = $('#name3').val().toUpperCase();
emit('updateName3', { refid, name }).then(() => location.reload());
});
$('#change-weight3').on('click', () => {
const weight1 = $('#weight31').val();
const weight2 = $('#weight32').val();
const weight = parseInt(weight1 + '.' + weight2);
emit('updateWeight3', { refid, weight }).then(() => location.reload());
});
$('#change-display-calories').on('click', () => {
const selected = $('#display_calories option:selected').val();
@@ -62,3 +47,24 @@ $('#change-display-timing').on('click', () => {
emit('updateDisplayTiming', { refid, selected }).then(() => location.reload());
});
$('#change-name3').on('click', () => {
const name = $('#name3').val().toUpperCase();
emit('updateName3', { refid, name }).then(() => location.reload());
});
$('#change-weight3').on('click', () => {
const weight1 = $('#weight31').val();
const weight2 = $('#weight32').val();
const weight = parseInt(weight1 + '.' + weight2);
emit('updateWeight3', { refid, weight }).then(() => location.reload());
});
$('#change-display-calories3').on('click', () => {
const selected = parseInt($('#display_calories3 option:selected').val()) !== 0
emit('updateDisplayCalories3', { refid, selected }).then(() => location.reload());
});
+56
View File
@@ -0,0 +1,56 @@
//DATA//
profile: DB.FindOne(refid, { collection: "profile" })
profile3: DB.FindOne(refid, { collection: "profile3" })
score3: DB.Find(refid, { collection: "score3" })
-
if profile3
div
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-account
| Basic Info
.card-content
table.basic_data
tr
td Dancer Name
td #{profile3.dancerName}
tr
td DDR Code
td #{profile3.ddrCode}
tr(id="area")
td Area
tr
td Total Plays
td #{profile3.playCount}
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-fire
| Flare Skill
.card-content
table.flare_skill
th
th SINGLE
th DOUBLE
tr(id="skillrank")
td Rank
tr(id="skilltotal")
td Total
tr(id="skillclassic")
td CLASSIC
tr(id="skillwhite")
td WHITE
tr(id="skillgold")
td GOLD
div(hidden id='profile3-pass') !{JSON.stringify(profile3)}
div(hidden id='score-pass') !{JSON.stringify(score3)}
script(src="static/js/profile_details.js")
+60
View File
@@ -0,0 +1,60 @@
//DATA//
profile3: DB.FindOne(refid, { collection: "profile3" })
score3: DB.Find(refid, { collection: "score3" })
-
if profile3
div
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-filter
| Filter Results
.card-content
.score-filter
.field.is-horizontal.has-addons
.field-label.is-normal
label.label Chart Style
.field-body
.control
.select
select(id="style_select" value=0)
option(value=0) SINGLE
option(value=1) DOUBLE
.field.is-horizontal.has-addons
.field-label.is-normal
label.label Displayed Info
.field-body
.control
.select
select(id="info_select" value=0)
option(value=0) Score
option(value=1) Clear Rank
option(value=2) Clear Type
option(value=3) Flare Rank
.card
.card-header
p.card-header-title
span.icon
i.mdi.mdi-music
| Music Data
.card-content
.score-table
table.table(id="musicdata" style="width:100%")
thead
tr
th Song
th BEGINNER
th BASIC
th DIFFICULT
th EXPERT
th CHALLENGE
tbody
div(hidden id='score-pass') !{JSON.stringify(score3)}
script(src="static/js/musicdata.js")
script(src="static/js/datatables.js")
+19
View File
@@ -168,6 +168,8 @@ else if profile3
input.input(type="text", id="name3", pattern="[A-Z]{8}", maxlength=8, value=name3)
p.control
a.button.is-primary#change-name3 Change
.field.is-horizontal.has-addons
.field-label.is-normal
label.label Weight
.field-body
@@ -177,4 +179,21 @@ else if profile3
p.control
a.button.is-primary#change-weight3 Set
.field.is-horizontal.has-addons
.field-label.is-normal
label.label Calorie display in-game
.field-body
p.control
.select
select#display_calories3
if (profile3.isDispWeight)
option(value=0) Off
option(value=1, selected) On
else
option(value=0, selected) Off
option(value=1) On
p.control
a.button.is-primary#change-display-calories3 Change
script(src="static/js/profile_settings.js")