UNPKG

osu-api-extended

Version:

Advanced osu! api wrapper cover all V2 and V1 endpoints, and provide useful tools

91 lines (90 loc) 2.32 kB
import { IError } from "../types"; import { GamemodeEnum } from "../types/enums"; import { AccuracyResponse } 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; large_tick_hit?: any; small_tick_hit?: any; small_tick_miss?: any; slider_tail_hit?: any; }; type MaxHits = { large_tick_hit?: any; slider_tail_hit?: any; }; type Response = AccuracyResponse & IError; /** * Calculate accuracy 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 * * - `mode` - Number/Name of the gamemode * *   * * ### Usage Example * ```js * const { tools } = require('osu-api-extended'); * * function main() { * try { * const hits = { * ok: 23, * miss: 9, * great: 457, * }; * const stable = tools.calculate_accuracy(hits, 'osu'); * * * // or * const lazer_hits = { * ok: 23, * miss: 9, * great: 457, * large_tick_hit: 15, * slider_tail_hit: 244 * }; * const lazer_max_hits = { * large_tick_hit: 15, * slider_tail_hit: 245 * }; * const lazer = tools.calculate_accuracy(lazer_hits, lazer_max_hits, 'osu', true); * * * console.log(stable, lazer); * } catch (error) { * console.log(error); * }; * }; * * main(); * ``` */ export declare function calculate_accuracy(hits: Hits, max_hits: MaxHits, mode: GamemodeEnum | string | number, lazer: boolean): Response; export declare function calculate_accuracy(hits: Hits, mode: GamemodeEnum | string | number): Response; export {};