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
run-name: ${{ github.actor }} is testing out Gitea Actions 🚀
run-name: ${{ github.actor }} is testing out Gitea Actions
on: [push]
jobs:
Explore-Gitea-Actions:
runs-on: ubuntu-20.04
steps:
- 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 "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- 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 "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
- name: Check out repository code
uses: actions/checkout@v3
- 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 "🍏 This job's status is ${{ job.status }}."
- 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 "This job's status is ${{ job.status }}."

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

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

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