From 506103c4c56899e6d44ab696ac5e643f1766425b Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 14 Feb 2022 06:49:44 +0000 Subject: [PATCH 1/6] Fix #97 --- .../src/components/tables/cells/BPICell.tsx | 78 +++++-------------- .../src/components/tables/cells/VF6Cell.tsx | 6 +- 2 files changed, 23 insertions(+), 61 deletions(-) diff --git a/client/src/components/tables/cells/BPICell.tsx b/client/src/components/tables/cells/BPICell.tsx index f873a516c..09f1d9ea0 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/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); From b878a04006aea68487048191e9f51d10807ba7e8 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 14 Feb 2022 07:01:06 +0000 Subject: [PATCH 2/6] Sort on sub-clear for popn if available --- .../components/tables/headers/GameHeaders.tsx | 57 ++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) 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; From cb5f6e87467cab001f082dc301cd4cfeca4914d5 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 14 Feb 2022 07:01:14 +0000 Subject: [PATCH 3/6] Display cools in pop'n judgecell --- client/src/components/tables/cells/PopnJudgementCell.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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} From fbf766d966062f2688cff723aced9f724247122b Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 14 Feb 2022 07:02:22 +0000 Subject: [PATCH 4/6] Add perfects to jubeat judgements --- client/src/components/tables/cells/JubeatJudgementCell.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/components/tables/cells/JubeatJudgementCell.tsx b/client/src/components/tables/cells/JubeatJudgementCell.tsx index 3b2c28a9f..44b4af8bc 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- @@ -32,7 +33,8 @@ export default function JubeatJudgementCell({ IsNullish(judgements.miss) || IsNullish(judgements.great) || IsNullish(judgements.good) || - IsNullish(judgements.poor) + IsNullish(judgements.poor) || + IsNullish(judgements.perfect) ) { return No Data.; } @@ -40,6 +42,7 @@ export default function JubeatJudgementCell({ return ( + {judgements.perfect}- {judgements.great}- {judgements.good}- {judgements.poor}- From a96829d92ebbded2f92b0b27d8f896b7c510a101 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Mon, 14 Feb 2022 07:03:11 +0000 Subject: [PATCH 5/6] Add marvelous to waccajudgecell --- .../src/components/tables/cells/WACCAJudgementCell.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client/src/components/tables/cells/WACCAJudgementCell.tsx b/client/src/components/tables/cells/WACCAJudgementCell.tsx index e335120f7..617be5a3b 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 @@ -27,13 +28,19 @@ export default function WaccaJudgementCell({ 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} From f6d2bfa2ef4e0825d8c95f5553364e715080b3a1 Mon Sep 17 00:00:00 2001 From: zkldi <20380519+zkldi@users.noreply.github.com> Date: Tue, 15 Feb 2022 05:26:43 +0000 Subject: [PATCH 6/6] Do not assume an FC has 0 misses because of PB joining --- client/src/components/tables/cells/JubeatJudgementCell.tsx | 5 ----- client/src/components/tables/cells/MusecaJudgementCell.tsx | 5 ----- client/src/components/tables/cells/SDVXJudgementCell.tsx | 5 ----- client/src/components/tables/cells/WACCAJudgementCell.tsx | 5 ----- 4 files changed, 20 deletions(-) diff --git a/client/src/components/tables/cells/JubeatJudgementCell.tsx b/client/src/components/tables/cells/JubeatJudgementCell.tsx index 44b4af8bc..3aee5c3c0 100644 --- a/client/src/components/tables/cells/JubeatJudgementCell.tsx +++ b/client/src/components/tables/cells/JubeatJudgementCell.tsx @@ -22,11 +22,6 @@ export default function JubeatJudgementCell({ ); } - // safety - if (score.scoreData.lamp === "FULL COMBO") { - score.scoreData.judgements.miss = 0; - } - const judgements = score.scoreData.judgements; if ( 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/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/WACCAJudgementCell.tsx b/client/src/components/tables/cells/WACCAJudgementCell.tsx index 617be5a3b..c7d30dd4f 100644 --- a/client/src/components/tables/cells/WACCAJudgementCell.tsx +++ b/client/src/components/tables/cells/WACCAJudgementCell.tsx @@ -21,11 +21,6 @@ export default function WaccaJudgementCell({ ); } - // safety - if (score.scoreData.lamp === "FULL COMBO") { - score.scoreData.judgements.miss = 0; - } - const judgements = score.scoreData.judgements; if (