This commit is contained in:
Lee 2023-03-26 22:17:05 +01:00
parent c8b121fd4f
commit 7f1ce8bd15
6 changed files with 87 additions and 30 deletions

@ -1,15 +1,15 @@
name: Gitea Actions Demo name: Gitea Actions Demo
run-name: ${{ github.actor }} is testing out Gitea Actions 🚀 run-name: ${{ github.actor }} is testing out Gitea Actions
on: [push] on: [push]
jobs: jobs:
Explore-Gitea-Actions: Explore-Gitea-Actions:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "The job was automatically triggered by a ${{ github.event_name }} event."
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "This job is now running on a ${{ runner.os }} server hosted by Gitea!"
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code - name: Check out repository code
uses: actions/checkout@v3 uses: actions/checkout@v3
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "The ${{ github.repository }} repository has been cloned to the runner."
- run: echo "🖥️ The workflow is now ready to test your code on the runner." - run: echo "The workflow is now ready to test your code on the runner."
- run: echo "🍏 This job's status is ${{ job.status }}." - run: echo "This job's status is ${{ job.status }}."

@ -3,6 +3,7 @@ import { getFormattedScorePercent } from "../helpers/map/mapHelpers";
import { useSettingsStore } from "../store/overlaySettingsStore"; import { useSettingsStore } from "../store/overlaySettingsStore";
import { useSongDataStore } from "../store/songDataStore"; import { useSongDataStore } from "../store/songDataStore";
import styles from "../styles/scoreStats.module.css"; import styles from "../styles/scoreStats.module.css";
import Utils from "../utils/utils";
export default function ScoreStats() { export default function ScoreStats() {
const [showScoreInfo, showPp] = useSettingsStore((store) => [ const [showScoreInfo, showPp] = useSettingsStore((store) => [
@ -47,7 +48,9 @@ export default function ScoreStats() {
<p> <p>
{getFormattedScorePercent(percentage)} {percentage.toFixed(2)}% {getFormattedScorePercent(percentage)} {percentage.toFixed(2)}%
</p> </p>
{scoreSaberPP !== undefined && showPp ? ( {scoreSaberPP !== undefined &&
scoreSaberPP.pp !== undefined &&
showPp ? (
<div <div
style={{ style={{
display: "flex", display: "flex",
@ -80,13 +83,32 @@ export default function ScoreStats() {
height={30} height={30}
src="https://cdn.fascinated.cc/Wo9JRAfD.png" src="https://cdn.fascinated.cc/Wo9JRAfD.png"
></Image> ></Image>
<p <div>
style={{ {Object.entries(beatLeaderPP).map((value, i) => {
marginLeft: "8px", let name = value[0];
}} const pp = value[1];
>
{beatLeaderPP.toFixed(0)}pp name = name.split("PP")[0];
</p> if (name == "pp") {
name = undefined;
}
if (name !== undefined) {
name = Utils.capitalizeFirstLetter(name);
}
return (
<p
key={i}
style={{
marginLeft: "8px",
fontSize: name == undefined ? "35px" : "30px",
}}
>
{name} {pp.toFixed(0)}pp
</p>
);
})}
</div>
</div> </div>
) : null} ) : null}
</div> </div>

@ -57,7 +57,12 @@ export function getBeatLeaderPP(accuracy, accRating, passRating, techRating) {
techRating * modifierBonus techRating * modifierBonus
); );
const pp = inflate(ppValues.passPP + ppValues.accPP + ppValues.techPP); const pp = inflate(ppValues.passPP + ppValues.accPP + ppValues.techPP);
return isNaN(pp) ? 1024 : pp; return {
pp: pp,
passPP: ppValues.passPP,
accPP: ppValues.accPP,
techPP: ppValues.techPP,
};
} }
/** /**

@ -75,5 +75,7 @@ export function getScoreSaberPP(acc, stars) {
const modifier = findPPModifier(acc * 100, ppCurve); const modifier = findPPModifier(acc * 100, ppCurve);
const finalPP = modifier * ppValue; const finalPP = modifier * ppValue;
return Number.isNaN(finalPP) ? undefined : finalPP; return {
pp: Number.isNaN(finalPP) ? undefined : finalPP,
};
} }

@ -17,7 +17,7 @@ interface SongDataState {
stars: Number | undefined; stars: Number | undefined;
modifiers: Object; modifiers: Object;
}; };
beatleader: { beatLeader: {
stars: Number | undefined; stars: Number | undefined;
modifiers: Object; modifiers: Object;
passRating: number | undefined; passRating: number | undefined;
@ -35,8 +35,15 @@ interface SongDataState {
percentage: number; percentage: number;
combo: number; combo: number;
currentPP: { currentPP: {
scoreSaber: number | undefined; beatLeader: {
beatLeader: number | undefined; pp: number | undefined;
passPP: number | undefined;
accPP: number | undefined;
techPP: number | undefined;
};
scoreSaber: {
pp: number | undefined;
};
}; };
saberA: { saberA: {
cutDistanceScore: number; cutDistanceScore: number;
@ -82,7 +89,7 @@ export const useSongDataStore = create<SongDataState>()((set) => ({
stars: 0, stars: 0,
modifiers: {}, modifiers: {},
}, },
beatleader: { beatLeader: {
stars: 0, stars: 0,
modifiers: {}, modifiers: {},
passRating: undefined, passRating: undefined,
@ -100,8 +107,15 @@ export const useSongDataStore = create<SongDataState>()((set) => ({
percentage: 100, percentage: 100,
combo: 0, combo: 0,
currentPP: { currentPP: {
beatLeader: undefined, beatLeader: {
scoreSaber: undefined, pp: undefined,
passPP: undefined,
accPP: undefined,
techPP: undefined,
},
scoreSaber: {
pp: undefined,
},
}, },
saberA: { saberA: {
cutDistanceScore: 0.0, cutDistanceScore: 0.0,
@ -144,7 +158,7 @@ export const useSongDataStore = create<SongDataState>()((set) => ({
isLoading: false, isLoading: false,
hasError: hasError, hasError: hasError,
mapLeaderboardData: { mapLeaderboardData: {
beatleader: { beatLeader: {
stars: beatLeaderLeaderboardData.stars, stars: beatLeaderLeaderboardData.stars,
modifiers: beatLeaderLeaderboardData.modifiers, modifiers: beatLeaderLeaderboardData.modifiers,
passRating: beatLeaderLeaderboardData.passRating, passRating: beatLeaderLeaderboardData.passRating,
@ -211,8 +225,8 @@ export const useSongDataStore = create<SongDataState>()((set) => ({
"ScoreSaber" "ScoreSaber"
); );
const beatLeaderMapStarCount = leaderboardData.beatleader.stars; const beatLeaderMapStarCount = leaderboardData.beatLeader.stars;
let beatLeaderPP = Utils.calculatePP( let beatLeaderPP: any = Utils.calculatePP(
beatLeaderMapStarCount, beatLeaderMapStarCount,
percent, percent,
"BeatLeader" "BeatLeader"
@ -250,7 +264,7 @@ export const useSongDataStore = create<SongDataState>()((set) => ({
stars: undefined, stars: undefined,
modifiers: {}, modifiers: {},
}, },
beatleader: { beatLeader: {
stars: undefined, stars: undefined,
modifiers: {}, modifiers: {},
passRating: undefined, passRating: undefined,
@ -267,7 +281,17 @@ export const useSongDataStore = create<SongDataState>()((set) => ({
currentScore: 0, currentScore: 0,
percentage: 100, percentage: 100,
combo: 0, combo: 0,
currentPP: undefined, currentPP: {
beatLeader: {
pp: undefined,
passPP: undefined,
accPP: undefined,
techPP: undefined,
},
scoreSaber: {
pp: undefined,
},
},
saberA: { saberA: {
cutDistanceScore: 0.0, cutDistanceScore: 0.0,
averagePreSwing: 0.0, averagePreSwing: 0.0,

@ -38,7 +38,7 @@ export default class Utils {
} }
if (type === "BeatLeader") { if (type === "BeatLeader") {
const leaderboardData = const leaderboardData =
useSongDataStore.getState().mapLeaderboardData.beatleader; useSongDataStore.getState().mapLeaderboardData.beatLeader;
return getBeatLeaderPP( return getBeatLeaderPP(
acc, acc,
@ -56,7 +56,7 @@ export default class Utils {
static calculateModifierBonus() { static calculateModifierBonus() {
const songMods = useSongDataStore.getState().songModifiers; const songMods = useSongDataStore.getState().songModifiers;
const modifierMulipliers = const modifierMulipliers =
useSongDataStore.getState().mapLeaderboardData.beatleader.modifiers; useSongDataStore.getState().mapLeaderboardData.beatLeader.modifiers;
let bonus = 1; let bonus = 1;
// No Fail // No Fail
@ -131,4 +131,8 @@ export default class Utils {
return JSON.parse(stringValue); return JSON.parse(stringValue);
} }
}; };
static capitalizeFirstLetter(string) {
return string.charAt(0).toUpperCase() + string.slice(1);
}
} }