Compare commits

..

1 Commits

Author SHA1 Message Date
c332c54ba1 chore(deps): update dependency autoprefixer to v10.4.18 2024-03-06 01:17:11 +00:00
3 changed files with 34 additions and 53 deletions

View File

@ -17,5 +17,5 @@ jobs:
- name: Push to dokku
uses: dokku/github-action@master
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 }}

39
pnpm-lock.yaml generated
View File

@ -126,7 +126,7 @@ devDependencies:
version: 1.0.10
autoprefixer:
specifier: ^10.4.17
version: 10.4.17(postcss@8.4.33)
version: 10.4.18(postcss@8.4.33)
cross-env:
specifier: ^7.0.3
version: 7.0.3
@ -1611,15 +1611,15 @@ packages:
resolution: {integrity: sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==}
dev: false
/autoprefixer@10.4.17(postcss@8.4.33):
resolution: {integrity: sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==}
/autoprefixer@10.4.18(postcss@8.4.33):
resolution: {integrity: sha512-1DKbDfsr6KUElM6wg+0zRNkB/Q7WcKYAaK+pzXn+Xqmszm/5Xa9coeNdtP88Vi+dPzZnMjhge8GIV49ZQkDa+g==}
engines: {node: ^10 || ^12 || >=14}
hasBin: true
peerDependencies:
postcss: ^8.1.0
dependencies:
browserslist: 4.22.3
caniuse-lite: 1.0.30001581
browserslist: 4.23.0
caniuse-lite: 1.0.30001594
fraction.js: 4.3.7
normalize-range: 0.1.2
picocolors: 1.0.0
@ -1682,15 +1682,15 @@ packages:
dependencies:
fill-range: 7.0.1
/browserslist@4.22.3:
resolution: {integrity: sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==}
/browserslist@4.23.0:
resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==}
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
hasBin: true
dependencies:
caniuse-lite: 1.0.30001581
electron-to-chromium: 1.4.653
caniuse-lite: 1.0.30001594
electron-to-chromium: 1.4.693
node-releases: 2.0.14
update-browserslist-db: 1.0.13(browserslist@4.22.3)
update-browserslist-db: 1.0.13(browserslist@4.23.0)
dev: true
/bufferutil@4.0.8:
@ -1727,6 +1727,11 @@ packages:
/caniuse-lite@1.0.30001581:
resolution: {integrity: sha512-whlTkwhqV2tUmP3oYhtNfaWGYHDdS3JYFQBKXxcUR9qqPWsRhFHhoISO2Xnl/g0xyKzht9mI1LZpiNWfMzHixQ==}
dev: false
/caniuse-lite@1.0.30001594:
resolution: {integrity: sha512-VblSX6nYqyJVs8DKFMldE2IVCJjZ225LW00ydtUWwh5hk9IfkTOffO6r8gJNsH0qqqeAF8KrbMYA2VEwTlGW5g==}
dev: true
/chalk@4.1.2:
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
@ -2040,8 +2045,8 @@ packages:
/eastasianwidth@0.2.0:
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
/electron-to-chromium@1.4.653:
resolution: {integrity: sha512-wA2A2LQCqnEwQAvwADQq3KpMpNwgAUBnRmrFgRzHnPhbQUFArTR32Ab46f4p0MovDLcg4uqd4nCsN2hTltslpA==}
/electron-to-chromium@1.4.693:
resolution: {integrity: sha512-/if4Ueg0GUQlhCrW2ZlXwDAm40ipuKo+OgeHInlL8sbjt+hzISxZK949fZeJaVsheamrzANXvw1zQTvbxTvSHw==}
dev: true
/emoji-regex@8.0.0:
@ -2182,8 +2187,8 @@ packages:
ext: 1.7.0
dev: false
/escalade@3.1.1:
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
/escalade@3.1.2:
resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}
engines: {node: '>=6'}
dev: true
@ -4263,14 +4268,14 @@ packages:
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
dev: true
/update-browserslist-db@1.0.13(browserslist@4.22.3):
/update-browserslist-db@1.0.13(browserslist@4.23.0):
resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
hasBin: true
peerDependencies:
browserslist: '>= 4.21.0'
dependencies:
browserslist: 4.22.3
escalade: 3.1.1
browserslist: 4.23.0
escalade: 3.1.2
picocolors: 1.0.0
dev: true

View File

@ -7,7 +7,7 @@ import { useScoresaberScoresStore } from "@/store/scoresaberScoresStore";
export const WEIGHT_COEFFICIENT = 0.965;
const starMultiplier = 42.11;
const ppCurve: [number, number][] = [
const ppCurve = [
[1, 5.367394282890631],
[0.9995, 5.019543595874787],
[0.999, 4.715470646416203],
@ -63,53 +63,29 @@ function lerp(v0: number, v1: number, t: number) {
return v0 + t * (v1 - v0);
}
function calculatePPModifier(
c1: [number, number],
c2: [number, number],
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 calculatePPModifier(c1: Array<any>, c2: Array<any>, acc: number) {
const distance = (c2[0] - acc) / (c2[0] - c1[0]);
return lerp(c2[1], c1[1], distance);
}
function findPPModifier(
acc: number,
curve: [number, number][],
): number | undefined {
function findPPModifier(acc: number, curve: Array<any>) {
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) {
console.log("Curve Point:", item[0], item[1]);
if (item[0] <= acc) {
return calculatePPModifier(item, prev, acc);
}
prev = item;
}
return undefined;
}
export function getScoreSaberPP(
acc: number,
stars: number,
): { pp: number | 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);
export function getScoreSaberPP(acc: number, stars: number) {
const ppValue = stars * starMultiplier;
const modifier = findPPModifier(acc * 100, ppCurve);
if (!modifier) return undefined;
const finalPP = modifier * ppValue;
return {
pp: Number.isNaN(finalPP) ? undefined : finalPP,
};