Skip to content

Commit

Permalink
feat: DDR Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
Gyoo committed Aug 7, 2024
1 parent 1154728 commit 66e9b64
Show file tree
Hide file tree
Showing 26 changed files with 149,110 additions and 37 deletions.
2 changes: 1 addition & 1 deletion client/example/.env
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ TACHI_NAME="Tachi Local Dev"

# turn this off if you're on linux for actually good performance
# this needs to be on for windows because lol lmao
FORCE_FS_POLLING="true"
FORCE_FS_POLLING="true"
2 changes: 2 additions & 0 deletions client/src/components/gpt-utils/GPTUtils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ const GPT_UTILS: Record<GPTString, Array<GPTUtility>> = {
"maimaidx:Single": [],
"maimai:Single": [],
"ongeki:Single": [],
"ddr:SP": [],
"ddr:DP": [],
};

export function GetGPTUtils(game: Game, playtype: Playtype) {
Expand Down
28 changes: 28 additions & 0 deletions client/src/components/tables/cells/DDRScoreCell.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { ChangeOpacity } from "util/color-opacity";
import React from "react";
import { integer } from "tachi-common";

export default function DDRScoreCell({
score,
colour,
grade,
scoreRenderFn,
}: {
score?: integer;
grade: string;
colour: string;
showScore?: boolean;
scoreRenderFn?: (s: number) => string;
}) {
return (
<td
style={{
backgroundColor: ChangeOpacity(colour, 0.2),
}}
>
<strong>{grade}</strong>
<br />
{score !== undefined && <>{scoreRenderFn ? scoreRenderFn(score) : score}</>}
</td>
);
}
3 changes: 3 additions & 0 deletions client/src/lib/game-implementations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { GPTClientImplementation } from "./types";
import { SDVX_IMPL, USC_IMPL } from "./games/sdvx-usc";
import { GITADORA_DORA_IMPL, GITADORA_GITA_IMPL } from "./games/gitadora";
import { ARCAEA_TOUCH_IMPL } from "./games/arcaea";
import { DDR_DP_IMPL, DDR_SP_IMPL } from "./games/ddr";

type GPTClientImplementations = {
[GPT in GPTString]: GPTClientImplementation<GPT>;
Expand All @@ -40,6 +41,8 @@ const defaultEnumIcons = {
export const GPT_CLIENT_IMPLEMENTATIONS: GPTClientImplementations = {
"iidx:SP": IIDX_SP_IMPL,
"iidx:DP": IIDX_DP_IMPL,
"ddr:SP": DDR_SP_IMPL,
"ddr:DP": DDR_DP_IMPL,
"chunithm:Single": {
sessionImportantScoreCount: 30,
enumIcons: defaultEnumIcons,
Expand Down
154 changes: 154 additions & 0 deletions client/src/lib/games/ddr.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
import { NumericSOV } from "util/sorts";
import { GPTClientImplementation } from "lib/types";
import { COLOUR_SET, GPTStrings } from "tachi-common";
import ScoreCell from "components/tables/cells/ScoreCell";
import { GetEnumColour } from "lib/game-implementations";
import React from "react";
import RatingCell from "components/tables/cells/RatingCell";
import LampCell from "../../components/tables/cells/LampCell";
import DDRScoreCell from "../../components/tables/cells/DDRScoreCell";
import { bg, bgc } from "./_util";

const DDR_ENUM_COLOURS: GPTClientImplementation<GPTStrings["ddr"]>["enumColours"] = {
grade: {
E: COLOUR_SET.gray,
D: COLOUR_SET.paleBlue,
"D+": COLOUR_SET.paleBlue,
"C-": COLOUR_SET.purple,
C: COLOUR_SET.purple,
"C+": COLOUR_SET.purple,
"B-": COLOUR_SET.blue,
B: COLOUR_SET.blue,
"B+": COLOUR_SET.blue,
"A-": COLOUR_SET.gold,
A: COLOUR_SET.gold,
"A+": COLOUR_SET.gold,
"AA-": COLOUR_SET.gold,
AA: COLOUR_SET.gold,
"AA+": COLOUR_SET.gold,
AAA: COLOUR_SET.teal,
},
lamp: {
FAILED: COLOUR_SET.maroon,
ASSIST: COLOUR_SET.purple,
CLEAR: COLOUR_SET.blue,
"FULL COMBO": COLOUR_SET.vibrantBlue,
"GREAT FULL COMBO": COLOUR_SET.vibrantGreen,
"PERFECT FULL COMBO": COLOUR_SET.gold,
"MARVELOUS FULL COMBO": COLOUR_SET.pink,
LIFE4: COLOUR_SET.vibrantRed,
},
};

const DDR_DIFF_COLOURS: GPTClientImplementation<GPTStrings["ddr"]>["difficultyColours"] = {
BEGINNER: COLOUR_SET.blue,
BASIC: COLOUR_SET.paleGreen,
DIFFICULT: COLOUR_SET.red,
EXPERT: COLOUR_SET.vibrantYellow,
CHALLENGE: COLOUR_SET.purple,
};

const DDR_HEADERS: GPTClientImplementation<"ddr:SP" | "ddr:DP">["scoreHeaders"] = [
["Score", "Score", NumericSOV((x) => x.scoreData.score)],
["Lamp", "Lamp", NumericSOV((x) => x.scoreData.enumIndexes.lamp)],
];

const DDR_COLOURS: GPTClientImplementation<"ddr:SP" | "ddr:DP">["classColours"] = {
flare: {
NONE: bg("gray"),
"NONE+": bg("gray"),
"NONE++": bg("gray"),
"NONE+++": bg("gray"),
MERCURY: bg("blue"),
"MERCURY+": bg("blue"),
"MERCURY++": bg("blue"),
"MERCURY+++": bg("blue"),
VENUS: bgc("yellow", "black"),
"VENUS+": bgc("yellow", "black"),
"VENUS++": bgc("yellow", "black"),
"VENUS+++": bgc("yellow", "black"),
EARTH: bg("forestgreen"),
"EARTH+": bg("forestgreen"),
"EARTH++": bg("forestgreen"),
"EARTH+++": bg("forestgreen"),
MARS: bg("red"),
"MARS+": bg("red"),
"MARS++": bg("red"),
"MARS+++": bg("red"),
JUPITER: bg("darkgreen"),
"JUPITER+": bg("darkgreen"),
"JUPITER++": bg("darkgreen"),
"JUPITER+++": bg("darkgreen"),
SATURN: bg("purple"),
"SATURN+": bg("purple"),
"SATURN++": bg("purple"),
"SATURN+++": bg("purple"),
URANUS: bgc("powderblue", "black"),
"URANUS+": bgc("powderblue", "black"),
"URANUS++": bgc("powderblue", "black"),
"URANUS+++": bgc("powderblue", "black"),
NEPTUNE: bg("darkslateblue"),
"NEPTUNE+": bg("darkslateblue"),
"NEPTUNE++": bg("darkslateblue"),
"NEPTUNE+++": bg("darkslateblue"),
SUN: bg("orange"),
"SUN+": bg("orange"),
"SUN++": bg("orange"),
"SUN+++": bg("orange"),
WORLD: bg("black"),
},
};

const DDRCoreCells: GPTClientImplementation<GPTStrings["ddr"]>["scoreCoreCells"] = ({
sc,
chart,
}) => (
<>
<DDRScoreCell
colour={GetEnumColour(sc, "grade")}
grade={sc.scoreData.grade}
score={sc.scoreData.score}
/>
<LampCell lamp={sc.scoreData.lamp} colour={GetEnumColour(sc, "lamp")} />
</>
);

const DDRRatingCell: GPTClientImplementation<GPTStrings["ddr"]>["ratingCell"] = ({
sc,
chart,
rating,
}) => (
<>
<RatingCell rating={rating} score={sc} />
</>
);

export const DDR_SP_IMPL: GPTClientImplementation<"ddr:SP"> = {
sessionImportantScoreCount: 20,
difficultyColours: DDR_DIFF_COLOURS,
enumColours: DDR_ENUM_COLOURS,
enumIcons: {
grade: "sort-alpha-up",
lamp: "lightbulb",
},
ratingSystems: [],
scoreHeaders: DDR_HEADERS,
classColours: DDR_COLOURS,
scoreCoreCells: DDRCoreCells,
ratingCell: DDRRatingCell,
};

export const DDR_DP_IMPL: GPTClientImplementation<"ddr:DP"> = {
sessionImportantScoreCount: 20,
difficultyColours: DDR_DIFF_COLOURS,
enumColours: DDR_ENUM_COLOURS,
enumIcons: {
grade: "sort-alpha-up",
lamp: "lightbulb",
},
ratingSystems: [],
scoreHeaders: DDR_HEADERS,
classColours: DDR_COLOURS,
scoreCoreCells: DDRCoreCells,
ratingCell: DDRRatingCell,
};
4 changes: 4 additions & 0 deletions common/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { ARCAEA_CONF, ARCAEA_TOUCH_CONF } from "./game-support/arcaea";
import { BMS_14K_CONF, BMS_7K_CONF, BMS_CONF } from "./game-support/bms";
import { CHUNITHM_CONF, CHUNITHM_SINGLE_CONF } from "./game-support/chunithm";
import { DDR_CONF, DDR_DP_CONF, DDR_SP_CONF } from "./game-support/ddr";
import { GITADORA_CONF, GITADORA_DORA_CONF, GITADORA_GITA_CONF } from "./game-support/gitadora";
import { IIDX_CONF, IIDX_DP_CONF, IIDX_SP_CONF } from "./game-support/iidx";
import { ITG_CONF, ITG_STAMINA_CONF } from "./game-support/itg";
Expand Down Expand Up @@ -50,6 +51,7 @@ export const GAME_CONFIGS = {
itg: ITG_CONF,
arcaea: ARCAEA_CONF,
ongeki: ONGEKI_CONF,
ddr: DDR_CONF,
} as const satisfies Record<string, INTERNAL_GAME_CONFIG>;

/**
Expand Down Expand Up @@ -98,6 +100,8 @@ export const GAME_PT_CONFIGS = {
"itg:Stamina": ITG_STAMINA_CONF,
"arcaea:Touch": ARCAEA_TOUCH_CONF,
"ongeki:Single": ONGEKI_SINGLE_CONF,
"ddr:SP": DDR_SP_CONF,
"ddr:DP": DDR_DP_CONF,
} as const satisfies Record<GPTString, INTERNAL_GAME_PT_CONFIG>;

/**
Expand Down
Loading

0 comments on commit 66e9b64

Please sign in to comment.