osu-api-extended
Version:
Advanced osu! api wrapper cover all V2 and V1 endpoints, and provide useful tools
78 lines (77 loc) • 2.05 kB
TypeScript
import { IError } from "../types";
import { GamemodeEnum } from "../types/enums";
import { Mod } from "../types/mods";
import { RankResponse } from "../types/tools";
type Hits = {
300?: any;
100?: any;
50?: any;
0?: any;
geki?: any;
katu?: any;
perfect?: any;
great?: any;
good?: any;
ok?: any;
meh?: any;
miss?: any;
count_geki?: any;
count_300?: any;
count_katu?: any;
count_100?: any;
count_50?: any;
count_miss?: any;
ignore_hit?: any;
ignore_miss?: any;
large_bonus?: any;
large_tick_hit?: any;
large_tick_miss?: any;
legacy_combo_increase?: any;
small_bonus?: any;
small_tick_hit?: any;
small_tick_miss?: any;
};
type Response = RankResponse & IError;
/**
* Calculate rank from play hits
*
*
*
* ### Parameters
* - `hits.geki` or `hits.perfect` or `hits.count_geki` - Amount of geki's
* - `hits[300]` or `hits.great` or `hits.count_300` - Amount of 300's
* - `hits.katu` or `hits.good` or `hits.count_katu` - Amount of katu's
* - `hits[100]` or `hits.ok` or `hits.count_100` - Amount of 100's
* - `hits[50]` or `hits.meh` or `hits.count_50` - Amount of 50's
* - `hits[0]` or `hits.miss` or `hits.count_miss` - Amount of misses
*
* - `mods` - Number / Name / Array of { acronym: "EZ" }
* - `mode` - Number/Name of the gamemode
*
*
*
* ### Usage Example
* ```js
* const { tools } = require('osu-api-extended');
*
* function main() {
* try {
* const hits = { 300: 123, 100: 12, 50: 1, 0: 1 };
* const result = tools.calculate_rank(hits, 72, 'osu');
* if (result.error != null) {
* console.log(result.error);
* return;
* };
*
*
* console.log(result);
* } catch (error) {
* console.log(error);
* };
* };
*
* main();
* ```
*/
export declare const calculate_rank: (hits: Hits, mods: Mod[] | string | number, mode: GamemodeEnum | string | number) => Response;
export {};