@rian8337/osu-rebalance-difficulty-calculator 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -5
- package/package.json +4 -4
- package/typings/index.d.ts +0 -10
package/README.md
CHANGED
|
@@ -1,11 +1,106 @@
|
|
|
1
|
-
#
|
|
1
|
+
# About
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The difficulty and performance calculator portion of my osu! module that uses the latest osu!lazer difficulty and performance algorithm.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Features
|
|
6
6
|
|
|
7
|
+
This module provides an osu! difficulty and performance calculator that uses the latest osu!lazer difficulty and performance algorithm for osu!standard gamemode.
|
|
8
|
+
|
|
9
|
+
An error margin should be expected from difficulty and performance calculator due to differences between C# and TypeScript.
|
|
10
|
+
|
|
11
|
+
# Specific Requirements
|
|
12
|
+
|
|
13
|
+
This module has no specific requirements, however installed modules in installation may have specific requirements. It's advised to check them.
|
|
14
|
+
|
|
15
|
+
# Installation
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
npm i @rian8337/osu-base @rian8337/osu-rebalance-difficulty-calculator
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
or
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
yarn add @rian8337/osu-base @rian8337/osu-rebalance-difficulty-calculator
|
|
7
25
|
```
|
|
8
|
-
const osuRebalanceDifficultyCalculator = require('osu-rebalance-difficulty-calculator');
|
|
9
26
|
|
|
10
|
-
|
|
27
|
+
# Usage
|
|
28
|
+
|
|
29
|
+
## General usage
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
import { MapInfo } from "@rian8337/osu-base";
|
|
33
|
+
import {
|
|
34
|
+
DroidStarRating,
|
|
35
|
+
MapStars,
|
|
36
|
+
OsuStarRating,
|
|
37
|
+
} from "@rian8337/osu-rebalance-difficulty-calculator";
|
|
38
|
+
|
|
39
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
40
|
+
|
|
41
|
+
if (!beatmapInfo.title) {
|
|
42
|
+
return console.log("Beatmap not found");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Calculate osu!droid difficulty
|
|
46
|
+
const droidRating = new DroidStarRating().calculate({
|
|
47
|
+
map: beatmapInfo.map,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
console.log(droidRating);
|
|
51
|
+
|
|
52
|
+
// Calculate osu!standard difficulty
|
|
53
|
+
const osuRating = new OsuStarRating().calculate({
|
|
54
|
+
map: beatmapInfo.map,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
console.log(osuRating);
|
|
58
|
+
|
|
59
|
+
// Calculate both osu!droid and osu!standard difficulty
|
|
60
|
+
const rating = new MapStars().calculate({
|
|
61
|
+
map: beatmapInfo.map,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// osu!droid difficulty
|
|
65
|
+
console.log(rating.droidStars);
|
|
66
|
+
// osu!standard difficulty
|
|
67
|
+
console.log(rating.pcStars);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Specifying parameters
|
|
71
|
+
|
|
72
|
+
Parameters can be applied to alter the result of the calculation:
|
|
73
|
+
|
|
74
|
+
- Mods: Modifications that will be considered when calculating the difficulty of a beatmap. Defaults to none.
|
|
75
|
+
- Custom statistics: Used to apply a custom speed multiplier and force AR. Defaults to none.
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
import { MapInfo, MapStats, ModUtil } from "@rian8337/osu-base";
|
|
79
|
+
import { MapStars } from "@rian8337/osu-rebalance-difficulty-calculator";
|
|
80
|
+
|
|
81
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
82
|
+
|
|
83
|
+
if (!beatmapInfo.title) {
|
|
84
|
+
return console.log("Beatmap not found");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const mods = ModUtil.pcStringToMods("HDHR");
|
|
88
|
+
|
|
89
|
+
const stats = new MapStats({
|
|
90
|
+
ar: 9,
|
|
91
|
+
isForceAR: true,
|
|
92
|
+
speedMultiplier: 1.5,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Also available for `DroidStarRating` and `OsuStarRating`
|
|
96
|
+
const rating = new MapStars().calculate({
|
|
97
|
+
map: beatmapInfo.map,
|
|
98
|
+
mods: mods,
|
|
99
|
+
stats: stats,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// osu!droid difficulty
|
|
103
|
+
console.log(rating.droidStars);
|
|
104
|
+
// osu!standard difficulty
|
|
105
|
+
console.log(rating.pcStars);
|
|
11
106
|
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-rebalance-difficulty-calculator",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A module for calculating osu!standard beatmap difficulty and performance with respect to the latest osu!lazer algorithm.",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "A module for calculating osu!standard beatmap difficulty and performance value with respect to the latest osu!lazer difficulty and performance algorithm.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|
|
7
7
|
"osu-difficulty-calculator"
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@rian8337/osu-base": "^1.0.
|
|
31
|
+
"@rian8337/osu-base": "^1.0.1"
|
|
32
32
|
},
|
|
33
33
|
"publishConfig": {
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "8406e60764d46fc30483b95f56a097f2c0245417"
|
|
37
37
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -1060,16 +1060,6 @@ declare module "@rian8337/osu-rebalance-difficulty-calculator" {
|
|
|
1060
1060
|
* Calculates every star rating of the beatmap and stores it in this instance.
|
|
1061
1061
|
*/
|
|
1062
1062
|
abstract calculateAll(): void;
|
|
1063
|
-
/**
|
|
1064
|
-
* Generates the strain chart of this beatmap and returns the chart as a buffer.
|
|
1065
|
-
*
|
|
1066
|
-
* @param beatmapsetID The beatmapset ID to get background image from. If omitted, the background will be plain white.
|
|
1067
|
-
* @param color The color of the graph.
|
|
1068
|
-
*/
|
|
1069
|
-
getStrainChart(
|
|
1070
|
-
beatmapsetID?: number,
|
|
1071
|
-
color?: string
|
|
1072
|
-
): Promise<Buffer | null>;
|
|
1073
1063
|
/**
|
|
1074
1064
|
* Returns a string representative of the class.
|
|
1075
1065
|
*/
|