@rian8337/osu-droid-replay-analyzer 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 +155 -5
- package/package.json +5 -5
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.1",
|
|
4
4
|
"description": "A replay analyzer for analyzing osu!droid replay files.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"osu",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"url": "https://github.com/Rian8337/osu-droid-module/issues"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@rian8337/osu-base": "^1.0.
|
|
33
|
-
"@rian8337/osu-difficulty-calculator": "^1.0.
|
|
34
|
-
"@rian8337/osu-rebalance-difficulty-calculator": "^1.0.
|
|
32
|
+
"@rian8337/osu-base": "^1.0.1",
|
|
33
|
+
"@rian8337/osu-difficulty-calculator": "^1.0.1",
|
|
34
|
+
"@rian8337/osu-rebalance-difficulty-calculator": "^1.0.1",
|
|
35
35
|
"java-deserialization": "^0.1.0",
|
|
36
36
|
"unzipper": "^0.10.11"
|
|
37
37
|
},
|
|
@@ -43,5 +43,5 @@
|
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public"
|
|
45
45
|
},
|
|
46
|
-
"gitHead": "
|
|
46
|
+
"gitHead": "8406e60764d46fc30483b95f56a097f2c0245417"
|
|
47
47
|
}
|