@rian8337/osu-droid-replay-analyzer 1.0.0 → 1.0.4
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 +155 -5
- package/package.json +7 -5
- package/typings/index.d.ts +22 -1
package/README.md
CHANGED
|
@@ -1,11 +1,161 @@
|
|
|
1
|
-
#
|
|
1
|
+
# About
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A replay analyzer for osu!droid.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
# Features
|
|
6
6
|
|
|
7
|
+
This module allows parsing osu!droid replay files (`.odr`) to get replay information.
|
|
8
|
+
|
|
9
|
+
Additionally, it provides a detection system to detect whether the player used three fingers or more to stream or two hands to jump.
|
|
10
|
+
|
|
11
|
+
Two hand detection is still a WIP.
|
|
12
|
+
|
|
13
|
+
# Specific Requirements
|
|
14
|
+
|
|
15
|
+
This module has no specific requirements, however installed modules in installation may have specific requirements. It's advised to check them.
|
|
16
|
+
|
|
17
|
+
# Installation
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
npm i @rian8337/osu-base @rian8337/osu-droid-replay-analyzer
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
or
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
yarn add @rian8337/osu-base @rian8337/osu-droid-replay-analyzer
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
# Usage
|
|
30
|
+
|
|
31
|
+
To use the replay analyzer, you need a replay file (`.odr`).
|
|
32
|
+
|
|
33
|
+
## Obtaining a replay file
|
|
34
|
+
|
|
35
|
+
There are multiple ways to get one.
|
|
36
|
+
|
|
37
|
+
### Obtaining a replay file with a score ID
|
|
38
|
+
|
|
39
|
+
If you know a score's ID, you can use it to directly retrieve a replay:
|
|
40
|
+
|
|
41
|
+
```js
|
|
42
|
+
import { MapInfo } from "@rian8337/osu-base";
|
|
43
|
+
import { ReplayAnalyzer } from "@rian8337/osu-droid-replay-analyzer";
|
|
44
|
+
|
|
45
|
+
// Obtaining a beatmap file is optional, however it allows the replay analyzer to output more data
|
|
46
|
+
// for old replays (replay version 1 or 2)
|
|
47
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
48
|
+
|
|
49
|
+
if (!beatmapInfo.title) {
|
|
50
|
+
return console.log("Beatmap not found");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// A `ReplayAnalyzer` instance that contains the replay
|
|
54
|
+
const replay = await new ReplayAnalyzer({
|
|
55
|
+
scoreID: 12948732,
|
|
56
|
+
map: beatmapInfo.map,
|
|
57
|
+
}).analyze();
|
|
58
|
+
|
|
59
|
+
// The data of the replay
|
|
60
|
+
const { data } = replay;
|
|
61
|
+
|
|
62
|
+
if (!data) {
|
|
63
|
+
return console.log("Replay not found");
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
console.log(data);
|
|
7
67
|
```
|
|
8
|
-
const osuDroidReplayAnalyzer = require('osu-droid-replay-analyzer');
|
|
9
68
|
|
|
10
|
-
|
|
69
|
+
### Obtaining a local replay file
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import { readFile } from "fs";
|
|
73
|
+
import { MapInfo } from "@rian8337/osu-base";
|
|
74
|
+
import { ReplayAnalyzer } from "@rian8337/osu-droid-replay-analyzer";
|
|
75
|
+
|
|
76
|
+
readFile("path/to/file.odr", async (err, replayData) => {
|
|
77
|
+
if (err) throw err;
|
|
78
|
+
|
|
79
|
+
// Obtaining a beatmap file is optional, however it allows the replay analyzer to output more data
|
|
80
|
+
// for old replays (replay version 1 or 2)
|
|
81
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
82
|
+
|
|
83
|
+
if (!beatmapInfo.title) {
|
|
84
|
+
return console.log("Beatmap not found");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// A `ReplayAnalyzer` instance that contains the replay
|
|
88
|
+
const replay = new ReplayAnalyzer({ scoreID: 0, map: beatmapInfo.map });
|
|
89
|
+
|
|
90
|
+
replay.originalODR = replayData;
|
|
91
|
+
|
|
92
|
+
await replay.analyze();
|
|
93
|
+
|
|
94
|
+
// The data of the replay
|
|
95
|
+
const { data } = replay;
|
|
96
|
+
|
|
97
|
+
console.log(data);
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## Playstyle detections
|
|
102
|
+
|
|
103
|
+
To use this, you need to have a calculated instance of a beatmap from `@rian8337/osu-difficulty-calculator` or `@rian8337/osu-rebalance-difficulty-calculator`:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
npm i @rian8337/osu-difficulty-calculator @rian8337/osu-rebalance-difficulty-calculator
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
or
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
yarn add @rian8337/osu-difficulty-calculator @rian8337/osu-rebalance-difficulty-calculator
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
You can exclude a difficulty module that you don't plan to use.
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import { MapInfo, MapStats } from "@rian8337/osu-base";
|
|
119
|
+
import { DroidStarRating } from "@rian8337/osu-difficulty-calculator";
|
|
120
|
+
import { ReplayAnalyzer } from "@rian8337/osu-droid-replay-analyzer";
|
|
121
|
+
|
|
122
|
+
const beatmapInfo = await MapInfo.getInformation({ beatmapID: 901854 });
|
|
123
|
+
|
|
124
|
+
if (!beatmapInfo.title) {
|
|
125
|
+
return console.log("Beatmap not found");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// A `ReplayAnalyzer` instance that contains the replay
|
|
129
|
+
const replay = await new ReplayAnalyzer({
|
|
130
|
+
scoreID: 12948732,
|
|
131
|
+
map: beatmapInfo.map,
|
|
132
|
+
}).analyze();
|
|
133
|
+
|
|
134
|
+
// The data of the replay
|
|
135
|
+
const { data } = replay;
|
|
136
|
+
|
|
137
|
+
if (!data) {
|
|
138
|
+
return console.log("Replay not found");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const stats = new MapStats({
|
|
142
|
+
ar: data.forcedAR,
|
|
143
|
+
speedMultiplier: data.speedModification,
|
|
144
|
+
isForceAR: !isNaN(data.forcedAR),
|
|
145
|
+
// In osu!droid version 1.6.7 and below, there exists a bug where NC is slower than DT in a few beatmaps
|
|
146
|
+
// This option checks for said condition
|
|
147
|
+
oldStatistics: data.replayVersion <= 3,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
replay.map = new DroidStarRating().calculate({
|
|
151
|
+
map: beatmapInfo.map,
|
|
152
|
+
mods: data.convertedMods,
|
|
153
|
+
stats: stats,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
// Check for three-finger usage
|
|
157
|
+
replay.checkFor3Finger();
|
|
158
|
+
|
|
159
|
+
// Check for two-hand usage
|
|
160
|
+
replay.checkFor2Hand();
|
|
11
161
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rian8337/osu-droid-replay-analyzer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A replay analyzer for analyzing osu!droid replay files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "tsc",
|
|
25
|
+
"generate-docs": "typedoc src/index.ts",
|
|
26
|
+
"lint": "eslint --ext ts",
|
|
25
27
|
"prepare": "dts-gen -m java-deserialization -o -f ./node_modules/java-deserialization/src/index.d.ts && npm run build",
|
|
26
28
|
"test": "echo \"No tests for this module\""
|
|
27
29
|
},
|
|
@@ -29,9 +31,9 @@
|
|
|
29
31
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
30
32
|
},
|
|
31
33
|
"dependencies": {
|
|
32
|
-
"@rian8337/osu-base": "^1.0.
|
|
33
|
-
"@rian8337/osu-difficulty-calculator": "^1.0.
|
|
34
|
-
"@rian8337/osu-rebalance-difficulty-calculator": "^1.0.
|
|
34
|
+
"@rian8337/osu-base": "^1.0.4",
|
|
35
|
+
"@rian8337/osu-difficulty-calculator": "^1.0.4",
|
|
36
|
+
"@rian8337/osu-rebalance-difficulty-calculator": "^1.0.4",
|
|
35
37
|
"java-deserialization": "^0.1.0",
|
|
36
38
|
"unzipper": "^0.10.11"
|
|
37
39
|
},
|
|
@@ -43,5 +45,5 @@
|
|
|
43
45
|
"publishConfig": {
|
|
44
46
|
"access": "public"
|
|
45
47
|
},
|
|
46
|
-
"gitHead": "
|
|
48
|
+
"gitHead": "31e88dedb78e6b1e0123b67bcc5d4dd31f5dfc60"
|
|
47
49
|
}
|
package/typings/index.d.ts
CHANGED
|
@@ -205,6 +205,28 @@ declare module "@rian8337/osu-droid-replay-analyzer" {
|
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Utility to check whether or not a beatmap is three-fingered.
|
|
210
|
+
*/
|
|
211
|
+
export class ThreeFingerChecker {
|
|
212
|
+
/**
|
|
213
|
+
* The beatmap to analyze.
|
|
214
|
+
*/
|
|
215
|
+
readonly map: DroidStarRating | RebalanceDroidStarRating;
|
|
216
|
+
/**
|
|
217
|
+
* The data of the replay.
|
|
218
|
+
*/
|
|
219
|
+
readonly data: ReplayData;
|
|
220
|
+
/**
|
|
221
|
+
* Checks whether a beatmap is eligible to be detected for three finger.
|
|
222
|
+
*
|
|
223
|
+
* @param map The beatmap.
|
|
224
|
+
*/
|
|
225
|
+
static isEligibleToDetect(
|
|
226
|
+
map: DroidStarRating | RebalanceDroidStarRating
|
|
227
|
+
): boolean;
|
|
228
|
+
}
|
|
229
|
+
|
|
208
230
|
//#endregion
|
|
209
231
|
|
|
210
232
|
//#region Enums
|
|
@@ -296,7 +318,6 @@ declare module "@rian8337/osu-droid-replay-analyzer" {
|
|
|
296
318
|
readonly unstableRate: number;
|
|
297
319
|
}
|
|
298
320
|
|
|
299
|
-
|
|
300
321
|
/**
|
|
301
322
|
* Contains information about a replay.
|
|
302
323
|
*/
|