npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@pwn_z0r/osu-sr-calculator

v1.0.13

Published

Updated star rating calculator for osu! beatmaps

Downloads

2

Readme

osu-sr-calculator

Package to calculate star ratings with any mod combination on osu! beatmaps Using the recently updated star rating algorithm

Installation

npm install osu-sr-calculator --save
yarn add osu-sr-calculator

Usage

import { calculateStarRating } from 'osu-sr-calculator';

const starRating = await calculateStarRating(mapId, mods, allCombinations, returnAllDifficultyValues);

The calculateStarRating function accepts four parameters:

  • mapId: the map id of the beatmap (make sure you use the id from the /b url)
  • mods (optional): an array containing the mods you want to include in the calculation. Omitting this parameter will default to nomod. Any mod combination can be used, but only HR, EZ, DT and HT will influence the star rating. Any invalid string will be ignored.
  • allCombinations (optional): a boolean containing whether or not to calculate all possible star ratings for this map. If set to true, the mods parameter will obviously be ignored.
  • returnAllDifficultyValues (optional): a boolean containing whether or not to return the aim and speed ratings as well. Default is false

This function returns an object containing the calculated star rating for the requested mod combination. In case of allCombinations, the object will contain all mod combinations with their corresponding star ratings.

Examples

  • Nomod star rating:
const starRating = await calculateStarRating(1616712);
/* Response:
{ nomod: 4.740512165564775 }
*/
  • DT star rating:
const starRating = await calculateStarRating(1616712, ["DT"]);
/* Response:
{ DT: 6.615083213333153 }
*/
  • DTHR star rating:
const starRating = await calculateStarRating(1616712, ["DT", "HR"]);
/* Response:
{ DTHR: 7.123757009172763 }
*/
  • All possible star ratings:
const starRating = await calculateStarRating(1616712, [], true);
/* Response:
{
    nomod: 4.740512165564775,
    DT: 6.615083213333153,
    HT: 3.8242340076263517,
    HR: 5.104644786105074,
    HRDT: 7.123757009172763,
    HRHT: 4.116661624811091,
    EZ: 4.25926190283471,
    EZDT: 5.94301716616598,
    EZHT: 3.44160529827689
}
*/
  • Return aim and speed ratings as well
const starRating = await calculateStarRating(1616712, [], false, true);
/* Response:
{
    nomod: {
        aim: 2.48419911531009,
        speed: 2.0284269851992796,
        total: 4.740512165564775
    }
}
*/

Accuracy

This package parses the beatmap and calculates the star rating in exactly the same way as in the official osu! source code. Due to slight difference between C# and TypeScript, a fault margin of at most 0.01 should be expected. Accuracy on "unrankable" beatmaps can be further off.