Compare commits

..

1 Commits

Author SHA1 Message Date
20bb3b9618 chore(deps): update dependency @types/node to v20.11.24 2024-03-06 01:17:06 +00:00
3 changed files with 16 additions and 40 deletions

@ -17,5 +17,5 @@ jobs:
- name: Push to dokku - name: Push to dokku
uses: dokku/github-action@master uses: dokku/github-action@master
with: with:
git_remote_url: "ssh://dokku@10.0.50.65:22/scoresaber-reloadedv2" git_remote_url: "ssh://dokku@10.0.3.39:22/scoresaber-reloadedv2"
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

8
pnpm-lock.yaml generated

@ -114,7 +114,7 @@ devDependencies:
version: 14.1.0 version: 14.1.0
'@types/node': '@types/node':
specifier: ^20.11.14 specifier: ^20.11.14
version: 20.11.14 version: 20.11.24
'@types/react': '@types/react':
specifier: ^18.2.48 specifier: ^18.2.48
version: 18.2.48 version: 18.2.48
@ -1346,8 +1346,8 @@ packages:
resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==}
dev: true dev: true
/@types/node@20.11.14: /@types/node@20.11.24:
resolution: {integrity: sha512-w3yWCcwULefjP9DmDDsgUskrMoOy5Z8MiwKHr1FvqGPtx7CvJzQvxD7eKpxNtklQxLruxSXWddyeRtyud0RcXQ==} resolution: {integrity: sha512-Kza43ewS3xoLgCEpQrsT+xRo/EJej1y0kVYGiLFE1NEODXGzTfwiC6tXTLMQskn1X4/Rjlh0MQUvx9W+L9long==}
dependencies: dependencies:
undici-types: 5.26.5 undici-types: 5.26.5
dev: true dev: true
@ -1373,7 +1373,7 @@ packages:
/@types/websocket@1.0.10: /@types/websocket@1.0.10:
resolution: {integrity: sha512-svjGZvPB7EzuYS94cI7a+qhwgGU1y89wUgjT6E2wVUfmAGIvRfT7obBvRtnhXCSsoMdlG4gBFGE7MfkIXZLoww==} resolution: {integrity: sha512-svjGZvPB7EzuYS94cI7a+qhwgGU1y89wUgjT6E2wVUfmAGIvRfT7obBvRtnhXCSsoMdlG4gBFGE7MfkIXZLoww==}
dependencies: dependencies:
'@types/node': 20.11.14 '@types/node': 20.11.24
dev: true dev: true
/@typescript-eslint/parser@6.20.0(eslint@8.56.0)(typescript@5.3.3): /@typescript-eslint/parser@6.20.0(eslint@8.56.0)(typescript@5.3.3):

@ -7,7 +7,7 @@ import { useScoresaberScoresStore } from "@/store/scoresaberScoresStore";
export const WEIGHT_COEFFICIENT = 0.965; export const WEIGHT_COEFFICIENT = 0.965;
const starMultiplier = 42.11; const starMultiplier = 42.11;
const ppCurve: [number, number][] = [ const ppCurve = [
[1, 5.367394282890631], [1, 5.367394282890631],
[0.9995, 5.019543595874787], [0.9995, 5.019543595874787],
[0.999, 4.715470646416203], [0.999, 4.715470646416203],
@ -63,53 +63,29 @@ function lerp(v0: number, v1: number, t: number) {
return v0 + t * (v1 - v0); return v0 + t * (v1 - v0);
} }
function calculatePPModifier( function calculatePPModifier(c1: Array<any>, c2: Array<any>, acc: number) {
c1: [number, number], const distance = (c2[0] - acc) / (c2[0] - c1[0]);
c2: [number, number], return lerp(c2[1], c1[1], distance);
acc: number,
): number {
const distance: number = (c2[0] - acc) / (c2[0] - c1[0]);
const interpolated: number = lerp(c2[1], c1[1], distance);
console.log(
`Acc: ${acc}, c1: ${c1}, c2: ${c2}, Distance: ${distance}, Interpolated: ${interpolated}`,
);
return interpolated;
} }
function findPPModifier( function findPPModifier(acc: number, curve: Array<any>) {
acc: number,
curve: [number, number][],
): number | undefined {
acc = clamp(acc, 0, 100) / 100; acc = clamp(acc, 0, 100) / 100;
console.log("Clamped Accuracy:", acc);
let prev: [number, number] = curve[1]; let prev = curve[1];
for (const item of curve) { for (const item of curve) {
console.log("Curve Point:", item[0], item[1]);
if (item[0] <= acc) { if (item[0] <= acc) {
return calculatePPModifier(item, prev, acc); return calculatePPModifier(item, prev, acc);
} }
prev = item; prev = item;
} }
return undefined;
} }
export function getScoreSaberPP( export function getScoreSaberPP(acc: number, stars: number) {
acc: number, const ppValue = stars * starMultiplier;
stars: number, const modifier = findPPModifier(acc * 100, ppCurve);
): { pp: number | undefined } { if (!modifier) return undefined;
console.log("Input Stars:", stars);
console.log("Input Accuracy:", acc);
const ppValue: number = stars * starMultiplier;
const modifier: number | undefined = findPPModifier(acc * 100, ppCurve);
console.log("Modifier:", modifier);
if (!modifier) return { pp: undefined };
const finalPP: number = modifier * ppValue;
console.log("Final PP:", finalPP);
const finalPP = modifier * ppValue;
return { return {
pp: Number.isNaN(finalPP) ? undefined : finalPP, pp: Number.isNaN(finalPP) ? undefined : finalPP,
}; };