Add moire formatting to scores.

This commit is contained in:
Trenton Zimmer
2024-07-24 19:04:44 -04:00
parent 1c1612429c
commit f601c0edbe
3 changed files with 428 additions and 51 deletions

View File

@@ -329,9 +329,32 @@ export const gameData = [
cardBG: null,
noRivals: true,
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Combos", value: "data.combo" },
{ text: "Medal", value: "data.medal" },
],
chartTable: {
0: "LIGHT",
1: "MEDIUM",
2: "BEAST",
3: "NIGHTMARE",
},
medalTable: {
0: "",
1: "FAILED",
2: "SAVED",
3: "CLEAR",
4: "FULL COMBO",
5: "PERFECT",
},
rankTable: {
0: "PERFECT AAA",
1: "AAA",
2: "AA",
3: "A",
4: "B",
5: "C",
6: "D",
},
versions: [
{
id: VersionConstants.BEATSTREAM,
@@ -384,9 +407,30 @@ export const gameData = [
cardBG: null,
noRivals: true,
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Combos", value: "data.combo" },
{ text: "Halo", value: "halo" },
],
chartTable: {
0: "1A",
1: "2A",
2: "1B",
3: "2B",
},
medalTable: {
0: "",
1: "FAILED",
2: "SAVED",
3: "CLEAR",
4: "FULL COMBO",
5: "PERFECT",
},
rankTable: {
0: "⭐",
1: "⭐⭐",
2: "⭐⭐⭐",
3: "⭐⭐⭐⭐",
4: "⭐⭐⭐⭐⭐",
},
versions: [
{
id: VersionConstants.DANCE_RUSH_STARDOM,
@@ -401,10 +445,50 @@ export const gameData = [
icon: null,
cardBG: null,
scoreHeaders: [
{ text: "EX Score", value: "exscore" },
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Combos", value: "data.combo" },
{ text: "Halo", value: "data.halo" },
],
chartTable: {
0: "SP BEGINNER",
1: "SP BASIC",
2: "SP DIFFICULT",
3: "SP EXPERT",
4: "SP CHALLENGE",
5: "DP BEGINNER",
6: "DP BASIC",
7: "DP DIFFICULT",
8: "DP EXPERT",
9: "DP CHALLENGE",
},
haloTable: {
100: "",
1000: "FAILED",
2000: "CLEARED",
600: "",
4000: "LIFE4 CLEARED",
200: "FULL COMBO",
300: "GREAT FULL COMBO",
400: "PERFECT FULL COMBO",
500: "MARVELOUS FULL COMBO",
},
rankTable: {
100: "E",
200: "D",
233: "D+",
266: "C-",
300: "C",
333: "C+",
366: "B-",
400: "B",
433: "B+",
466: "A-",
500: "A",
533: "A+",
566: "AA-",
600: "AA",
650: "AA+",
700: "AAA",
},
versions: [
{
id: VersionConstants.DDR_1ST_MIX,
@@ -541,10 +625,50 @@ export const gameData = [
icon: "/assets/icon/ddr.webp",
cardBG: "/assets/card/ddr.webp",
scoreHeaders: [
{ text: "EX Score", value: "exscore" },
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Combos", value: "data.combo" },
{ text: "Halo", value: "data.halo" },
],
chartTable: {
0: "SP BEGINNER",
1: "SP BASIC",
2: "SP DIFFICULT",
3: "SP EXPERT",
4: "SP CHALLENGE",
5: "DP BEGINNER",
6: "DP BASIC",
7: "DP DIFFICULT",
8: "DP EXPERT",
9: "DP CHALLENGE",
},
haloTable: {
100: "",
1000: "FAILED",
2000: "CLEARED",
600: "",
4000: "LIFE4 CLEARED",
200: "FULL COMBO",
300: "GREAT FULL COMBO",
400: "PERFECT FULL COMBO",
500: "MARVELOUS FULL COMBO",
},
rankTable: {
100: "E",
200: "D",
233: "D+",
266: "C-",
300: "C",
333: "C+",
366: "B-",
400: "B",
433: "B+",
466: "A-",
500: "A",
533: "A+",
566: "AA-",
600: "AA",
650: "AA+",
700: "AAA",
},
versions: [
{
id: VersionConstants.DDR_1ST_MIX,
@@ -640,11 +764,27 @@ export const gameData = [
},
],
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Skill %", value: "skill.perc" },
{ text: "Skill Point", value: "skill.point" },
{ text: "Combos", value: "data.combo" },
{ text: "Medal", value: "medal", width: 140 },
{ text: "SKILL %", value: "data.skill_perc", width: 90 },
{ text: "SKILL POINT", value: "data.skill_points", width: 140 },
],
chartTable: {
0: "BEGINNER",
1: "BASIC",
2: "ADVANCED",
3: "EXTREME",
},
rankTable: {
7: "NO PLAY",
6: "D",
5: "C",
4: "B",
3: "A",
2: "AA",
1: "AAA",
0: "S",
},
versions: [
{
id: VersionConstants.DRUMMANIA_1ST,
@@ -774,11 +914,27 @@ export const gameData = [
},
],
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Skill %", value: "skill.perc" },
{ text: "Skill Point", value: "skill.point" },
{ text: "Combos", value: "data.combo" },
{ text: "Medal", value: "medal", width: 140 },
{ text: "SKILL %", value: "data.perc", width: 90 },
{ text: "SKILL POINT", value: "data.new_skill", width: 140 },
],
chartTable: {
1: "BASIC",
2: "ADVANCED",
3: "EXTREME",
12: "MASTER",
},
rankTable: {
100: "E",
200: "D",
300: "C",
400: "B",
500: "A",
600: "S",
700: "SS",
800: "EXC",
},
versions: GITADORA_VERSION_DATA,
},
{
@@ -796,11 +952,27 @@ export const gameData = [
},
],
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Skill %", value: "skill.perc" },
{ text: "Skill Point", value: "skill.point" },
{ text: "Combos", value: "data.combo" },
{ text: "Medal", value: "medal", width: 140 },
{ text: "SKILL %", value: "data.perc", width: 90 },
{ text: "SKILL POINT", value: "data.new_skill", width: 140 },
],
chartTable: {
1: "BASIC",
2: "ADVANCED",
3: "EXTREME",
12: "MASTER",
},
rankTable: {
100: "E",
200: "D",
300: "C",
400: "B",
500: "A",
600: "S",
700: "SS",
800: "EXC",
},
versions: GITADORA_VERSION_DATA,
},
{
@@ -809,11 +981,35 @@ export const gameData = [
icon: null,
cardBG: null,
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Skill %", value: "skill.perc" },
{ text: "Skill Point", value: "skill.point" },
{ text: "Combos", value: "data.combo" },
{ text: "Medal", value: "medal", width: 140 },
{ text: "SKILL %", value: "data.skill_perc", width: 90 },
{ text: "SKILL POINT", value: "data.skill_points", width: 140 },
],
chartTable: {
0: "GUITAR BEGINNER",
1: "GUITAR BASIC",
2: "GUITAR ADVANCED",
3: "GUITAR EXTREME",
4: "BASS BEGINNER",
5: "BASS BASIC",
6: "BASS ADVANCED",
7: "BASS EXTREME",
8: "OPEN BEGINNER",
9: "OPEN BASIC",
10: "OPEN ADVANCED",
11: "OPEN EXTREME",
},
rankTable: {
7: "NO PLAY",
6: "S",
5: "AA",
4: "A",
3: "B",
2: "C",
1: "D",
0: "F",
},
playerHeaders: [
{
text: "SKILL LEVEL",
@@ -914,12 +1110,41 @@ export const gameData = [
icon: "/assets/icon/iidx.webp",
cardBG: "/assets/card/iidx.webp",
scoreHeaders: [
{ text: "EX Score", value: "exscore" },
{ text: "Combos", value: "combo" },
{ text: "Misses", value: "misses" },
{ text: "Halo", value: "halo" },
{ text: "Gauge %", value: "gauge" },
{ text: "Misses", value: "data.misses" },
{ text: "Clear Status", value: "data.medal" },
],
chartTable: {
0: "SP NORMAL",
1: "SP HYPER",
2: "SP ANOTHER",
3: "DP NORMAL",
4: "DP HYPER",
5: "DP ANOTHER",
6: "SP BEGINNER",
7: "SP LEGGENDARIA",
8: "DP BEGINNER",
9: "DP LEGGENDARIA",
},
rankTable: {
100: "E",
200: "D",
300: "C",
400: "B",
500: "A",
600: "S",
700: "SS",
800: "EXC",
},
medalTable: {
50: "NO PLAY",
100: "FAILED",
200: "ASSIST CLEAR",
300: "EAST CLEAR",
400: "CLEAR",
500: "HARD CLEAR",
600: "EX HARD CLEAR",
700: "FULL COMBO",
},
playerHeaders: [
{ text: "SP DAN", value: "sgrade", width: 100 },
{ text: "DP DAN", value: "dgrade", width: 100 },
@@ -1168,10 +1393,36 @@ export const gameData = [
icon: null,
cardBG: null,
scoreHeaders: [
{ text: "Combos", value: "combo" },
{ text: "Halo", value: "halo" },
{ text: "Music Rate", value: "rate" },
{ text: "Combos", value: "data.combo", width: 80 },
{ text: "Medal", value: "data.medal", width: 120 },
{ text: "Music Rate", value: "data.music_rate", width: 120 },
],
chartTable: {
0: "BASIC",
1: "ADVANCED",
2: "EXTREME",
3: "BASIC (HARD MODE)",
4: "ADVANCED (HARD MODE)",
5: "EXTREME (HARD MODE)",
},
rankTable: {
100: "E",
200: "D",
300: "C",
400: "B",
500: "A",
600: "S",
700: "SS",
800: "EXC",
},
medalTable: {
100: "FAILED",
200: "CLEARED",
300: "NEARLY FULL COMBO",
400: "FULL COMBO",
500: "NEARLY EXCELLENT",
600: "EXCELLENT",
},
playerHeaders: [
{ text: "Jubility", value: "jubility", sortable: true, width: 120 },
],

View File

@@ -33,13 +33,14 @@ if (!thisGame) {
const scores = ref([]);
const headers = [
{ text: "Player", value: "userId", width: 100 },
{ text: "Timestamp", value: "timestamp", width: 170 },
{ text: "Player", value: "username", width: 120 },
{ text: "New PB", value: "newRecord", width: 100 },
{ text: "Timestamp", value: "timestamp", width: 140 },
{ text: "Song", value: "song.name", width: 180 },
{ text: "Artist", value: "song.artist", width: 180 },
{ text: "Artist", value: "song.artist", width: 150 },
{ text: "Chart", value: "song.chart", width: 100 },
{ text: "Grade", value: "data.rank", width: 80 },
{ text: "Score", value: "points", width: 100 },
{ text: "Score", value: "points", width: 120 },
];
if (thisGame.scoreHeaders) {
@@ -48,7 +49,7 @@ if (thisGame.scoreHeaders) {
}
}
headers.push({ text: "Type", value: "type", width: 80 });
// headers.push({ text: "Type", value: "type", width: 80 });
onMounted(async () => {
try {
@@ -62,20 +63,82 @@ onMounted(async () => {
function formatScores(scores) {
var formattedItems = [];
for (var item of scores) {
if (item.newRecord) {
item.newRecord = "✅";
} else {
item.newRecord = "";
}
if (item.timestamp) {
const date = new Date(item.timestamp * 1000);
item.timestamp = date.toLocaleString();
if (item.newRecord) {
item.timestamp = `${item.timestamp}\nNew High Score!`;
}
}
if (item.points) {
if (item.points != undefined) {
item.points = item.points
.toString()
.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
if (item.data?.stats?.score != undefined) {
item.exscore = item.points.toString();
item.points = item.data?.stats?.score
.toString()
.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
if (item.song?.chart != undefined && thisGame.chartTable) {
item.song.chart = thisGame.chartTable[item.song?.chart];
}
if (item.data?.halo != undefined && thisGame.haloTable) {
item.data.halo = thisGame.haloTable[item.data?.halo];
}
if (item.data?.medal != undefined && thisGame.medalTable) {
item.data.medal = thisGame.medalTable[item.data?.medal];
}
if (item.data?.clear_status != undefined && thisGame.medalTable) {
item.data.medal = thisGame.medalTable[item.data?.clear_status];
}
if (item.data?.rank != undefined && thisGame.rankTable) {
item.data.rank = thisGame.rankTable[item.data?.rank];
}
if (item.data?.result_rank != undefined && thisGame.rankTable) {
item.data.rank = thisGame.rankTable[item.data?.result_rank];
}
if (item.data?.grade != undefined && thisGame.rankTable) {
item.data.rank = thisGame.rankTable[item.data?.grade];
}
if (item.data?.skill_perc > 0) {
item.data.skill_perc = `${item.data?.skill_perc / 100}%`;
} else {
item.data.skill_perc = "0%";
}
if (item.data?.skill_points) {
item.data.skill_points = item.data?.skill_points / 10;
}
if (item.data?.perc > 0) {
item.data.perc = `${item.data?.perc / 100}%`;
} else {
item.data.perc = "0%";
}
if (item.data?.new_skill) {
item.data.new_skill = item.data?.new_skill / 10;
}
if (item.data?.music_rate) {
item.data.music_rate = item.data?.music_rate / 10;
}
formattedItems.push(item);
}
return formattedItems;

View File

@@ -36,12 +36,13 @@ const myProfile = ref(null);
const scores = ref([]);
const headers = [
{ text: "Timestamp", value: "timestamp", width: 170 },
{ text: "Timestamp", value: "timestamp", width: 140 },
{ text: "New PB", value: "newRecord", width: 100 },
{ text: "Song", value: "song.name", width: 180 },
{ text: "Artist", value: "song.artist", width: 180 },
{ text: "Chart", value: "song.chart", width: 100 },
{ text: "Grade", value: "data.rank", width: 80 },
{ text: "Score", value: "points", width: 100 },
{ text: "Score", value: "points", width: 120 },
];
if (thisGame.scoreHeaders) {
@@ -50,7 +51,7 @@ if (thisGame.scoreHeaders) {
}
}
headers.push({ text: "Type", value: "type", width: 80 });
// headers.push({ text: "Type", value: "type", width: 80 });
onMounted(async () => {
try {
@@ -76,20 +77,82 @@ async function loadProfile() {
function formatScores(scores) {
var formattedItems = [];
for (var item of scores) {
if (item.newRecord) {
item.newRecord = "✅";
} else {
item.newRecord = "";
}
if (item.timestamp) {
const date = new Date(item.timestamp * 1000);
item.timestamp = date.toLocaleString();
if (item.newRecord) {
item.timestamp = `${item.timestamp}\nNew High Score!`;
}
}
if (item.points) {
if (item.points != undefined) {
item.points = item.points
.toString()
.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
if (item.data?.stats?.score != undefined) {
item.exscore = item.points.toString();
item.points = item.data?.stats?.score
.toString()
.replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ",");
}
if (item.song?.chart != undefined && thisGame.chartTable) {
item.song.chart = thisGame.chartTable[item.song?.chart];
}
if (item.data?.halo != undefined && thisGame.haloTable) {
item.data.halo = thisGame.haloTable[item.data?.halo];
}
if (item.data?.medal != undefined && thisGame.medalTable) {
item.data.medal = thisGame.medalTable[item.data?.medal];
}
if (item.data?.clear_status != undefined && thisGame.medalTable) {
item.data.medal = thisGame.medalTable[item.data?.clear_status];
}
if (item.data?.rank != undefined && thisGame.rankTable) {
item.data.rank = thisGame.rankTable[item.data?.rank];
}
if (item.data?.result_rank != undefined && thisGame.rankTable) {
item.data.rank = thisGame.rankTable[item.data?.result_rank];
}
if (item.data?.grade != undefined && thisGame.rankTable) {
item.data.rank = thisGame.rankTable[item.data?.grade];
}
if (item.data?.skill_perc > 0) {
item.data.skill_perc = `${item.data?.skill_perc / 100}%`;
} else {
item.data.skill_perc = "0%";
}
if (item.data?.skill_points) {
item.data.skill_points = item.data?.skill_points / 10;
}
if (item.data?.perc > 0) {
item.data.perc = `${item.data?.perc / 100}%`;
} else {
item.data.perc = "0%";
}
if (item.data?.new_skill) {
item.data.new_skill = item.data?.new_skill / 10;
}
if (item.data?.music_rate) {
item.data.music_rate = item.data?.music_rate / 10;
}
formattedItems.push(item);
}
return formattedItems;
@@ -106,7 +169,7 @@ function formatScores(scores) {
:href="`/#/games/${gameID}/profiles/${myProfile.userId}`"
class="w-full md:w-auto"
color="info"
:label="`${myProfile.name}'s Profile`"
:label="`${myProfile.username}'s Profile`"
/>
<BaseButton
@@ -122,7 +185,7 @@ function formatScores(scores) {
<SectionTitleLine
:icon="mdiCounter"
:title="`${myProfile.name}'s ${
:title="`${myProfile.username}'s ${
thisGame.shortName ? thisGame.shortName : thisGame.name
} Scores`"
main