From 3c875bb6183df6ceaa2e570cae711a19ffb28e4b Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Sat, 11 Jun 2022 22:27:36 +0100 Subject: [PATCH] feat: itg stamina support --- common/src/config/config.ts | 90 +++++++++++++++++++++++++++++++++++++ common/src/game-classes.ts | 1 + common/src/types.ts | 71 +++++++++++++++++++++++++---- 3 files changed, 154 insertions(+), 8 deletions(-) diff --git a/common/src/config/config.ts b/common/src/config/config.ts index e3387e329..4460fa43d 100644 --- a/common/src/config/config.ts +++ b/common/src/config/config.ts @@ -213,6 +213,12 @@ const GAME_CONFIGS: GameConfigs = { name: "PMS", validPlaytypes: ["Controller", "Keyboard"], }, + itg: { + defaultPlaytype: "Stamina", + internalName: "itg", + name: "ITG", + validPlaytypes: ["Stamina"], + }, }; type GamePTConfigs = { @@ -2267,6 +2273,90 @@ const GAME_PT_CONFIGS: GamePTConfigs = { "sgl-HC": "Sieglinde Hard Clear ratings.", }, }, + "itg:Stamina": { + idString: "itg:Stamina", + + percentMax: 100, + + defaultScoreRatingAlg: "blockRating", + defaultSessionRatingAlg: "blockRating", + defaultProfileRatingAlg: "highestBlock", + + scoreRatingAlgs: ["blockRating"], + sessionRatingAlgs: ["blockRating"], + profileRatingAlgs: ["highest32", "highestBlock"], + + scoreRatingAlgDescriptions: { + blockRating: "How much this clear is worth.", + }, + profileRatingAlgDescriptions: { + highest32: "The highest BPM this user has streamed 32 unbroken measures at.", + highestBlock: "The highest block level this player has cleared.", + }, + sessionRatingAlgDescriptions: { + blockRating: "An average of your best 5 block levels cleared this session.", + }, + + scoreRatingAlgFormatters: {}, + profileRatingAlgFormatters: {}, + sessionRatingAlgFormatters: {}, + + difficulties: ["Beginner", "Easy", "Normal", "Hard", "Expert"], + shortDifficulties: { + Beginner: "B", + Easy: "E", + Normal: "N", + Hard: "H", + Expert: "X", + }, + defaultDifficulty: "Expert", + difficultyColours: { + Beginner: COLOUR_SET.paleBlue, + Easy: COLOUR_SET.green, + Normal: COLOUR_SET.vibrantYellow, + Hard: COLOUR_SET.red, + Expert: COLOUR_SET.pink, + }, + + grades: ["D", "C", "B", "A", "S-", "S", "S+", "★", "★★", "★★★", "★★★★"], + gradeColours: { + D: COLOUR_SET.red, + C: COLOUR_SET.maroon, + B: COLOUR_SET.purple, + A: COLOUR_SET.green, + "S-": COLOUR_SET.paleOrange, + S: COLOUR_SET.orange, + "S+": COLOUR_SET.vibrantOrange, + "★": COLOUR_SET.pink, + "★★": COLOUR_SET.vibrantPink, + "★★★": COLOUR_SET.teal, + "★★★★": COLOUR_SET.white, + }, + clearGrade: "A", + gradeBoundaries: [0, 55, 68, 80, 89, 92, 94, 96, 98, 99, 100], + + lamps: ["FAILED", "CLEAR", "FULL COMBO", "EXCELLENT COMBO", "QUAD"], + lampColours: { + FAILED: COLOUR_SET.red, + CLEAR: COLOUR_SET.blue, + "FULL COMBO": COLOUR_SET.pink, + "EXCELLENT COMBO": COLOUR_SET.gold, + QUAD: COLOUR_SET.white, + }, + clearLamp: "CLEAR", + + classHumanisedFormat: {}, + + supportsESD: false, + judgements: ["fantastic", "excellent", "great", "decent", "wayoff", "miss"], + + scoreBucket: "lamp", + + supportedVersions: [], + + tierlists: [], + tierlistDescriptions: {}, + }, }; /** diff --git a/common/src/game-classes.ts b/common/src/game-classes.ts index 4626df681..7772d8186 100644 --- a/common/src/game-classes.ts +++ b/common/src/game-classes.ts @@ -311,6 +311,7 @@ export interface GameClassSets { "wacca:Single": "stageUp" | "colour"; "pms:Controller": "dan"; "pms:Keyboard": "dan"; + "itg:Stamina": never; } export type AllClassSets = GameClassSets[IDStrings]; diff --git a/common/src/types.ts b/common/src/types.ts index 7b98a8ad5..1dc9b4f54 100644 --- a/common/src/types.ts +++ b/common/src/types.ts @@ -39,7 +39,8 @@ export type IDStrings = | "gitadora:Dora" | "wacca:Single" | "pms:Keyboard" - | "pms:Controller"; + | "pms:Controller" + | "itg:Stamina"; export interface IDStringToPlaytype { "iidx:SP": "SP"; @@ -61,6 +62,7 @@ export interface IDStringToPlaytype { "wacca:Single": "Single"; "pms:Keyboard": "Keyboard"; "pms:Controller": "Controller"; + "itg:Stamina": "Stamina"; } export interface IDStringToGame { @@ -83,6 +85,7 @@ export interface IDStringToGame { "wacca:Single": "wacca"; "pms:Keyboard": "pms"; "pms:Controller": "pms"; + "itg:Stamina": "itg"; } export interface GameToIDStrings { @@ -99,6 +102,7 @@ export interface GameToIDStrings { popn: "popn:9B"; wacca: "wacca:Single"; pms: "pms:Keyboard" | "pms:Controller"; + itg: "itg:Stamina"; } /** @@ -132,7 +136,8 @@ export type Game = | "gitadora" | "usc" | "wacca" - | "pms"; + | "pms" + | "itg"; /** * This is the generic response from the Kamaitachi API in event of a failure. @@ -175,6 +180,7 @@ export interface Playtypes { gitadora: "Gita" | "Dora"; wacca: "Single"; pms: "Keyboard" | "Controller"; + itg: "Stamina"; } type IIDXGrades = "F" | "E" | "D" | "C" | "B" | "A" | "AA" | "AAA" | "MAX-" | "MAX"; @@ -245,6 +251,7 @@ export interface Grades { | "MASTER"; "pms:Controller": IIDXGrades; "pms:Keyboard": IIDXGrades; + "itg:Stamina": "D" | "C" | "B" | "A" | "S-" | "S" | "S+" | "★" | "★★" | "★★★" | "★★★★"; } type IIDXLamps = @@ -295,6 +302,7 @@ export interface Lamps { "wacca:Single": "FAILED" | "CLEAR" | "MISSLESS" | "FULL COMBO" | "ALL MARVELOUS"; "pms:Controller": IIDXLamps; "pms:Keyboard": IIDXLamps; + "itg:Stamina": "FAILED" | "CLEAR" | "FULL COMBO" | "EXCELLENT COMBO" | "QUAD"; } export type IIDX2DXTraSets = "Kichiku" | "Kiraku" | "All Scratch"; @@ -329,6 +337,7 @@ export interface Difficulties { "wacca:Single": "NORMAL" | "HARD" | "EXPERT" | "INFERNO"; "pms:Controller": "CHART"; "pms:Keyboard": "CHART"; + "itg:Stamina": "Beginner" | "Easy" | "Normal" | "Hard" | "Expert"; } /** @@ -467,6 +476,7 @@ export interface SessionCalculatedDataLookup { "wacca:Single": "rate"; "pms:Controller": "sieglinde"; "pms:Keyboard": "sieglinde"; + "itg:Stamina": "blockRating"; } export interface SessionDocument extends MongoDBDocument { @@ -695,6 +705,7 @@ export interface UGSRatingsLookup { "wacca:Single": "naiveRate" | "rate"; "pms:Controller": "sieglinde"; "pms:Keyboard": "sieglinde"; + "itg:Stamina": "highestBlock" | "highest32"; } export interface UserGameStats extends MongoDBDocument { @@ -759,6 +770,7 @@ export interface GPTSupportedVersions { "wacca:Single": "reverse"; "pms:Controller": never; "pms:Keyboard": never; + "itg:Stamina": never; } interface CDDataIIDXSP { @@ -800,7 +812,11 @@ interface ChartDocumentData { "usc:Controller": CDDataUSC; "ddr:SP": CDDataDDRSP; "ddr:DP": CDDataDDRSP; - "maimai:Single": { maxPercent: number; inGameID: number; inGameStrID: string }; + "maimai:Single": { + maxPercent: number; + inGameID: number; + inGameStrID: string; + }; "jubeat:Single": { inGameID: integer; isHardMode: boolean }; "museca:Single": { inGameID: integer }; "bms:7K": CDDataBMS; @@ -811,6 +827,19 @@ interface ChartDocumentData { "wacca:Single": { isHot: boolean }; "pms:Controller": CDDataBMS; "pms:Keyboard": CDDataBMS; + "itg:Stamina": { + chartHash: string; + breakdown: { + detailed: string; + partiallySimplified: string; + simplified: string; + }; + totalStream: string; + totalBreak: string; + length: number; + charter: string; + displayBPM: number; + }; } export interface GPTTierlists { @@ -833,6 +862,7 @@ export interface GPTTierlists { "wacca:Single": never; "pms:Controller": "sgl-HC" | "sgl-EC"; "pms:Keyboard": "sgl-HC" | "sgl-EC"; + "itg:Stamina": never; } export interface ChartTierlistInfo { @@ -860,7 +890,11 @@ interface SongDocumentData { museca: { titleJP: string; artistJP: string; displayVersion: string }; maimai: { titleJP: string; artistJP: string; displayVersion: string }; jubeat: { displayVersion: string }; - popn: { displayVersion: string | null; genre: string; genreEN: string | null }; + popn: { + displayVersion: string | null; + genre: string; + genreEN: string | null; + }; sdvx: { displayVersion: string }; usc: Record; ddr: { displayVersion: string }; @@ -872,13 +906,21 @@ interface SongDocumentData { }; chunithm: { genre: string; displayVersion: string }; gitadora: { isHot: boolean; displayVersion: string }; - wacca: { titleJP: string; artistJP: string; genre: string; displayVersion: string | null }; + wacca: { + titleJP: string; + artistJP: string; + genre: string; + displayVersion: string | null; + }; pms: { genre: string | null; subtitle: string | null; subartist: string | null; tableString: string | null; }; + itg: { + subtitle: string; + }; } export interface SongDocument extends MongoDBDocument { @@ -985,7 +1027,9 @@ interface USCScoreMeta { interface ScoreMetaLookup { "iidx:SP": IIDXSPScoreMeta; - "iidx:DP": IIDXSPScoreMeta & { random: { left: RanOptions; right: RanOptions } | null }; + "iidx:DP": IIDXSPScoreMeta & { + random: { left: RanOptions; right: RanOptions } | null; + }; "popn:9B": { hiSpeed: number | null; hidden: integer | null; @@ -1002,13 +1046,16 @@ interface ScoreMetaLookup { "jubeat:Single": Record; "museca:Single": Record; "bms:7K": BMS7KScoreMeta; - "bms:14K": BMS7KScoreMeta & { random: { left: RanOptions; right: RanOptions } | null }; + "bms:14K": BMS7KScoreMeta & { + random: { left: RanOptions; right: RanOptions } | null; + }; "chunithm:Single": Record; "gitadora:Gita": Record; "gitadora:Dora": Record; "wacca:Single": { mirror: boolean | null }; "pms:Controller": PMSScoreMeta; "pms:Keyboard": PMSScoreMeta; + "itg:Stamina": Record; } interface BASE_VALID_HIT_META { @@ -1083,6 +1130,9 @@ export interface HitMetaLookup { "wacca:Single": BASE_VALID_HIT_META; "pms:Controller": BMSHitMeta; "pms:Keyboard": BMSHitMeta; + "itg:Stamina": BASE_VALID_HIT_META & { + gaugeHistory: Array | null; + }; } type IIDXJudges = "pgreat" | "great" | "good" | "bad" | "poor"; @@ -1113,6 +1163,7 @@ export interface JudgementLookup { "wacca:Single": "marvelous" | "great" | "good" | "miss"; "pms:Controller": "cool" | "great" | "good" | "bad" | "poor"; "pms:Keyboard": "cool" | "great" | "good" | "bad" | "poor"; + "itg:Stamina": "fantastic" | "excellent" | "great" | "decent" | "wayoff" | "miss"; } export interface ScoreCalculatedDataLookup { @@ -1135,6 +1186,7 @@ export interface ScoreCalculatedDataLookup { "wacca:Single": "rate"; "pms:Controller": "sieglinde"; "pms:Keyboard": "sieglinde"; + "itg:Stamina": "blockRating"; } export interface ScoreDocument extends MongoDBDocument { @@ -1373,6 +1425,7 @@ export interface UGPTSpecificPreferences { "wacca:Single": Record; "pms:Controller": Record; "pms:Keyboard": Record; + "itg:Stamina": Record; } export interface UGPTSettings extends MongoDBDocument { @@ -1518,4 +1571,6 @@ export type NotificationBody = }; }; -export type NotificationDocument = BaseNotification & { body: NotificationBody }; +export type NotificationDocument = BaseNotification & { + body: NotificationBody; +};