show more data on the #1 feed
Some checks failed
Deploy Backend / deploy (push) Failing after 1m26s
Deploy Website / deploy (push) Failing after 1m5s

This commit is contained in:
Lee
2024-10-18 07:56:39 +01:00
parent dd8befa9e0
commit 9fb276ec4e
7 changed files with 112 additions and 53 deletions

View File

@ -2,6 +2,7 @@ import Score from "../score";
import { Modifier } from "../modifier";
import ScoreSaberScoreToken from "../../types/token/scoresaber/score-saber-score-token";
import ScoreSaberLeaderboardPlayerInfoToken from "../../types/token/scoresaber/score-saber-leaderboard-player-info-token";
import ScoreSaberLeaderboardToken from "@ssr/types/token/scoresaber/score-saber-leaderboard-token";
export default interface ScoreSaberScore extends Score {
/**
@ -21,6 +22,11 @@ export default interface ScoreSaberScore extends Score {
*/
readonly weight?: number;
/**
* The max combo of the score.
*/
readonly maxCombo: number;
/**
* The player who set the score
*/
@ -31,8 +37,12 @@ export default interface ScoreSaberScore extends Score {
* Gets a {@link ScoreSaberScore} from a {@link ScoreSaberScoreToken}.
*
* @param token the token to convert
* @param leaderboard the leaderboard the score was set on
*/
export function getScoreSaberScoreFromToken(token: ScoreSaberScoreToken): ScoreSaberScore {
export function getScoreSaberScoreFromToken(
token: ScoreSaberScoreToken,
leaderboard?: ScoreSaberLeaderboardToken
): ScoreSaberScore {
const modifiers: Modifier[] =
token.modifiers == undefined || token.modifiers === ""
? []
@ -48,15 +58,18 @@ export function getScoreSaberScoreFromToken(token: ScoreSaberScoreToken): ScoreS
return {
leaderboard: "scoresaber",
score: token.baseScore,
accuracy: leaderboard ? token.baseScore / leaderboard.maxScore : Infinity,
rank: token.rank,
modifiers: modifiers,
misses: token.missedNotes,
misses: token.missedNotes + token.badCuts,
missedNotes: token.missedNotes,
badCuts: token.badCuts,
fullCombo: token.fullCombo,
timestamp: new Date(token.timeSet),
id: token.id,
pp: token.pp,
weight: token.weight,
maxCombo: token.maxCombo,
playerInfo: token.leaderboardPlayerInfo,
};
}

View File

@ -13,6 +13,11 @@ export default interface Score {
*/
readonly score: number;
/**
* The accuracy of the score.
*/
readonly accuracy: number;
/**
* The rank for the score.
* @private
@ -26,11 +31,16 @@ export default interface Score {
readonly modifiers: Modifier[];
/**
* The amount missed notes.
* The amount total amount of misses.
* @private
*/
readonly misses: number;
/**
* The amount of missed notes.
*/
readonly missedNotes: number;
/**
* The amount of bad cuts.
* @private