mirror of
https://github.com/zkldi/Tachi.git
synced 2026-09-30 19:07:58 +03:00
feat: itg looking good now
This commit is contained in:
@@ -27,6 +27,7 @@ import React, { useContext, useEffect, useState } from "react";
|
||||
import { Col, Row } from "react-bootstrap";
|
||||
import { Redirect, Route, Switch, useParams } from "react-router-dom";
|
||||
import {
|
||||
COLOUR_SET,
|
||||
ChartDocument,
|
||||
FormatDifficulty,
|
||||
Game,
|
||||
@@ -294,7 +295,8 @@ function SongInfoHeader({
|
||||
/>
|
||||
);
|
||||
} else if (game === "itg") {
|
||||
const banner = (song as SongDocument<"itg">).data.originalPack;
|
||||
const itgChart = charts[0] as ChartDocument<"itg:Stamina">;
|
||||
const banner = itgChart?.data.bannerLocationOverride ?? itgChart?.data.originalPack;
|
||||
|
||||
if (banner) {
|
||||
setImageCell(
|
||||
@@ -379,6 +381,15 @@ type Props = { song: SongDocument } & {
|
||||
setActiveChart: SetState<ChartDocument | null>;
|
||||
} & GamePT;
|
||||
|
||||
const ITG_COLOUR_LOOKUP = {
|
||||
Beginner: COLOUR_SET.paleBlue,
|
||||
Easy: COLOUR_SET.green,
|
||||
Medium: COLOUR_SET.vibrantYellow,
|
||||
Hard: COLOUR_SET.red,
|
||||
Expert: COLOUR_SET.pink,
|
||||
Edit: COLOUR_SET.gray,
|
||||
};
|
||||
|
||||
function DifficultyButton({
|
||||
chart,
|
||||
game,
|
||||
@@ -404,6 +415,12 @@ function DifficultyButton({
|
||||
gptImpl.difficultyColours[diffTag],
|
||||
activeChart?.chartID === chart.chartID ? 0.4 : 0.2
|
||||
)
|
||||
: game === "itg"
|
||||
? ChangeOpacity(
|
||||
// @ts-expect-error hack!
|
||||
ITG_COLOUR_LOOKUP[chart.data.difficultyTag],
|
||||
activeChart?.chartID === chart.chartID ? 0.4 : 0.2
|
||||
)
|
||||
: undefined,
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
import { ChangeOpacity } from "util/color-opacity";
|
||||
import { ONE_MINUTE } from "util/constants/time";
|
||||
import QuickTooltip from "components/layout/misc/QuickTooltip";
|
||||
import Muted from "components/util/Muted";
|
||||
import React from "react";
|
||||
import { ChartDocument, COLOUR_SET } from "tachi-common";
|
||||
import Divider from "components/util/Divider";
|
||||
import Icon from "components/util/Icon";
|
||||
import Muted from "components/util/Muted";
|
||||
import React from "react";
|
||||
import { COLOUR_SET, ChartDocument } from "tachi-common";
|
||||
import MiniTable from "../components/MiniTable";
|
||||
import RatingSystemPart from "./RatingSystemPart";
|
||||
|
||||
const COLOUR_LOOKUP = {
|
||||
Beginner: COLOUR_SET.paleBlue,
|
||||
@@ -90,14 +88,14 @@ export default function ITGDifficultyCell({ chart }: { chart: ChartDocument<"itg
|
||||
}
|
||||
>
|
||||
<div>
|
||||
<span style={{ fontSize: "1.05rem" }}>
|
||||
<span>
|
||||
{chart.data.difficultyTag} {levelStr} [
|
||||
{chart.data.streamBPM?.toFixed() ?? "???"}]
|
||||
</span>
|
||||
<br />
|
||||
<Muted>{chart.data.charter}</Muted>
|
||||
<br />
|
||||
<span>{breakdown}</span>
|
||||
<span style={{ fontSize: "0.9rem" }}>{breakdown}</span>
|
||||
{chart.data.length > 60 * 16 && (
|
||||
<>
|
||||
<br />
|
||||
|
||||
@@ -4,7 +4,9 @@
|
||||
*/
|
||||
export function ChangeOpacity(str: string, opacity: number) {
|
||||
if (!str) {
|
||||
throw new Error(`Str given to ChangeOpacity was undefined.`);
|
||||
return "#000000";
|
||||
|
||||
// throw new Error(`Str given to ChangeOpacity was undefined.`);
|
||||
}
|
||||
|
||||
if (str.startsWith("#")) {
|
||||
|
||||
@@ -34,7 +34,9 @@ export function FormatDifficulty(chart: ChartDocument, game: Game): string {
|
||||
if (game === "itg") {
|
||||
const itgChart = chart as ChartDocument<"itg:Stamina">;
|
||||
|
||||
return `${itgChart.data.difficultyTag} ${itgChart.level}`;
|
||||
const level = itgChart.data.rankedLevel ?? `${itgChart.data.chartLevel}?`;
|
||||
|
||||
return `${itgChart.data.charter} ${itgChart.data.difficultyTag} ${level}`;
|
||||
}
|
||||
|
||||
if (game === "gitadora") {
|
||||
@@ -158,9 +160,11 @@ export function FormatChart(
|
||||
const itgChart = chart as ChartDocument<"itg:Stamina">;
|
||||
const itgSong = song as SongDocument<"itg">;
|
||||
|
||||
const level = itgChart.data.rankedLevel ?? `${itgChart.data.chartLevel}?`;
|
||||
|
||||
return `${itgSong.title}${itgSong.data.subtitle ? ` ${itgSong.data.subtitle}` : ""} ${
|
||||
itgChart.data.difficultyTag
|
||||
} ${chart.level}`;
|
||||
} ${level}`;
|
||||
}
|
||||
|
||||
const gameConfig = GetGameConfig(game);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@ for (let i = 1; i < 40; i++) {
|
||||
{
|
||||
type: "charts",
|
||||
data: {
|
||||
"data.rankedLevel": i,
|
||||
"data¬rankedLevel": i,
|
||||
},
|
||||
title: `Level ${i} Ranked`,
|
||||
game: "itg",
|
||||
@@ -18,7 +18,7 @@ for (let i = 1; i < 40; i++) {
|
||||
{
|
||||
type: "charts",
|
||||
data: {
|
||||
"data.chartLevel": i,
|
||||
"data¬chartLevel": i,
|
||||
},
|
||||
title: `Level ${i} (w/ Unranked)`,
|
||||
game: "itg",
|
||||
@@ -29,8 +29,8 @@ for (let i = 1; i < 40; i++) {
|
||||
{
|
||||
type: "charts",
|
||||
data: {
|
||||
"data.rankedLevel": i,
|
||||
"data.length": { $gte: 60 * 16 },
|
||||
"data¬rankedLevel": i,
|
||||
"data¬length": { "~gte": 60 * 16 },
|
||||
},
|
||||
title: `Level ${i} (Ranked Marathons)`,
|
||||
game: "itg",
|
||||
@@ -41,8 +41,8 @@ for (let i = 1; i < 40; i++) {
|
||||
{
|
||||
type: "charts",
|
||||
data: {
|
||||
"data.chartLevel": i,
|
||||
"data.length": { $gte: 60 * 16 },
|
||||
"data¬chartLevel": i,
|
||||
"data¬length": { "~gte": 60 * 16 },
|
||||
},
|
||||
title: `Level ${i} (Ranked Marathons)`,
|
||||
game: "itg",
|
||||
@@ -69,7 +69,7 @@ MutateCollection("tables.json", (tbls) => {
|
||||
title: `ITG Stamina Ranked`,
|
||||
description: `Ranked charts for ITG. These are more reliably accurately rated than trusting what the charter thinks.`,
|
||||
folders: folders
|
||||
.filter((e) => "data.rankedLevel" in e.data && !("data.length" in e.data))
|
||||
.filter((e) => "data¬rankedLevel" in e.data && !("data¬length" in e.data))
|
||||
.map((e) => e.folderID),
|
||||
inactive: false,
|
||||
default: true,
|
||||
@@ -82,7 +82,7 @@ MutateCollection("tables.json", (tbls) => {
|
||||
title: `ITG Stamina (w/ Unranked)`,
|
||||
description: `All charts for ITG. These may not be accurately rated.`,
|
||||
folders: folders
|
||||
.filter((e) => "data.chartLevel" in e.data && !("data.length" in e.data))
|
||||
.filter((e) => "data¬chartLevel" in e.data && !("data¬length" in e.data))
|
||||
.map((e) => e.folderID),
|
||||
inactive: false,
|
||||
default: false,
|
||||
@@ -95,7 +95,7 @@ MutateCollection("tables.json", (tbls) => {
|
||||
title: `ITG Stamina Ranked Marathons`,
|
||||
description: `Ranked marathons for ITG. These are more reliably accurately rated than trusting what the charter thinks.`,
|
||||
folders: folders
|
||||
.filter((e) => "data.rankedLevel" in e.data && "data.length" in e.data)
|
||||
.filter((e) => "data¬rankedLevel" in e.data && "data¬length" in e.data)
|
||||
.map((e) => e.folderID),
|
||||
inactive: false,
|
||||
default: true,
|
||||
@@ -108,7 +108,7 @@ MutateCollection("tables.json", (tbls) => {
|
||||
title: `ITG Stamina Marathons (w/ Unranked)`,
|
||||
description: `All marathons for ITG. These may not be accurately rated.`,
|
||||
folders: folders
|
||||
.filter((e) => "data.chartLevel" in e.data && "data.length" in e.data)
|
||||
.filter((e) => "data¬chartLevel" in e.data && "data¬length" in e.data)
|
||||
.map((e) => e.folderID),
|
||||
inactive: false,
|
||||
default: false,
|
||||
|
||||
@@ -96,16 +96,6 @@ for (const d of content) {
|
||||
// leading space into a number is likely a breakdown. remove it.
|
||||
const author = chart.credit.replace(/ [1-9].*$/u, "");
|
||||
|
||||
let preferredBD = null;
|
||||
|
||||
if (chart.breakdown) {
|
||||
if (chart.breakdown.simplified.length < 16) {
|
||||
preferredBD = chart.breakdown.simplified;
|
||||
} else {
|
||||
preferredBD = `${chart.breakdown.total} Total`;
|
||||
}
|
||||
}
|
||||
|
||||
if (difficultyTag === "Challenge") {
|
||||
difficultyTag = "Expert";
|
||||
}
|
||||
@@ -116,7 +106,7 @@ for (const d of content) {
|
||||
level: "?",
|
||||
levelNum: 0, // do not use, should b removed
|
||||
isPrimary: true,
|
||||
difficulty: `${author} ${difficultyTag}${preferredBD ? ` ${preferredBD}` : ""}`,
|
||||
difficulty: chart.hashGSv3,
|
||||
playtype: "Stamina",
|
||||
versions: [],
|
||||
data: {
|
||||
|
||||
@@ -158,6 +158,7 @@ const syncInstructions: Array<SyncInstructions> = [
|
||||
|
||||
await RecalcAllScores({
|
||||
chartID: { $in: r.changedFields },
|
||||
game: collectionName.split("-")[0],
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -167,7 +168,8 @@ const syncInstructions: Array<SyncInstructions> = [
|
||||
handler: async (
|
||||
charts: Array<ChartDocument>,
|
||||
collection: ICollection<ChartDocument>,
|
||||
logger
|
||||
logger,
|
||||
collName
|
||||
) => {
|
||||
const r = await GenericUpsert(charts, collection, "chartID", logger, true);
|
||||
|
||||
@@ -177,6 +179,7 @@ const syncInstructions: Array<SyncInstructions> = [
|
||||
|
||||
await RecalcAllScores({
|
||||
chartID: { $in: r.changedFields },
|
||||
game: collName.split("-")[0],
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -186,13 +189,15 @@ const syncInstructions: Array<SyncInstructions> = [
|
||||
handler: async (
|
||||
songs: Array<SongDocument>,
|
||||
collection: ICollection<SongDocument>,
|
||||
logger
|
||||
logger,
|
||||
collName
|
||||
) => {
|
||||
const r = await GenericUpsert(songs, collection, "id", logger, false);
|
||||
|
||||
if (r.thingsChanged) {
|
||||
await RecalcAllScores({
|
||||
songID: { $in: r.changedFields },
|
||||
game: collName.split("-")[0],
|
||||
});
|
||||
}
|
||||
},
|
||||
@@ -202,13 +207,15 @@ const syncInstructions: Array<SyncInstructions> = [
|
||||
handler: async (
|
||||
songs: Array<SongDocument>,
|
||||
collection: ICollection<SongDocument>,
|
||||
logger
|
||||
logger,
|
||||
collName
|
||||
) => {
|
||||
const r = await GenericUpsert(songs, collection, "id", logger, true);
|
||||
|
||||
if (r.thingsChanged) {
|
||||
await RecalcAllScores({
|
||||
songID: { $in: r.changedFields },
|
||||
game: collName.split("-")[0],
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user