From 48e654cabc281d93a5f885d030d1d38b86e54011 Mon Sep 17 00:00:00 2001 From: beerpsi <92439990+beer-psi@users.noreply.github.com> Date: Sat, 23 May 2026 21:42:08 +0700 Subject: [PATCH] Add new color classes for maimai DX and CHUNITHM (#1561) * Add new color classes for maimai DX and CHUNITHM * mark all game profiles as dirty instead of re-deriving --- ...ass_updates_for_maimai_DX_and_CHUNITHM.sql | 4 +++ .../client/src/lib/game-implementations.tsx | 18 +++++++---- .../src/config/game-support/chunithm.ts | 4 ++- .../src/config/game-support/maimai-dx.ts | 31 ++++++++++++------- .../games/chunithm.test.ts | 2 ++ .../game-implementations/games/chunithm.ts | 4 +++ .../games/maimaidx.test.ts | 9 ++++++ .../game-implementations/games/maimaidx.ts | 20 +++++++++++- 8 files changed, 73 insertions(+), 19 deletions(-) create mode 100644 db/migrations/20260523071801_Colour_class_updates_for_maimai_DX_and_CHUNITHM.sql diff --git a/db/migrations/20260523071801_Colour_class_updates_for_maimai_DX_and_CHUNITHM.sql b/db/migrations/20260523071801_Colour_class_updates_for_maimai_DX_and_CHUNITHM.sql new file mode 100644 index 000000000..80b7d85d6 --- /dev/null +++ b/db/migrations/20260523071801_Colour_class_updates_for_maimai_DX_and_CHUNITHM.sql @@ -0,0 +1,4 @@ +INSERT INTO game_profile_dirty (user_id, game) +SELECT user_id, game +FROM game_profile +WHERE game IN ('maimaidx', 'chunithm'); diff --git a/typescript/client/src/lib/game-implementations.tsx b/typescript/client/src/lib/game-implementations.tsx index b96e06283..63bac3c5b 100644 --- a/typescript/client/src/lib/game-implementations.tsx +++ b/typescript/client/src/lib/game-implementations.tsx @@ -66,6 +66,8 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { SILVER: bgc("gray", "var(--bs-light)"), GOLD: bgc("var(--bs-warning)", "var(--bs-dark)"), PLATINUM: bgc("silver", "var(--bs-dark)"), + PLATINUM_II: bgc("silver", "var(--bs-dark)"), + PLATINUM_III: bgc("silver", "var(--bs-dark)"), RAINBOW: RAINBOW_GRADIENT, RAINBOW_II: RAINBOW_GRADIENT, RAINBOW_III: RAINBOW_GRADIENT, @@ -392,13 +394,17 @@ export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = { BRONZE: bgc("brown", "var(--bs-light)"), SILVER: bgc("gray", "var(--bs-light)"), GOLD: bgc("var(--bs-warning)", "var(--bs-dark)"), + GOLD_II: bgc("var(--bs-warning)", "var(--bs-dark)"), PLATINUM: bgc("lightgoldenrodyellow", "var(--bs-dark)"), - - RAINBOW: { - background: - "linear-gradient(-45deg, #f0788a, #f48fb1, #9174c2, #79bcf2, #70a173, #f7ff99, #faca7d, #ff9d80, #f0788a)", - color: "var(--bs-dark)", - }, + PLATINUM_II: bgc("lightgoldenrodyellow", "var(--bs-dark)"), + RAINBOW: RAINBOW_GRADIENT, + RAINBOW_II: RAINBOW_GRADIENT, + RAINBOW_III: RAINBOW_GRADIENT, + RAINBOW_IV: RAINBOW_GRADIENT, + RAINBOW_EX_I: RAINBOW_EX_GRADIENT, + RAINBOW_EX_II: RAINBOW_EX_GRADIENT, + RAINBOW_EX_III: RAINBOW_EX_GRADIENT, + RAINBOW_EX_IV: RAINBOW_EX_GRADIENT, }, matchingClass: { B5: bgc("green", "var(--bs-light)"), diff --git a/typescript/common/src/config/game-support/chunithm.ts b/typescript/common/src/config/game-support/chunithm.ts index f3de15deb..8679e0548 100644 --- a/typescript/common/src/config/game-support/chunithm.ts +++ b/typescript/common/src/config/game-support/chunithm.ts @@ -27,7 +27,9 @@ export const CHUNITHMColours = [ ClassValue("COPPER", "銅", "Copper: 12 - 13.24 Rating"), ClassValue("SILVER", "銀", "Silver: 13.25 - 14.49 Rating"), ClassValue("GOLD", "金", "Gold: 14.50 - 15.24 Rating"), - ClassValue("PLATINUM", "鉑", "Platinum: 15.25 - 15.99 Rating"), + ClassValue("PLATINUM", "鉑★", "Platinum I: 15.25 - 15.49 Rating"), + ClassValue("PLATINUM_II", "鉑★★", "Platinum II: 15.50 - 15.74 Rating"), + ClassValue("PLATINUM_III", "鉑★★★", "Platinum III: 15.75 - 15.99 Rating"), ClassValue("RAINBOW", "虹★", "Rainbow I: >=16 Rating"), ClassValue("RAINBOW_II", "虹★★", "Rainbow II: >=16.25 Rating"), ClassValue("RAINBOW_III", "虹★★★", "Rainbow III: >=16.5 Rating"), diff --git a/typescript/common/src/config/game-support/maimai-dx.ts b/typescript/common/src/config/game-support/maimai-dx.ts index 571c2697c..bbe131874 100644 --- a/typescript/common/src/config/game-support/maimai-dx.ts +++ b/typescript/common/src/config/game-support/maimai-dx.ts @@ -47,17 +47,26 @@ const MaimaiDXDans = [ ]; const MaimaiDXColours = [ - ClassValue("WHITE", "White", "0 - 999 Rating"), - ClassValue("BLUE", "Blue", "1000 - 1999 Rating"), - ClassValue("GREEN", "Green", "2000 - 3999 Rating"), - ClassValue("YELLOW", "Yellow", "4000 - 6999 Rating"), - ClassValue("RED", "Red", "7000 - 9999 Rating"), - ClassValue("PURPLE", "Purple", "10000 - 11999 Rating"), - ClassValue("BRONZE", "Bronze", "12000 - 12999 Rating"), - ClassValue("SILVER", "Silver", "13000 - 13999 Rating"), - ClassValue("GOLD", "Gold", "14000 - 14499 Rating"), - ClassValue("PLATINUM", "Platinum", "14500 - 14999 Rating"), - ClassValue("RAINBOW", "Rainbow", ">=15000 Rating"), + ClassValue("WHITE", "白", "White: 0 - 999 Rating"), + ClassValue("BLUE", "青", "Blue: 1000 - 1999 Rating"), + ClassValue("GREEN", "緑", "Green: 2000 - 3999 Rating"), + ClassValue("YELLOW", "黄", "Yellow: 4000 - 6999 Rating"), + ClassValue("RED", "赤", "Red: 7000 - 9999 Rating"), + ClassValue("PURPLE", "紫", "Purple: 10000 - 11999 Rating"), + ClassValue("BRONZE", "銅", "Bronze: 12000 - 12999 Rating"), + ClassValue("SILVER", "銀", "Silver: 13000 - 13999 Rating"), + ClassValue("GOLD", "金 ★", "Gold I: 14000 - 14249 Rating"), + ClassValue("GOLD_II", "金 ★★", "Gold II: 14250 - 14499 Rating"), + ClassValue("PLATINUM", "白金 ★", "Platinum I: 14500 - 14749 Rating"), + ClassValue("PLATINUM_II", "白金 ★★", "Platinum II: 14750 - 14999 Rating"), + ClassValue("RAINBOW", "虹 ★", "Rainbow I: 15000 - 15249 Rating"), + ClassValue("RAINBOW_II", "虹 ★★", "Rainbow II: 15250 - 15499 Rating"), + ClassValue("RAINBOW_III", "虹 ★★★", "Rainbow III: 15500 - 15749 Rating"), + ClassValue("RAINBOW_IV", "虹 ★★★★", "Rainbow IV: 15750 - 15999 Rating"), + ClassValue("RAINBOW_EX_I", "虹 (極) ★", "Rainbow Extreme I: 16000 - 16249 Rating"), + ClassValue("RAINBOW_EX_II", "虹 (極) ★★", "Rainbow Extreme II: 16250 - 16499 Rating"), + ClassValue("RAINBOW_EX_III", "虹 (極) ★★★", "Rainbow Extreme III: 16500 - 16749 Rating"), + ClassValue("RAINBOW_EX_IV", "虹 (極) ★★★★", "Rainbow Extreme IV: >=16750 Rating"), ]; const MaimaiDXMatchingClasses = [ diff --git a/typescript/server/src/game-implementations/games/chunithm.test.ts b/typescript/server/src/game-implementations/games/chunithm.test.ts index 06c653deb..37bd2a61a 100644 --- a/typescript/server/src/game-implementations/games/chunithm.test.ts +++ b/typescript/server/src/game-implementations/games/chunithm.test.ts @@ -234,6 +234,8 @@ describe("CHUNITHM_IMPL", () => { c(13.25, "SILVER"); c(14.5, "GOLD"); c(15.25, "PLATINUM"); + c(15.5, "PLATINUM_II"); + c(15.75, "PLATINUM_III"); c(16, "RAINBOW"); c(16.25, "RAINBOW_II"); c(16.5, "RAINBOW_III"); diff --git a/typescript/server/src/game-implementations/games/chunithm.ts b/typescript/server/src/game-implementations/games/chunithm.ts index ca52a698a..8935f7545 100644 --- a/typescript/server/src/game-implementations/games/chunithm.ts +++ b/typescript/server/src/game-implementations/games/chunithm.ts @@ -52,6 +52,10 @@ export const CHUNITHM_IMPL: GameImplementation<"chunithm"> = { return { colour: "RAINBOW_II" }; } else if (rating >= 16) { return { colour: "RAINBOW" }; + } else if (rating >= 15.75) { + return { colour: "PLATINUM_III" }; + } else if (rating >= 15.5) { + return { colour: "PLATINUM_II" }; } else if (rating >= 15.25) { return { colour: "PLATINUM" }; } else if (rating >= 14.5) { diff --git a/typescript/server/src/game-implementations/games/maimaidx.test.ts b/typescript/server/src/game-implementations/games/maimaidx.test.ts index a8be47eb2..2c3b2c7d5 100644 --- a/typescript/server/src/game-implementations/games/maimaidx.test.ts +++ b/typescript/server/src/game-implementations/games/maimaidx.test.ts @@ -139,8 +139,17 @@ describe("MAIMAIDX_IMPL", () => { it("maps rate to colour", () => { c(null, null); c(0, "WHITE"); + c(16750, "RAINBOW_EX_IV"); + c(16500, "RAINBOW_EX_III"); + c(16250, "RAINBOW_EX_II"); + c(16000, "RAINBOW_EX_I"); + c(15750, "RAINBOW_IV"); + c(15500, "RAINBOW_III"); + c(15250, "RAINBOW_II"); c(15000, "RAINBOW"); + c(14750, "PLATINUM_II"); c(14500, "PLATINUM"); + c(14250, "GOLD_II"); c(14000, "GOLD"); c(13000, "SILVER"); c(12000, "BRONZE"); diff --git a/typescript/server/src/game-implementations/games/maimaidx.ts b/typescript/server/src/game-implementations/games/maimaidx.ts index 87735c82b..364831e29 100644 --- a/typescript/server/src/game-implementations/games/maimaidx.ts +++ b/typescript/server/src/game-implementations/games/maimaidx.ts @@ -38,10 +38,28 @@ export const MAIMAIDX_IMPL: GameImplementation<"maimaidx"> = { return { colour: null }; } - if (rate >= 15000) { + if (rate >= 16750) { + return { colour: "RAINBOW_EX_IV" }; + } else if (rate >= 16500) { + return { colour: "RAINBOW_EX_III" }; + } else if (rate >= 16250) { + return { colour: "RAINBOW_EX_II" }; + } else if (rate >= 16000) { + return { colour: "RAINBOW_EX_I" }; + } else if (rate >= 15750) { + return { colour: "RAINBOW_IV" }; + } else if (rate >= 15500) { + return { colour: "RAINBOW_III" }; + } else if (rate >= 15250) { + return { colour: "RAINBOW_II" }; + } else if (rate >= 15000) { return { colour: "RAINBOW" }; + } else if (rate >= 14750) { + return { colour: "PLATINUM_II" }; } else if (rate >= 14500) { return { colour: "PLATINUM" }; + } else if (rate >= 14250) { + return { colour: "GOLD_II" }; } else if (rate >= 14000) { return { colour: "GOLD" }; } else if (rate >= 13000) {