Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDR Implementation #1132

Merged
merged 4 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
4 changes: 2 additions & 2 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"react-router-bootstrap": "^0.25.0",
"react-router-dom": "5.1.2",
"react-select": "^5.6.1",
"rg-stats": "0.5.6",
"rg-stats": "0.5.8",
"sync-fetch": "^0.3.1",
"tachi-common": "workspace:../common",
"vite-plugin-html": "^3.2.0"
Expand All @@ -91,4 +91,4 @@
"node": "20",
"pnpm": "8"
}
}
}
1 change: 1 addition & 0 deletions client/src/app/pages/dashboard/import/ImportPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ function InputAlert({ game }: { game: Game }) {
case "popn":
case "wacca":
case "ongeki":
case "ddr":
return (
<>
<strong>Scores must be achieved on an arcade-size controller!</strong>
Expand Down
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
@@ -1,14 +1,15 @@
/* eslint-disable lines-around-comment */

import { ARCAEA_CONF, ARCAEA_TOUCH_CONF } from "./game-support/arcaea";

Check warning on line 3 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { BMS_14K_CONF, BMS_7K_CONF, BMS_CONF } from "./game-support/bms";

Check warning on line 4 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { CHUNITHM_CONF, CHUNITHM_SINGLE_CONF } from "./game-support/chunithm";

Check warning on line 5 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { DDR_CONF, DDR_DP_CONF, DDR_SP_CONF } from "./game-support/ddr";

Check warning on line 6 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { GITADORA_CONF, GITADORA_DORA_CONF, GITADORA_GITA_CONF } from "./game-support/gitadora";

Check warning on line 7 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { IIDX_CONF, IIDX_DP_CONF, IIDX_SP_CONF } from "./game-support/iidx";

Check warning on line 8 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { ITG_CONF, ITG_STAMINA_CONF } from "./game-support/itg";

Check warning on line 9 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:1
import { JUBEAT_CONF, JUBEAT_SINGLE_CONF } from "./game-support/jubeat";

Check warning on line 10 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { MAIMAI_CONF, MAIMAI_SINGLE_CONF } from "./game-support/maimai";

Check warning on line 11 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { MAIMAI_DX_CONF, MAIMAI_DX_SINGLE_CONF } from "./game-support/maimai-dx";

Check warning on line 12 in common/src/config/config.ts

View workflow job for this annotation

GitHub Actions / test

Dependency cycle via ../../utils/util:2
import { MUSECA_CONF, MUSECA_SINGLE_CONF } from "./game-support/museca";
import { ONGEKI_CONF, ONGEKI_SINGLE_CONF } from "./game-support/ongeki";
import { PMS_CONF, PMS_CONTROLLER_CONF, PMS_KEYBOARD_CONF } from "./game-support/pms";
Expand Down Expand Up @@ -50,6 +51,7 @@
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 @@
"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
Loading