1.0.6 • Published 2 years ago
scosaber v1.0.6
import Scosaber from 'scosaber';
import { queryScores } from 'scosaber/utils';
(async () => {
const goosyChan = new Scosaber("76561198436848521", "./data");
await goosyChan.updateProfile();
await goosyChan.updateScores();
const profile = await goosyChan.getProfile();
const scores = await goosyChan.getScores();
console.log("Scoresaber profile of", profile.name);
// Get the number of maps where player has scored 300-400pp
const mapCountBetween300and400PP = queryScores(scores, {
filter: score => score.leaderboard.ranked && score.score.pp > 300 && score.score.pp < 400,
calculate: { type: "count" }
});
console.log("Number of maps between 300 and 400 PP: ", mapCountBetween300and400PP);
// Get the score of the map with the highest ranked star pass without modifiers
const highestRankedUnmodifiedPass = queryScores(scores, {
filter: score => score.leaderboard.ranked && score.score.modifiers === "",
sort: {
prop: score => score.leaderboard.stars,
order: "desc"
},
calculate: { type: "first" }
});
console.log("Highest ranked unmodified pass: ", highestRankedUnmodifiedPass.leaderboard.songName, highestRankedUnmodifiedPass.leaderboard.stars + " stars");
// Get the percentage of scores with modifiers
const countOfScoresWithModifiers = queryScores(scores, {
filter: score => score.score.modifiers !== "",
calculate: { type: "count" }
});
console.log("Percentage of scores with modifiers: ", countOfScoresWithModifiers / scores.length * 100 + "%");
})();