Compare commits
4 Commits
renovate/a
...
master
Author | SHA1 | Date | |
---|---|---|---|
0f24578e06 | |||
2ac3dbdacd | |||
e4f2c69f7e | |||
9e43a72ac9 |
@ -17,5 +17,5 @@ jobs:
|
||||
- name: Push to dokku
|
||||
uses: dokku/github-action@master
|
||||
with:
|
||||
git_remote_url: "ssh://dokku@10.0.3.39:22/scoresaber-reloadedv2"
|
||||
git_remote_url: "ssh://dokku@10.0.50.65:22/scoresaber-reloadedv2"
|
||||
ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
39
pnpm-lock.yaml
generated
39
pnpm-lock.yaml
generated
@ -126,7 +126,7 @@ devDependencies:
|
||||
version: 1.0.10
|
||||
autoprefixer:
|
||||
specifier: ^10.4.17
|
||||
version: 10.4.18(postcss@8.4.33)
|
||||
version: 10.4.17(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.18(postcss@8.4.33):
|
||||
resolution: {integrity: sha512-1DKbDfsr6KUElM6wg+0zRNkB/Q7WcKYAaK+pzXn+Xqmszm/5Xa9coeNdtP88Vi+dPzZnMjhge8GIV49ZQkDa+g==}
|
||||
/autoprefixer@10.4.17(postcss@8.4.33):
|
||||
resolution: {integrity: sha512-/cpVNRLSfhOtcGflT13P2794gVSgmPgTR+erw5ifnMLZb0UnSlkK4tquLmkd3BhA+nLo5tX8Cu0upUsGKvKbmg==}
|
||||
engines: {node: ^10 || ^12 || >=14}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
postcss: ^8.1.0
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
caniuse-lite: 1.0.30001594
|
||||
browserslist: 4.22.3
|
||||
caniuse-lite: 1.0.30001581
|
||||
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.23.0:
|
||||
resolution: {integrity: sha512-QW8HiM1shhT2GuzkvklfjcKDiWFXHOeFCIA/huJPwHsslwcydgk7X+z2zXpEijP98UCY7HbubZt5J2Zgvf0CaQ==}
|
||||
/browserslist@4.22.3:
|
||||
resolution: {integrity: sha512-UAp55yfwNv0klWNapjs/ktHoguxuQNGnOzxYmfnXIS+8AsRDZkSDxg7R1AX3GKzn078SBI5dzwzj/Yx0Or0e3A==}
|
||||
engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
caniuse-lite: 1.0.30001594
|
||||
electron-to-chromium: 1.4.693
|
||||
caniuse-lite: 1.0.30001581
|
||||
electron-to-chromium: 1.4.653
|
||||
node-releases: 2.0.14
|
||||
update-browserslist-db: 1.0.13(browserslist@4.23.0)
|
||||
update-browserslist-db: 1.0.13(browserslist@4.22.3)
|
||||
dev: true
|
||||
|
||||
/bufferutil@4.0.8:
|
||||
@ -1727,11 +1727,6 @@ 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==}
|
||||
@ -2045,8 +2040,8 @@ packages:
|
||||
/eastasianwidth@0.2.0:
|
||||
resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==}
|
||||
|
||||
/electron-to-chromium@1.4.693:
|
||||
resolution: {integrity: sha512-/if4Ueg0GUQlhCrW2ZlXwDAm40ipuKo+OgeHInlL8sbjt+hzISxZK949fZeJaVsheamrzANXvw1zQTvbxTvSHw==}
|
||||
/electron-to-chromium@1.4.653:
|
||||
resolution: {integrity: sha512-wA2A2LQCqnEwQAvwADQq3KpMpNwgAUBnRmrFgRzHnPhbQUFArTR32Ab46f4p0MovDLcg4uqd4nCsN2hTltslpA==}
|
||||
dev: true
|
||||
|
||||
/emoji-regex@8.0.0:
|
||||
@ -2187,8 +2182,8 @@ packages:
|
||||
ext: 1.7.0
|
||||
dev: false
|
||||
|
||||
/escalade@3.1.2:
|
||||
resolution: {integrity: sha512-ErCHMCae19vR8vQGe50xIsVomy19rg6gFu3+r3jkEO46suLMWBksvVyoGgQV+jOfl84ZSOSlmv6Gxa89PmTGmA==}
|
||||
/escalade@3.1.1:
|
||||
resolution: {integrity: sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
@ -4268,14 +4263,14 @@ packages:
|
||||
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
|
||||
dev: true
|
||||
|
||||
/update-browserslist-db@1.0.13(browserslist@4.23.0):
|
||||
/update-browserslist-db@1.0.13(browserslist@4.22.3):
|
||||
resolution: {integrity: sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
browserslist: '>= 4.21.0'
|
||||
dependencies:
|
||||
browserslist: 4.23.0
|
||||
escalade: 3.1.2
|
||||
browserslist: 4.22.3
|
||||
escalade: 3.1.1
|
||||
picocolors: 1.0.0
|
||||
dev: true
|
||||
|
||||
|
@ -7,7 +7,7 @@ import { useScoresaberScoresStore } from "@/store/scoresaberScoresStore";
|
||||
export const WEIGHT_COEFFICIENT = 0.965;
|
||||
|
||||
const starMultiplier = 42.11;
|
||||
const ppCurve = [
|
||||
const ppCurve: [number, number][] = [
|
||||
[1, 5.367394282890631],
|
||||
[0.9995, 5.019543595874787],
|
||||
[0.999, 4.715470646416203],
|
||||
@ -63,29 +63,53 @@ function lerp(v0: number, v1: number, t: number) {
|
||||
return v0 + t * (v1 - v0);
|
||||
}
|
||||
|
||||
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 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 findPPModifier(acc: number, curve: Array<any>) {
|
||||
function findPPModifier(
|
||||
acc: number,
|
||||
curve: [number, number][],
|
||||
): number | undefined {
|
||||
acc = clamp(acc, 0, 100) / 100;
|
||||
console.log("Clamped Accuracy:", acc);
|
||||
|
||||
let prev = curve[1];
|
||||
let prev: [number, number] = 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) {
|
||||
const ppValue = stars * starMultiplier;
|
||||
const modifier = findPPModifier(acc * 100, ppCurve);
|
||||
if (!modifier) 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);
|
||||
|
||||
const finalPP = modifier * ppValue;
|
||||
return {
|
||||
pp: Number.isNaN(finalPP) ? undefined : finalPP,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user