Add PMS and Jubeat config support.

This commit is contained in:
zkldi
2022-01-03 23:29:47 +00:00
parent 3e0e99954a
commit 4fcb393cab
7 changed files with 353 additions and 53 deletions
+5
View File
@@ -23,6 +23,11 @@ t.test("#GetGamePTConfig", (t) => {
`${game}:${playtype}`,
`Should return the right GamePTConfig (${game} ${playtype})`
);
if (conf.gradeBoundaries === null) {
continue;
}
t.equal(
conf.gradeBoundaries.length,
conf.grades.length,
+255 -7
View File
@@ -8,6 +8,8 @@ import {
GameClassSets,
GitadoraColours,
IIDXDans,
JubeatColours,
PMSDans,
PopnClasses,
SDVXDans,
SDVXVFClasses,
@@ -63,7 +65,7 @@ interface BaseGamePTConfig<I extends IDStrings> {
grades: Grades[I][];
gradeColours: Record<Grades[I], string>;
clearGrade: Grades[I];
gradeBoundaries: number[];
gradeBoundaries: number[] | null;
lamps: Lamps[I][];
lampColours: Record<Lamps[I], string>;
@@ -107,6 +109,7 @@ export const COLOUR_SET = {
paleGreen: "rgba(142,174,79, 1)",
paleBlue: "rgba(92, 97, 153, 1)",
green: "rgba(50, 205, 50, 1)",
darkGreen: "rgba(30, 130, 76, 1)",
blue: "rgba(70, 130, 180, 1)",
gold: "rgba(255, 215, 0, 1)",
vibrantYellow: "rgba(245, 229, 27, 1)",
@@ -165,12 +168,12 @@ const GAME_CONFIGS: GameConfigs = {
internalName: "gitadora",
validPlaytypes: ["Gita", "Dora"],
},
// jubeat: {
// defaultPlaytype: "Single",
// name: "jubeat",
// internalName: "jubeat",
// validPlaytypes: ["Single"],
// },
jubeat: {
defaultPlaytype: "Single",
name: "jubeat",
internalName: "jubeat",
validPlaytypes: ["Single"],
},
maimai: {
defaultPlaytype: "Single",
name: "maimai",
@@ -201,6 +204,12 @@ const GAME_CONFIGS: GameConfigs = {
internalName: "wacca",
validPlaytypes: ["Single"],
},
pms: {
defaultPlaytype: "Controller",
internalName: "pms",
name: "PMS",
validPlaytypes: ["Controller", "Keyboard"],
},
};
type GamePTConfigs = {
@@ -1746,6 +1755,245 @@ const GAME_PT_CONFIGS: GamePTConfigs = {
tierlists: [],
tierlistDescriptions: {},
},
"jubeat:Single": {
idString: "jubeat:Single",
percentMax: 120,
defaultScoreRatingAlg: "jubility",
defaultSessionRatingAlg: "jubility",
defaultProfileRatingAlg: "jubility",
scoreRatingAlgs: ["jubility"],
sessionRatingAlgs: ["jubility"],
profileRatingAlgs: ["jubility", "naiveJubility"],
scoreRatingAlgFormatters: {},
profileRatingAlgFormatters: {},
sessionRatingAlgFormatters: {},
difficulties: ["BSC", "ADV", "EXT", "HARD BSC", "HARD ADV", "HARD EXT"],
shortDifficulties: {
BSC: "BSC",
ADV: "ADV",
EXT: "EXT",
"HARD BSC": "H. BSC",
"HARD ADV": "H. ADV",
"HARD EXT": "H. EXT",
},
defaultDifficulty: "EXT",
difficultyColours: {
BSC: COLOUR_SET.green,
ADV: COLOUR_SET.gold,
EXT: COLOUR_SET.red,
"HARD BSC": COLOUR_SET.darkGreen,
"HARD ADV": COLOUR_SET.orange,
"HARD EXT": COLOUR_SET.maroon,
},
grades: ["E", "D", "C", "B", "A", "S", "SS", "SSS", "EXC"],
gradeColours: {
E: COLOUR_SET.gray,
D: COLOUR_SET.maroon,
C: COLOUR_SET.red,
B: COLOUR_SET.blue,
A: COLOUR_SET.green,
S: COLOUR_SET.gold,
SS: COLOUR_SET.orange,
SSS: COLOUR_SET.teal,
EXC: COLOUR_SET.white,
},
clearGrade: "A",
gradeBoundaries: null,
lamps: ["FAILED", "CLEAR", "FULL COMBO", "EXCELLENT"],
lampColours: {
FAILED: COLOUR_SET.red,
CLEAR: COLOUR_SET.blue,
"FULL COMBO": COLOUR_SET.teal,
EXCELLENT: COLOUR_SET.white,
},
clearLamp: "CLEAR",
classHumanisedFormat: {
colour: JubeatColours,
},
supportsESD: false,
judgements: ["perfect", "great", "good", "bad", "miss"],
scoreBucket: "grade",
currentLatestVersion: "festo",
currentGameOmniVersion: null,
currentLocalVersion: "festo",
supportedVersions: ["festo"],
tierlists: [],
tierlistDescriptions: {},
},
"pms:Controller": {
idString: "pms:Controller",
percentMax: 100,
defaultScoreRatingAlg: "sieglinde",
defaultSessionRatingAlg: "sieglinde",
defaultProfileRatingAlg: "sieglinde",
scoreRatingAlgs: ["sieglinde"],
sessionRatingAlgs: ["sieglinde"],
profileRatingAlgs: ["sieglinde"],
scoreRatingAlgFormatters: {},
profileRatingAlgFormatters: {},
sessionRatingAlgFormatters: {},
difficulties: ["CHART"],
shortDifficulties: {},
defaultDifficulty: "CHART",
difficultyColours: {
CHART: null,
},
grades: ["F", "E", "D", "C", "B", "A", "AA", "AAA", "MAX-", "MAX"],
gradeColours: {
F: COLOUR_SET.gray,
E: COLOUR_SET.red,
D: COLOUR_SET.maroon,
C: COLOUR_SET.purple,
B: COLOUR_SET.paleBlue,
A: COLOUR_SET.green,
AA: COLOUR_SET.blue,
AAA: COLOUR_SET.gold,
"MAX-": COLOUR_SET.teal,
MAX: COLOUR_SET.white,
},
clearGrade: "A",
gradeBoundaries: [0, 22.22, 33.33, 44.44, 55.55, 66.66, 77.77, 88.88, 94.44, 100.0],
lamps: [
"NO PLAY",
"FAILED",
"ASSIST CLEAR",
"EASY CLEAR",
"CLEAR",
"HARD CLEAR",
"EX HARD CLEAR",
"FULL COMBO",
],
lampColours: {
"NO PLAY": COLOUR_SET.gray,
FAILED: COLOUR_SET.red,
"ASSIST CLEAR": COLOUR_SET.purple,
"EASY CLEAR": COLOUR_SET.green,
CLEAR: COLOUR_SET.blue,
"HARD CLEAR": COLOUR_SET.orange,
"EX HARD CLEAR": COLOUR_SET.gold,
"FULL COMBO": COLOUR_SET.teal,
},
clearLamp: "CLEAR",
classHumanisedFormat: {
dan: PMSDans,
},
supportsESD: false,
judgements: ["cool", "great", "good", "bad", "poor"],
scoreBucket: "lamp",
currentLatestVersion: null,
currentGameOmniVersion: null,
currentLocalVersion: null,
supportedVersions: [],
tierlists: ["sgl-EC", "sgl-HC"],
tierlistDescriptions: {
"sgl-EC": "Sieglinde Easy Clear ratings.",
"sgl-HC": "Sieglinde Hard Clear ratings.",
},
},
"pms:Keyboard": {
idString: "pms:Keyboard",
percentMax: 100,
defaultScoreRatingAlg: "sieglinde",
defaultSessionRatingAlg: "sieglinde",
defaultProfileRatingAlg: "sieglinde",
scoreRatingAlgs: ["sieglinde"],
sessionRatingAlgs: ["sieglinde"],
profileRatingAlgs: ["sieglinde"],
scoreRatingAlgFormatters: {},
profileRatingAlgFormatters: {},
sessionRatingAlgFormatters: {},
difficulties: ["CHART"],
shortDifficulties: {},
defaultDifficulty: "CHART",
difficultyColours: {
CHART: null,
},
grades: ["F", "E", "D", "C", "B", "A", "AA", "AAA", "MAX-", "MAX"],
gradeColours: {
F: COLOUR_SET.gray,
E: COLOUR_SET.red,
D: COLOUR_SET.maroon,
C: COLOUR_SET.purple,
B: COLOUR_SET.paleBlue,
A: COLOUR_SET.green,
AA: COLOUR_SET.blue,
AAA: COLOUR_SET.gold,
"MAX-": COLOUR_SET.teal,
MAX: COLOUR_SET.white,
},
clearGrade: "A",
gradeBoundaries: [0, 22.22, 33.33, 44.44, 55.55, 66.66, 77.77, 88.88, 94.44, 100.0],
lamps: [
"NO PLAY",
"FAILED",
"ASSIST CLEAR",
"EASY CLEAR",
"CLEAR",
"HARD CLEAR",
"EX HARD CLEAR",
"FULL COMBO",
],
lampColours: {
"NO PLAY": COLOUR_SET.gray,
FAILED: COLOUR_SET.red,
"ASSIST CLEAR": COLOUR_SET.purple,
"EASY CLEAR": COLOUR_SET.green,
CLEAR: COLOUR_SET.blue,
"HARD CLEAR": COLOUR_SET.orange,
"EX HARD CLEAR": COLOUR_SET.gold,
"FULL COMBO": COLOUR_SET.teal,
},
clearLamp: "CLEAR",
classHumanisedFormat: {
dan: PMSDans,
},
supportsESD: false,
judgements: ["cool", "great", "good", "bad", "poor"],
scoreBucket: "lamp",
currentLatestVersion: null,
currentGameOmniVersion: null,
currentLocalVersion: null,
supportedVersions: [],
tierlists: ["sgl-EC", "sgl-HC"],
tierlistDescriptions: {
"sgl-EC": "Sieglinde Easy Clear ratings.",
"sgl-HC": "Sieglinde Hard Clear ratings.",
},
},
};
/**
+10 -2
View File
@@ -59,19 +59,22 @@ export const allIDStrings: IDStrings[] = [
"usc:Controller",
"usc:Keyboard",
"wacca:Single",
"pms:Controller",
"pms:Keyboard",
"jubeat:Single",
];
export const allSupportedGames: Game[] = [
"iidx",
"museca",
"maimai",
// "jubeat",
"jubeat",
"popn",
"sdvx",
"ddr",
"bms",
"chunithm",
// "gitadora",
"gitadora",
"usc",
"wacca",
];
@@ -157,4 +160,9 @@ export const PrettyVersions: Versions = {
"wacca:Single": {
reverse: "REVERSE",
},
"jubeat:Single": {
festo: "festo",
},
"pms:Controller": {},
"pms:Keyboard": {},
};
+31
View File
@@ -257,6 +257,35 @@ export const PopnClasses = [
mouseoverVariant("神", "God", "warning"),
];
export const PMSDans = [
mouseoverVariant("●1", "Insane 1st Dan", "info"),
mouseoverVariant("●2", "Insane 2nd Dan", "info"),
mouseoverVariant("●3", "Insane 3rd Dan", "info"),
mouseoverVariant("●4", "Insane 4th Dan", "info"),
mouseoverVariant("●5", "Insane 5th Dan", "info"),
mouseoverVariant("●6", "Insane 6th Dan", "info"),
mouseoverVariant("●7", "Insane 7th Dan", "info"),
mouseoverVariant("●8", "Insane 8th Dan", "info"),
mouseoverCSS("●9", "Insane 9th Dan", "red"),
mouseoverCSS("●10", "Insane 10th Dan", "red"),
mouseoverCSS("●●", "Insane Kaiden", "teal"),
noMouseoverCSS("●OJ", "Overjoy", "purple"),
mouseoverVariant("●UNDF", "Undefined (Post-Overjoy)", "warning"),
];
export const JubeatColours = [
noMouseoverVariant("Black", "secondary"),
noMouseoverCSS("Yellow-Green", "yellowgreen", "black"),
noMouseoverCSS("Green", "green"),
noMouseoverCSS("Light Blue", "cyan", "black"),
noMouseoverVariant("Blue", "info"),
noMouseoverCSS("Violet", "violet"),
noMouseoverCSS("Purple", "purple"),
noMouseoverCSS("Pink", "pink"),
noMouseoverCSS("Orange", "orange"),
noMouseoverVariant("Gold", "warning"),
];
export interface GameClassSets {
"iidx:SP": "dan";
"iidx:DP": "dan";
@@ -275,6 +304,8 @@ export interface GameClassSets {
"gitadora:Gita": "colour";
"gitadora:Dora": "colour";
"wacca:Single": "stageUp" | "colour";
"pms:Controller": "dan";
"pms:Keyboard": "dan";
}
export type AllClassSets = GameClassSets[IDStrings];
-10
View File
@@ -1,10 +0,0 @@
import t from "tap";
import { CalculateGradeDeltaIIDX } from "./util";
t.test("#CalculateGradeDeltaIIDX", (t) => {
t.equal(CalculateGradeDeltaIIDX("A", 1000, 2000), "A-334");
t.equal(CalculateGradeDeltaIIDX("AAA", 1778, 2000), "AAA+0");
t.equal(CalculateGradeDeltaIIDX("MAX", 1900, 2000), "MAX-100");
t.end();
});
-25
View File
@@ -1,25 +0,0 @@
import { GetGamePTConfig } from "../config/config";
import { Grades, integer } from "../types";
const IIDXConfig = GetGamePTConfig("iidx", "SP");
export function CalculateGradeDeltaIIDX(
cmpGrade: Grades["iidx:SP" | "iidx:DP"],
score: integer,
notecount: integer
): string {
const cmpGradeIDX = IIDXConfig.grades.indexOf(cmpGrade);
const cmpGradePercent = IIDXConfig.gradeBoundaries[cmpGradeIDX];
const cmpScore = Math.ceil(notecount * (cmpGradePercent / 100));
const delta = score - cmpScore;
if (delta >= 0) {
return `${cmpGrade}+${delta}`;
} else {
// negative numbers implicitly stringify with the - prefix
return `${cmpGrade}${delta}`;
}
}
+52 -9
View File
@@ -26,13 +26,15 @@ export type IDStrings =
| "ddr:DP"
| "maimai:Single"
| "museca:Single"
// | "jubeat:Single"
| "jubeat:Single"
| "bms:7K"
| "bms:14K"
| "chunithm:Single"
| "gitadora:Gita"
| "gitadora:Dora"
| "wacca:Single";
| "wacca:Single"
| "pms:Keyboard"
| "pms:Controller";
export interface IDStringToPlaytype {
"iidx:SP": "SP";
@@ -52,6 +54,8 @@ export interface IDStringToPlaytype {
"gitadora:Gita": "Gita";
"gitadora:Dora": "Dora";
"wacca:Single": "Single";
"pms:Keyboard": "Keyboard";
"pms:Controller": "Controller";
}
export interface IDStringToGame {
@@ -72,6 +76,8 @@ export interface IDStringToGame {
"gitadora:Gita": "gitadora";
"gitadora:Dora": "gitadora";
"wacca:Single": "wacca";
"pms:Keyboard": "pms";
"pms:Controller": "pms";
}
export interface GameToIDStrings {
@@ -87,6 +93,7 @@ export interface GameToIDStrings {
gitadora: "gitadora:Gita" | "gitadora:Dora";
popn: "popn:9B";
wacca: "wacca:Single";
pms: "pms:Keyboard" | "pms:Controller";
}
/**
@@ -111,7 +118,7 @@ export type Game =
| "iidx"
| "museca"
| "maimai"
// | "jubeat"
| "jubeat"
| "popn"
| "sdvx"
| "ddr"
@@ -119,7 +126,8 @@ export type Game =
| "chunithm"
| "gitadora"
| "usc"
| "wacca";
| "wacca"
| "pms";
/**
* This is the generic response from the Kamaitachi API in event of a failure.
@@ -162,6 +170,7 @@ export interface Playtypes {
bms: "7K" | "14K";
gitadora: "Gita" | "Dora";
wacca: "Single";
pms: "Keyboard" | "Controller";
}
type IIDXGrades = "F" | "E" | "D" | "C" | "B" | "A" | "AA" | "AAA" | "MAX-" | "MAX";
@@ -230,6 +239,8 @@ export interface Grades {
| "SSS"
| "SSS+"
| "MASTER";
"pms:Controller": IIDXGrades;
"pms:Keyboard": IIDXGrades;
}
type IIDXLamps =
@@ -278,6 +289,8 @@ export interface Lamps {
"gitadora:Gita": GitadoraLamps;
"gitadora:Dora": GitadoraLamps;
"wacca:Single": "FAILED" | "CLEAR" | "MISSLESS" | "FULL COMBO" | "ALL MARVELOUS";
"pms:Controller": IIDXLamps;
"pms:Keyboard": IIDXLamps;
}
export type IIDX2DXTraSets = "Kichiku" | "Kiraku" | "All Scratch";
@@ -294,7 +307,7 @@ export interface Difficulties {
"ddr:SP": "BEGINNER" | "BASIC" | "DIFFICULT" | "EXPERT" | "CHALLENGE";
"ddr:DP": "BASIC" | "DIFFICULT" | "EXPERT" | "CHALLENGE";
"maimai:Single": "Easy" | "Basic" | "Advanced" | "Expert" | "Master" | "Re:Master";
"jubeat:Single": "BSC" | "ADV" | "EXT";
"jubeat:Single": "BSC" | "ADV" | "EXT" | "HARD BSC" | "HARD ADV" | "HARD EXT";
"museca:Single": "Green" | "Yellow" | "Red";
"bms:7K": "CHART";
"bms:14K": "CHART";
@@ -310,6 +323,8 @@ export interface Difficulties {
| "BASS MASTER";
"gitadora:Dora": "BASIC" | "ADVANCED" | "EXTREME" | "MASTER";
"wacca:Single": "NORMAL" | "HARD" | "EXPERT" | "INFERNO";
"pms:Controller": "CHART";
"pms:Keyboard": "CHART";
}
/**
@@ -508,6 +523,8 @@ export interface SessionCalculatedDataLookup {
"gitadora:Gita": "skill";
"gitadora:Dora": "skill";
"wacca:Single": "naiveRate";
"pms:Controller": "sieglinde";
"pms:Keyboard": "sieglinde";
}
export interface SessionDocument<I extends IDStrings = IDStrings> extends MongoDBDocument {
@@ -733,7 +750,7 @@ export interface UGSRatingsLookup {
"ddr:SP": "MFCP" | "ktRating";
"ddr:DP": "MFCP" | "ktRating";
"maimai:Single": "ktRating";
"jubeat:Single": "jubility";
"jubeat:Single": "jubility" | "naiveJubility";
"museca:Single": "ktRating";
"bms:7K": "sieglinde";
"bms:14K": "sieglinde";
@@ -741,6 +758,8 @@ export interface UGSRatingsLookup {
"gitadora:Gita": "skill";
"gitadora:Dora": "skill";
"wacca:Single": "naiveRate" | "rate";
"pms:Controller": "sieglinde";
"pms:Keyboard": "sieglinde";
}
export interface UserGameStats<I extends IDStrings = IDStrings> extends MongoDBDocument {
@@ -801,7 +820,7 @@ export interface GPTSupportedVersions {
"ddr:SP": "a20";
"ddr:DP": "a20";
"maimai:Single": "finale";
"jubeat:Single": never;
"jubeat:Single": "festo";
"museca:Single": "1.5" | "1.5-b";
"bms:7K": never;
"bms:14K": never;
@@ -809,6 +828,8 @@ export interface GPTSupportedVersions {
"gitadora:Gita": "nextage";
"gitadora:Dora": "nextage";
"wacca:Single": "reverse";
"pms:Controller": never;
"pms:Keyboard": never;
}
interface CDDataIIDXSP {
@@ -852,7 +873,7 @@ interface ChartDocumentData {
"ddr:SP": CDDataDDRSP;
"ddr:DP": CDDataDDRSP;
"maimai:Single": { maxPercent: number; inGameID: number; inGameStrID: string };
"jubeat:Single": { arcChartID: string | null };
"jubeat:Single": { inGameID: integer };
"museca:Single": { inGameID: integer };
"bms:7K": CDDataBMS;
"bms:14K": CDDataBMS;
@@ -860,6 +881,8 @@ interface ChartDocumentData {
"gitadora:Gita": { inGameID: integer };
"gitadora:Dora": { inGameID: integer };
"wacca:Single": { isHot: boolean };
"pms:Controller": CDDataBMS;
"pms:Keyboard": CDDataBMS;
}
export interface GPTTierlists {
@@ -880,6 +903,8 @@ export interface GPTTierlists {
"gitadora:Gita": never;
"gitadora:Dora": never;
"wacca:Single": never;
"pms:Controller": "sgl-HC" | "sgl-EC";
"pms:Keyboard": "sgl-HC" | "sgl-EC";
}
export interface ChartTierlistInfo {
@@ -901,6 +926,7 @@ export interface ChartDocument<I extends IDStrings = IDStrings> extends MongoDBD
tierlistInfo: Partial<Record<GPTTierlists[I], ChartTierlistInfo>>;
versions: GPTSupportedVersions[I][];
}
interface SongDocumentData {
iidx: { genre: string; displayVersion: string | null };
museca: { titleJP: string; artistJP: string; displayVersion: string };
@@ -914,6 +940,7 @@ interface SongDocumentData {
chunithm: { genre: string; displayVersion: string };
gitadora: { isHot: boolean; displayVersion: string };
wacca: { titleJP: string; artistJP: string; genre: string; displayVersion: string | null };
pms: { genre: string | null; subtitle: string | null; subartist: string | null };
}
export interface SongDocument<G extends Game = Game> extends MongoDBDocument {
@@ -997,6 +1024,12 @@ interface BMS7KScoreMeta {
gauge: "NORMAL" | "EASY" | "HARD" | "EX-HARD" | null;
}
interface PMSScoreMeta {
random: RanOptions | null;
client: "beatoraja" | null;
gauge: "NORMAL" | "EASY" | "HARD" | "EX-HARD" | null;
}
interface USCScoreMeta {
noteMod: "NORMAL" | "MIRROR" | "RANDOM" | "MIR-RAN" | null;
gaugeMod: "NORMAL" | "HARD" | "PERMISSIVE" | null;
@@ -1026,6 +1059,8 @@ interface ScoreMetaLookup {
"gitadora:Gita": Record<string, never>;
"gitadora:Dora": Record<string, never>;
"wacca:Single": { mirror: boolean | null };
"pms:Controller": PMSScoreMeta;
"pms:Keyboard": PMSScoreMeta;
}
interface BASE_VALID_HIT_META {
@@ -1099,6 +1134,8 @@ export interface HitMetaLookup {
"gitadora:Gita": BASE_VALID_HIT_META;
"gitadora:Dora": BASE_VALID_HIT_META;
"wacca:Single": BASE_VALID_HIT_META;
"pms:Controller": BMSHitMeta;
"pms:Keyboard": BMSHitMeta;
}
type IIDXJudges = "pgreat" | "great" | "good" | "bad" | "poor";
@@ -1126,6 +1163,8 @@ export interface JudgementLookup {
"gitadora:Gita": GitadoraJudges;
"gitadora:Dora": GitadoraJudges;
"wacca:Single": "marvelous" | "great" | "good" | "miss";
"pms:Controller": "cool" | "great" | "good" | "bad" | "poor";
"pms:Keyboard": "cool" | "great" | "good" | "bad" | "poor";
}
export interface ScoreCalculatedDataLookup {
@@ -1138,7 +1177,7 @@ export interface ScoreCalculatedDataLookup {
"ddr:SP": "MFCP" | "ktRating";
"ddr:DP": "MFCP" | "ktRating";
"maimai:Single": "ktRating";
// "jubeat:Single": "jubility";
"jubeat:Single": "jubility";
"museca:Single": "ktRating";
"bms:7K": "sieglinde";
"bms:14K": "sieglinde";
@@ -1146,6 +1185,8 @@ export interface ScoreCalculatedDataLookup {
"gitadora:Gita": "skill";
"gitadora:Dora": "skill";
"wacca:Single": "rate";
"pms:Controller": "sieglinde";
"pms:Keyboard": "sieglinde";
}
export interface ScoreDocument<I extends IDStrings = IDStrings> extends MongoDBDocument {
@@ -1382,6 +1423,8 @@ export interface UGPTSpecificPreferences {
"gitadora:Gita": Record<string, never>;
"gitadora:Dora": Record<string, never>;
"wacca:Single": Record<string, never>;
"pms:Controller": Record<string, never>;
"pms:Keyboard": Record<string, never>;
}
export interface UGPTSettings<I extends IDStrings = IDStrings> extends MongoDBDocument {