diff --git a/src/curve/BeatLeaderCurve.js b/src/curve/BeatLeaderCurve.js index ec7b176..821e731 100644 --- a/src/curve/BeatLeaderCurve.js +++ b/src/curve/BeatLeaderCurve.js @@ -9,6 +9,6 @@ export function getBeatLeaderPP(acc, stars) { if (stars === undefined || acc === undefined) { return undefined; } - const pp = curve(acc / 100, stars - 0.5) * (stars + 0.5) * 42; + const pp = curve(acc, stars - 0.5) * (stars + 0.5) * 42; return Number.isNaN(pp) ? undefined : pp; } diff --git a/src/helpers/validateSteamId.js b/src/helpers/validateSteamId.js index ebe2314..3089279 100644 --- a/src/helpers/validateSteamId.js +++ b/src/helpers/validateSteamId.js @@ -25,7 +25,7 @@ export async function isValidSteamId(steamId) { const before = Date.now(); let valid = false; for (const url of TO_CHECK) { - const isValid = await Utils.checkLeaderboard(url, steamId); + const isValid = await Utils.isLeaderboardValid(url, steamId); if (isValid) { valid = true; break; diff --git a/src/helpers/websocketClient.ts b/src/helpers/websocketClient.ts index f4d9941..db9c94b 100644 --- a/src/helpers/websocketClient.ts +++ b/src/helpers/websocketClient.ts @@ -136,10 +136,10 @@ const handlers: any = { if (finalScore == 0) { finalScore = state.currentScore; } - const percent = relativeScore * 100; + const percent = relativeScore; state.setCurrentScore(finalScore); - state.setPercent(percent); + state.setPercent(percent * 100); state.setCombo(data.status.performance.combo); state.setPp(percent); }, diff --git a/src/store/songDataStore.ts b/src/store/songDataStore.ts index 4503c50..2ee19a6 100644 --- a/src/store/songDataStore.ts +++ b/src/store/songDataStore.ts @@ -105,7 +105,6 @@ export const useSongDataStore = create()((set) => ({ const mapLeaderboardData = await Utils.getWebsiteApi( leaderboardType ).getMapLeaderboardData(mapHash, mapDiff, characteristic); - console.log(mapLeaderboardData); const mapData = await axios.get( `${env("SITE_URL")}/api/beatsaver/map?hash=${mapHash}` @@ -118,7 +117,10 @@ export const useSongDataStore = create()((set) => ({ set({ isLoading: false, hasError: hasError, - mapLeaderboardData: mapLeaderboardData, + mapLeaderboardData: { + stars: mapLeaderboardData.stars, + modifiers: mapLeaderboardData.modifiers, + }, bsr: bsr, mapArt: mapArt, songDifficulty: mapDiff, diff --git a/src/utils/utils.js b/src/utils/utils.js index 4dd558a..acc417b 100644 --- a/src/utils/utils.js +++ b/src/utils/utils.js @@ -18,7 +18,7 @@ export default class Utils { window.open(url, "_blank"); } - static async checkLeaderboard(url, steamId) { + static async isLeaderboardValid(url, steamId) { const data = await fetch(url.replace("%s", steamId), { headers: { "X-Requested-With": "BeatSaber Overlay", @@ -50,6 +50,7 @@ export default class Utils { useSongDataStore.getState().mapLeaderboardData.modifiers; let bonus = 0; + // No Fail if ( songMods.noFail == true && modifierMulipliers.nf < 0 && @@ -58,8 +59,12 @@ export default class Utils { bonus -= modifierMulipliers.nf; } + // Speed Modifiers if (songMods.songSpeed != "Normal") { - if (songMods.songSpeed == "FasterSong" && modifierMulipliers.fs > 0) { + if (songMods.songSpeed == "SuperSlow" && modifierMulipliers.ss > 0) { + bonus -= modifierMulipliers.ss; + } + if (songMods.songSpeed == "Faster" && modifierMulipliers.fs > 0) { bonus += modifierMulipliers.fs; } if (songMods.songSpeed == "SuperFast" && modifierMulipliers.sf > 0) { @@ -67,21 +72,31 @@ export default class Utils { } } + // Disappearing Arrows if (songMods.disappearingArrows == true && modifierMulipliers.da > 0) { bonus += modifierMulipliers.da; } + // Ghost Notes if (songMods.ghostNotes == true && modifierMulipliers.gn > 0) { toAdd += modifierMulipliers.gn; } + // No Arrows if (songMods.noArrows == true && modifierMulipliers.na < 0) { bonus -= modifierMulipliers.na; } + // No Bombs if (songMods.noBombs == true && modifierMulipliers.nb < 0) { bonus -= modifierMulipliers.nb; } + + // No Obstacles + if (songMods.obstacles == false && modifierMulipliers.no < 0) { + bonus -= modifierMulipliers.no; + } + return bonus; }