diff --git a/client/src/components/tables/cells/BPICell.tsx b/client/src/components/tables/cells/BPICell.tsx index f20562e54..a218385bd 100644 --- a/client/src/components/tables/cells/BPICell.tsx +++ b/client/src/components/tables/cells/BPICell.tsx @@ -2,59 +2,14 @@ import QuickTooltip from "components/layout/misc/QuickTooltip"; import Divider from "components/util/Divider"; import Muted from "components/util/Muted"; import useUGPTSettings from "components/util/useUGPTSettings"; -import React from "react"; +import { UserContext } from "context/UserContext"; +import React, { useContext } from "react"; import { PoyashiBPI } from "rg-stats"; import { ChartDocument, integer, PBScoreDocument, ScoreDocument } from "tachi-common"; import { GetGradeFromPercent, IsNullish } from "util/misc"; import MiniTable from "../components/MiniTable"; import DeltaCell from "./DeltaCell"; import ScoreCell from "./ScoreCell"; -// import { BPI_COLOURS } from "util/constants/colours"; - -// tried it - doesn't look good. - zkldi -// import colorInterpolate from "color-interpolate"; - -// const scale = colorInterpolate([ -// BPI_COLOURS.ZERO, -// BPI_COLOURS.TEN, -// BPI_COLOURS.TWENTY, -// BPI_COLOURS.THIRTY, -// BPI_COLOURS.FOURTY, -// BPI_COLOURS.FIFTY, -// BPI_COLOURS.SIXTY, -// BPI_COLOURS.SEVENTY, -// BPI_COLOURS.EIGHTY, -// BPI_COLOURS.NINETY, -// BPI_COLOURS.MAX, -// ]); - -// function GetColor(bpi: number) { -// if (bpi < 0) { -// return BPI_COLOURS.NEGATIVE; -// } else if (bpi < 10) { -// return BPI_COLOURS.ZERO; -// } else if (bpi < 20) { -// return BPI_COLOURS.TEN; -// } else if (bpi < 30) { -// return BPI_COLOURS.TWENTY; -// } else if (bpi < 40) { -// return BPI_COLOURS.THIRTY; -// } else if (bpi < 50) { -// return BPI_COLOURS.FOURTY; -// } else if (bpi < 60) { -// return BPI_COLOURS.FIFTY; -// } else if (bpi < 70) { -// return BPI_COLOURS.SIXTY; -// } else if (bpi < 80) { -// return BPI_COLOURS.SEVENTY; -// } else if (bpi < 90) { -// return BPI_COLOURS.EIGHTY; -// } else if (bpi < 100) { -// return BPI_COLOURS.NINETY; -// } else { -// return BPI_COLOURS.MAX; -// } -// } export default function BPICell({ score, @@ -63,6 +18,7 @@ export default function BPICell({ score: ScoreDocument<"iidx:SP" | "iidx:DP"> | PBScoreDocument<"iidx:SP" | "iidx:DP">; chart: ChartDocument<"iidx:SP" | "iidx:DP">; }) { + const { user } = useContext(UserContext); const { settings } = useUGPTSettings<"iidx:SP" | "iidx:DP">(); const bpi = score.calculatedData.BPI; @@ -72,6 +28,7 @@ export default function BPICell({ return N/A; } + const isRequestingUser = user?.id === score.userID; const bpiTarget = settings?.preferences.gameSpecific.bpiTarget ?? 0; let bpiTargetScore = 0; let targetDelta: number | null = 0; @@ -92,7 +49,6 @@ export default function BPICell({ } const kavgDelta = score.scoreData.score - kaidenAverage!; - const wrDelta = score.scoreData.score - worldRecord!; const { score: WRAverageCell, delta: WRDeltaCell } = FormatAverage( worldRecord!, @@ -126,12 +82,12 @@ export default function BPICell({ ]} > - {TGAverageCell} + {isRequestingUser ? TGAverageCell : null} {KDAverageCell} {WRAverageCell} - {TGDeltaCell} + {isRequestingUser ? TGDeltaCell : null} {KDDeltaCell} {WRDeltaCell} @@ -154,19 +110,23 @@ export default function BPICell({
- - {bpiTarget !== 0 && ( + {isRequestingUser ? ( + <> + + {bpiTarget !== 0 && ( + <> +
+ + 皆伝{kavgDelta < 0 ? kavgDelta : `+${kavgDelta}`} + + + )} + + ) : ( <> -
皆伝{kavgDelta < 0 ? kavgDelta : `+${kavgDelta}`} )} - {/* {bpiTarget !== 100 && ( - <> -
- WR{wrDelta < 0 ? wrDelta : `+${wrDelta}`} - - )} */}
diff --git a/client/src/components/tables/cells/JubeatJudgementCell.tsx b/client/src/components/tables/cells/JubeatJudgementCell.tsx index 3b2c28a9f..3aee5c3c0 100644 --- a/client/src/components/tables/cells/JubeatJudgementCell.tsx +++ b/client/src/components/tables/cells/JubeatJudgementCell.tsx @@ -12,6 +12,7 @@ export default function JubeatJudgementCell({ return ( + 0- 0- 0- 0- @@ -21,18 +22,14 @@ export default function JubeatJudgementCell({ ); } - // safety - if (score.scoreData.lamp === "FULL COMBO") { - score.scoreData.judgements.miss = 0; - } - const judgements = score.scoreData.judgements; if ( IsNullish(judgements.miss) || IsNullish(judgements.great) || IsNullish(judgements.good) || - IsNullish(judgements.poor) + IsNullish(judgements.poor) || + IsNullish(judgements.perfect) ) { return No Data.; } @@ -40,6 +37,7 @@ export default function JubeatJudgementCell({ return ( + {judgements.perfect}- {judgements.great}- {judgements.good}- {judgements.poor}- diff --git a/client/src/components/tables/cells/MusecaJudgementCell.tsx b/client/src/components/tables/cells/MusecaJudgementCell.tsx index f56bd3b03..1aba1184b 100644 --- a/client/src/components/tables/cells/MusecaJudgementCell.tsx +++ b/client/src/components/tables/cells/MusecaJudgementCell.tsx @@ -19,11 +19,6 @@ export default function MusecaJudgementCell({ ); } - // safety - if (score.scoreData.lamp === "CONNECT ALL") { - score.scoreData.judgements.miss = 0; - } - const judgements = score.scoreData.judgements; if (IsNullish(judgements.miss) || IsNullish(judgements.near)) { diff --git a/client/src/components/tables/cells/PopnJudgementCell.tsx b/client/src/components/tables/cells/PopnJudgementCell.tsx index a64d61b02..8b6f49164 100644 --- a/client/src/components/tables/cells/PopnJudgementCell.tsx +++ b/client/src/components/tables/cells/PopnJudgementCell.tsx @@ -9,13 +9,19 @@ export default function PopnJudgementCell({ }) { const judgements = score.scoreData.judgements; - if (IsNullish(judgements.bad) || IsNullish(judgements.great) || IsNullish(judgements.good)) { + if ( + IsNullish(judgements.bad) || + IsNullish(judgements.great) || + IsNullish(judgements.good) || + IsNullish(judgements.cool) + ) { return No Data.; } return ( + {judgements.cool}- {judgements.great}- {judgements.good}- {judgements.bad} diff --git a/client/src/components/tables/cells/SDVXJudgementCell.tsx b/client/src/components/tables/cells/SDVXJudgementCell.tsx index 3b68e2b18..dd8412675 100644 --- a/client/src/components/tables/cells/SDVXJudgementCell.tsx +++ b/client/src/components/tables/cells/SDVXJudgementCell.tsx @@ -19,11 +19,6 @@ export default function SDVXJudgementCell({ ); } - // safety - if (score.scoreData.lamp === "ULTIMATE CHAIN") { - score.scoreData.judgements.miss = 0; - } - const judgements = score.scoreData.judgements; if (IsNullish(judgements.miss) || IsNullish(judgements.near)) { diff --git a/client/src/components/tables/cells/VF6Cell.tsx b/client/src/components/tables/cells/VF6Cell.tsx index 60652997d..ec95898e3 100644 --- a/client/src/components/tables/cells/VF6Cell.tsx +++ b/client/src/components/tables/cells/VF6Cell.tsx @@ -1,5 +1,6 @@ import useUGPTSettings from "components/util/useUGPTSettings"; -import React from "react"; +import { UserContext } from "context/UserContext"; +import React, { useContext } from "react"; import { Volforce } from "rg-stats"; import { ChartDocument, GetGamePTConfig, PBScoreDocument, ScoreDocument } from "tachi-common"; import { IsNullish } from "util/misc"; @@ -19,6 +20,7 @@ export default function VF6Cell({ score: ScoreDocument | PBScoreDocument; chart: ChartDocument; }) { + const { user } = useContext(UserContext); const { settings } = useUGPTSettings(); if (IsNullish(score.calculatedData.VF6)) { @@ -31,7 +33,7 @@ export default function VF6Cell({ const targets: Record = {}; - if (vf6Target) { + if (vf6Target && score.userID === user?.id) { for (const lamp of ["CLEAR", "EXCESSIVE CLEAR", "ULTIMATE CHAIN"] as const) { if (score.scoreData.lampIndex <= gptConfig.lamps.indexOf(lamp)) { const expectedScore = InverseVF6(vf6Target, lamp, chart.levelNum); diff --git a/client/src/components/tables/cells/WACCAJudgementCell.tsx b/client/src/components/tables/cells/WACCAJudgementCell.tsx index e335120f7..c7d30dd4f 100644 --- a/client/src/components/tables/cells/WACCAJudgementCell.tsx +++ b/client/src/components/tables/cells/WACCAJudgementCell.tsx @@ -12,6 +12,7 @@ export default function WaccaJudgementCell({ return ( + 0- 0- 0- 0 @@ -20,20 +21,21 @@ export default function WaccaJudgementCell({ ); } - // safety - if (score.scoreData.lamp === "FULL COMBO") { - score.scoreData.judgements.miss = 0; - } - const judgements = score.scoreData.judgements; - if (IsNullish(judgements.miss) || IsNullish(judgements.great) || IsNullish(judgements.good)) { + if ( + IsNullish(judgements.miss) || + IsNullish(judgements.great) || + IsNullish(judgements.good) || + IsNullish(judgements.marvelous) + ) { return No Data.; } return ( + {judgements.marvelous}- {judgements.great}- {judgements.good}- {judgements.miss} diff --git a/client/src/components/tables/headers/GameHeaders.tsx b/client/src/components/tables/headers/GameHeaders.tsx index b04184b7d..5a32d822f 100644 --- a/client/src/components/tables/headers/GameHeaders.tsx +++ b/client/src/components/tables/headers/GameHeaders.tsx @@ -97,7 +97,6 @@ export function GetGPTCoreHeaders kMapToScoreOrPB(x)?.scoreData.percent ?? -Infinity), + ], + [ + "Lamp", + "Lamp", + (a, b) => { + const aSc = kMapToScoreOrPB(a) as + | ScoreDocument<"popn:9B"> + | PBScoreDocument<"popn:9B">; + const bSc = kMapToScoreOrPB(b) as + | ScoreDocument<"popn:9B"> + | PBScoreDocument<"popn:9B">; + + if (!aSc || !bSc) { + return -Infinity; + } + + if (aSc.scoreData.lampIndex === bSc.scoreData.lampIndex) { + if ( + !aSc.scoreData.hitMeta.specificClearType || + !bSc.scoreData.hitMeta.specificClearType + ) { + return -Infinity; + } + + return ( + popnClearTypeToInt[aSc.scoreData.hitMeta.specificClearType] - + popnClearTypeToInt[bSc.scoreData.hitMeta.specificClearType] + ); + } + + return aSc.scoreData.lampIndex - bSc.scoreData.lampIndex; + }, + ], + RatingHeader, + ]; } } + +const popnClearTypeToInt = { + failedCircle: 0, + failedDiamond: 1, + failedStar: 2, + easyClear: 3, + clearCircle: 4, + clearDiamond: 5, + clearStar: 6, + fullComboCircle: 7, + fullComboDiamond: 8, + fullComboStar: 9, + perfect: 10, +} as const;