@rian8337/osu-droid-utilities 2.2.0 → 2.3.0

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.
Files changed (3) hide show
  1. package/dist/index.js +308 -308
  2. package/package.json +42 -42
  3. package/typings/index.d.ts +201 -201
package/dist/index.js CHANGED
@@ -6,316 +6,316 @@ var osuBase = require('@rian8337/osu-base');
6
6
  var osuDroidReplayAnalyzer = require('@rian8337/osu-droid-replay-analyzer');
7
7
  var cryptoJs = require('crypto-js');
8
8
 
9
- /**
10
- * Represents an osu!droid score.
11
- */
12
- class Score {
13
- /**
14
- * The uid of the player.
15
- */
16
- uid;
17
- /**
18
- * The ID of the score.
19
- */
20
- scoreID;
21
- /**
22
- * The player's name.
23
- */
24
- username;
25
- /**
26
- * The title of the beatmap.
27
- */
28
- title;
29
- /**
30
- * The maximum combo achieved in the play.
31
- */
32
- combo;
33
- /**
34
- * The score achieved in the play.
35
- */
36
- score;
37
- /**
38
- * The rank achieved in the play.
39
- */
40
- rank;
41
- /**
42
- * The date of which the play was set.
43
- */
44
- date;
45
- /**
46
- * The accuracy achieved in the play.
47
- */
48
- accuracy;
49
- /**
50
- * Enabled modifications in the score.
51
- */
52
- mods;
53
- /**
54
- * MD5 hash of the play.
55
- */
56
- hash;
57
- /**
58
- * The speed multiplier of the play.
59
- */
60
- speedMultiplier = 1;
61
- /**
62
- * The forced AR of the play.
63
- */
64
- forcedAR;
65
- /**
66
- * The replay of the score.
67
- */
68
- replay;
69
- constructor(values) {
70
- this.uid = values?.uid ?? 0;
71
- this.scoreID = values?.scoreID ?? 0;
72
- this.username = values?.username ?? "";
73
- this.title = values?.title ?? "";
74
- this.combo = values?.combo ?? 0;
75
- this.score = values?.score ?? 0;
76
- this.rank = values?.rank ?? "";
77
- this.date = new Date(values?.date ?? 0);
78
- this.accuracy = values?.accuracy ?? new osuBase.Accuracy({});
79
- this.hash = values?.hash ?? "";
80
- const modstrings = (values?.mods ?? "").split("|");
81
- let actualMods = "";
82
- for (let i = 0; i < modstrings.length; ++i) {
83
- if (!modstrings[i]) {
84
- continue;
85
- }
86
- if (modstrings[i].startsWith("AR")) {
87
- this.forcedAR = parseFloat(modstrings[i].replace("AR", ""));
88
- }
89
- else if (modstrings[i].startsWith("x")) {
90
- this.speedMultiplier = parseFloat(modstrings[i].replace("x", ""));
91
- }
92
- else {
93
- actualMods += modstrings[i];
94
- }
95
- }
96
- this.mods = osuBase.ModUtil.droidStringToMods(actualMods);
97
- }
98
- /**
99
- * Retrieves score information on a beatmap from a player.
100
- *
101
- * @param uid The uid of the player.
102
- * @param hash The MD5 hash of the beatmap.
103
- * @returns The score, `null` if the score is not found.
104
- */
105
- static async getFromHash(uid, hash) {
106
- const score = new Score();
107
- const apiRequestBuilder = new osuBase.DroidAPIRequestBuilder()
108
- .setEndpoint("scoresearchv2.php")
109
- .addParameter("uid", uid)
110
- .addParameter("hash", hash);
111
- const result = await apiRequestBuilder.sendRequest();
112
- if (result.statusCode !== 200) {
113
- throw new Error("Error retrieving score data");
114
- }
115
- const entry = result.data.toString("utf-8").split("<br>");
116
- entry.shift();
117
- if (entry.length === 0) {
118
- return null;
119
- }
120
- score.fillInformation(entry[0]);
121
- return score;
122
- }
123
- /**
124
- * Fills this instance with score information.
125
- *
126
- * @param info The score information from API response to fill with.
127
- */
128
- fillInformation(info) {
129
- const play = info.split(" ");
130
- this.scoreID = parseInt(play[0]);
131
- this.uid = parseInt(play[1]);
132
- this.username = play[2];
133
- this.score = parseInt(play[3]);
134
- this.combo = parseInt(play[4]);
135
- this.rank = play[5];
136
- const modstrings = play[6].split("|");
137
- let actualMods = "";
138
- for (let i = 0; i < modstrings.length; ++i) {
139
- if (!modstrings[i]) {
140
- continue;
141
- }
142
- if (modstrings[i].startsWith("AR")) {
143
- this.forcedAR = parseFloat(modstrings[i].replace("AR", ""));
144
- }
145
- else if (modstrings[i].startsWith("x")) {
146
- this.speedMultiplier = parseFloat(modstrings[i].replace("x", ""));
147
- }
148
- else {
149
- actualMods += modstrings[i];
150
- }
151
- }
152
- this.mods = osuBase.ModUtil.droidStringToMods(actualMods);
153
- this.accuracy = new osuBase.Accuracy({
154
- n300: parseInt(play[8]),
155
- n100: parseInt(play[9]),
156
- n50: parseInt(play[10]),
157
- nmiss: parseInt(play[11]),
158
- });
159
- const date = new Date(parseInt(play[12]) * 1000);
160
- date.setUTCHours(date.getUTCHours() + 6);
161
- this.date = date;
162
- this.title = play[13]
163
- .substring(0, play[13].length - 4)
164
- .replace(/_/g, " ");
165
- this.hash = play[14];
166
- return this;
167
- }
168
- /**
169
- * Returns the complete mod string of this score (mods, speed multiplier, and force AR combined).
170
- */
171
- getCompleteModString() {
172
- let finalString = `+${this.mods.length > 0 ? this.mods.map((v) => v.acronym) : "No Mod"}`;
173
- if (this.forcedAR !== undefined || this.speedMultiplier !== 1) {
174
- finalString += " (";
175
- if (this.forcedAR !== undefined) {
176
- finalString += `AR${this.forcedAR}`;
177
- }
178
- if (this.speedMultiplier !== 1) {
179
- if (this.forcedAR !== undefined) {
180
- finalString += ", ";
181
- }
182
- finalString += `${this.speedMultiplier}x`;
183
- }
184
- finalString += ")";
185
- }
186
- return finalString;
187
- }
188
- /**
189
- * Downloads the replay of this score.
190
- */
191
- async downloadReplay() {
192
- if (!this.scoreID || this.replay) {
193
- return;
194
- }
195
- this.replay = await new osuDroidReplayAnalyzer.ReplayAnalyzer({
196
- scoreID: this.scoreID,
197
- }).analyze();
198
- }
199
- /**
200
- * Returns a string representative of the class.
201
- */
202
- toString() {
203
- return `Player: ${this.username}, uid: ${this.uid}, title: ${this.title}, score: ${this.score}, combo: ${this.combo}, rank: ${this.rank}, acc: ${this.accuracy}%, date: ${this.date}, mods: ${this.mods}, hash: ${this.hash}`;
204
- }
9
+ /**
10
+ * Represents an osu!droid score.
11
+ */
12
+ class Score {
13
+ /**
14
+ * The uid of the player.
15
+ */
16
+ uid;
17
+ /**
18
+ * The ID of the score.
19
+ */
20
+ scoreID;
21
+ /**
22
+ * The player's name.
23
+ */
24
+ username;
25
+ /**
26
+ * The title of the beatmap.
27
+ */
28
+ title;
29
+ /**
30
+ * The maximum combo achieved in the play.
31
+ */
32
+ combo;
33
+ /**
34
+ * The score achieved in the play.
35
+ */
36
+ score;
37
+ /**
38
+ * The rank achieved in the play.
39
+ */
40
+ rank;
41
+ /**
42
+ * The date of which the play was set.
43
+ */
44
+ date;
45
+ /**
46
+ * The accuracy achieved in the play.
47
+ */
48
+ accuracy;
49
+ /**
50
+ * Enabled modifications in the score.
51
+ */
52
+ mods;
53
+ /**
54
+ * MD5 hash of the play.
55
+ */
56
+ hash;
57
+ /**
58
+ * The speed multiplier of the play.
59
+ */
60
+ speedMultiplier = 1;
61
+ /**
62
+ * The forced AR of the play.
63
+ */
64
+ forcedAR;
65
+ /**
66
+ * The replay of the score.
67
+ */
68
+ replay;
69
+ constructor(values) {
70
+ this.uid = values?.uid ?? 0;
71
+ this.scoreID = values?.scoreID ?? 0;
72
+ this.username = values?.username ?? "";
73
+ this.title = values?.title ?? "";
74
+ this.combo = values?.combo ?? 0;
75
+ this.score = values?.score ?? 0;
76
+ this.rank = values?.rank ?? "";
77
+ this.date = new Date(values?.date ?? 0);
78
+ this.accuracy = values?.accuracy ?? new osuBase.Accuracy({});
79
+ this.hash = values?.hash ?? "";
80
+ const modstrings = (values?.mods ?? "").split("|");
81
+ let actualMods = "";
82
+ for (let i = 0; i < modstrings.length; ++i) {
83
+ if (!modstrings[i]) {
84
+ continue;
85
+ }
86
+ if (modstrings[i].startsWith("AR")) {
87
+ this.forcedAR = parseFloat(modstrings[i].replace("AR", ""));
88
+ }
89
+ else if (modstrings[i].startsWith("x")) {
90
+ this.speedMultiplier = parseFloat(modstrings[i].replace("x", ""));
91
+ }
92
+ else {
93
+ actualMods += modstrings[i];
94
+ }
95
+ }
96
+ this.mods = osuBase.ModUtil.droidStringToMods(actualMods);
97
+ }
98
+ /**
99
+ * Retrieves score information on a beatmap from a player.
100
+ *
101
+ * @param uid The uid of the player.
102
+ * @param hash The MD5 hash of the beatmap.
103
+ * @returns The score, `null` if the score is not found.
104
+ */
105
+ static async getFromHash(uid, hash) {
106
+ const score = new Score();
107
+ const apiRequestBuilder = new osuBase.DroidAPIRequestBuilder()
108
+ .setEndpoint("scoresearchv2.php")
109
+ .addParameter("uid", uid)
110
+ .addParameter("hash", hash);
111
+ const result = await apiRequestBuilder.sendRequest();
112
+ if (result.statusCode !== 200) {
113
+ throw new Error("Error retrieving score data");
114
+ }
115
+ const entry = result.data.toString("utf-8").split("<br>");
116
+ entry.shift();
117
+ if (entry.length === 0) {
118
+ return null;
119
+ }
120
+ score.fillInformation(entry[0]);
121
+ return score;
122
+ }
123
+ /**
124
+ * Fills this instance with score information.
125
+ *
126
+ * @param info The score information from API response to fill with.
127
+ */
128
+ fillInformation(info) {
129
+ const play = info.split(" ");
130
+ this.scoreID = parseInt(play[0]);
131
+ this.uid = parseInt(play[1]);
132
+ this.username = play[2];
133
+ this.score = parseInt(play[3]);
134
+ this.combo = parseInt(play[4]);
135
+ this.rank = play[5];
136
+ const modstrings = play[6].split("|");
137
+ let actualMods = "";
138
+ for (let i = 0; i < modstrings.length; ++i) {
139
+ if (!modstrings[i]) {
140
+ continue;
141
+ }
142
+ if (modstrings[i].startsWith("AR")) {
143
+ this.forcedAR = parseFloat(modstrings[i].replace("AR", ""));
144
+ }
145
+ else if (modstrings[i].startsWith("x")) {
146
+ this.speedMultiplier = parseFloat(modstrings[i].replace("x", ""));
147
+ }
148
+ else {
149
+ actualMods += modstrings[i];
150
+ }
151
+ }
152
+ this.mods = osuBase.ModUtil.droidStringToMods(actualMods);
153
+ this.accuracy = new osuBase.Accuracy({
154
+ n300: parseInt(play[8]),
155
+ n100: parseInt(play[9]),
156
+ n50: parseInt(play[10]),
157
+ nmiss: parseInt(play[11]),
158
+ });
159
+ const date = new Date(parseInt(play[12]) * 1000);
160
+ date.setUTCHours(date.getUTCHours() + 6);
161
+ this.date = date;
162
+ this.title = play[13]
163
+ .substring(0, play[13].length - 4)
164
+ .replace(/_/g, " ");
165
+ this.hash = play[14];
166
+ return this;
167
+ }
168
+ /**
169
+ * Returns the complete mod string of this score (mods, speed multiplier, and force AR combined).
170
+ */
171
+ getCompleteModString() {
172
+ let finalString = `+${this.mods.length > 0 ? this.mods.map((v) => v.acronym) : "No Mod"}`;
173
+ if (this.forcedAR !== undefined || this.speedMultiplier !== 1) {
174
+ finalString += " (";
175
+ if (this.forcedAR !== undefined) {
176
+ finalString += `AR${this.forcedAR}`;
177
+ }
178
+ if (this.speedMultiplier !== 1) {
179
+ if (this.forcedAR !== undefined) {
180
+ finalString += ", ";
181
+ }
182
+ finalString += `${this.speedMultiplier}x`;
183
+ }
184
+ finalString += ")";
185
+ }
186
+ return finalString;
187
+ }
188
+ /**
189
+ * Downloads the replay of this score.
190
+ */
191
+ async downloadReplay() {
192
+ if (!this.scoreID || this.replay) {
193
+ return;
194
+ }
195
+ this.replay = await new osuDroidReplayAnalyzer.ReplayAnalyzer({
196
+ scoreID: this.scoreID,
197
+ }).analyze();
198
+ }
199
+ /**
200
+ * Returns a string representative of the class.
201
+ */
202
+ toString() {
203
+ return `Player: ${this.username}, uid: ${this.uid}, title: ${this.title}, score: ${this.score}, combo: ${this.combo}, rank: ${this.rank}, acc: ${this.accuracy}%, date: ${this.date}, mods: ${this.mods}, hash: ${this.hash}`;
204
+ }
205
205
  }
206
206
 
207
- /**
208
- * Represents an osu!droid player.
209
- */
210
- class Player {
211
- /**
212
- * The uid of the player.
213
- */
214
- uid = 0;
215
- /**
216
- * The username of the player.
217
- */
218
- username = "";
219
- /**
220
- * The avatar URL of the player.
221
- */
222
- avatarURL = "";
223
- /**
224
- * The location of the player based on ISO 3166-1 country codes. See {@link https://en.wikipedia.org/wiki/ISO_3166-1 this} Wikipedia page for more information.
225
- */
226
- location = "";
227
- /**
228
- * The email that is attached to the player's account.
229
- */
230
- email = "";
231
- /**
232
- * The overall rank of the player.
233
- */
234
- rank = 0;
235
- /**
236
- * The total score of the player.
237
- */
238
- score = 0;
239
- /**
240
- * The overall accuracy of the player.
241
- */
242
- accuracy = 0;
243
- /**
244
- * The amount of times the player has played.
245
- */
246
- playCount = 0;
247
- /**
248
- * Recent plays of the player.
249
- */
250
- recentPlays = [];
251
- static async getInformation(uidOrUsername) {
252
- const player = new Player();
253
- const apiRequestBuilder = new osuBase.DroidAPIRequestBuilder()
254
- .setEndpoint("getuserinfo.php")
255
- .addParameter(typeof uidOrUsername === "number" ? "uid" : "username", uidOrUsername);
256
- const result = await apiRequestBuilder.sendRequest();
257
- if (result.statusCode !== 200) {
258
- throw new Error("Error retrieving player data");
259
- }
260
- const data = result.data.toString("utf-8");
261
- const resArr = data.split("<br>");
262
- const headerRes = resArr[0].split(" ");
263
- if (headerRes[0] === "FAILED") {
264
- return null;
265
- }
266
- player.fillInformation(data);
267
- return player;
268
- }
269
- /**
270
- * Fills this instance with player information.
271
- *
272
- * @param info The player information from API response to fill with.
273
- */
274
- fillInformation(info) {
275
- const resArr = info.split("<br>");
276
- const headerRes = resArr[0].split(" ");
277
- if (headerRes[0] === "FAILED") {
278
- return this;
279
- }
280
- const obj = JSON.parse(resArr[1]);
281
- this.uid = parseInt(headerRes[1]);
282
- this.username = headerRes[2];
283
- this.score = parseInt(headerRes[3]);
284
- this.playCount = parseInt(headerRes[4]);
285
- this.accuracy = parseFloat((parseFloat(headerRes[5]) * 100).toFixed(2));
286
- this.email = headerRes[6];
287
- this.location = headerRes[7];
288
- this.avatarURL = `https://osudroid.moe/user/avatar?id=${cryptoJs.MD5(this.email.trim().toLowerCase()).toString()}&s=200`;
289
- this.rank = obj.rank;
290
- const recent = obj.recent;
291
- for (const play of recent) {
292
- this.recentPlays.push(new Score({
293
- uid: this.uid,
294
- username: this.username,
295
- scoreID: play.scoreid,
296
- score: play.score,
297
- accuracy: new osuBase.Accuracy({
298
- n300: play.perfect,
299
- n100: play.good,
300
- n50: play.bad,
301
- nmiss: play.miss,
302
- }),
303
- rank: play.mark,
304
- combo: play.combo,
305
- title: play.filename,
306
- date: (play.date + 3600 * 6) * 1000,
307
- mods: play.mode,
308
- hash: play.hash,
309
- }));
310
- }
311
- return this;
312
- }
313
- /**
314
- * Returns a string representative of the class.
315
- */
316
- toString() {
317
- return `Username: ${this.username}\nUID: ${this.uid}\nRank: ${this.rank}\nScore: ${this.score}\nPlay count: ${this.playCount}`;
318
- }
207
+ /**
208
+ * Represents an osu!droid player.
209
+ */
210
+ class Player {
211
+ /**
212
+ * The uid of the player.
213
+ */
214
+ uid = 0;
215
+ /**
216
+ * The username of the player.
217
+ */
218
+ username = "";
219
+ /**
220
+ * The avatar URL of the player.
221
+ */
222
+ avatarURL = "";
223
+ /**
224
+ * The location of the player based on ISO 3166-1 country codes. See {@link https://en.wikipedia.org/wiki/ISO_3166-1 this} Wikipedia page for more information.
225
+ */
226
+ location = "";
227
+ /**
228
+ * The email that is attached to the player's account.
229
+ */
230
+ email = "";
231
+ /**
232
+ * The overall rank of the player.
233
+ */
234
+ rank = 0;
235
+ /**
236
+ * The total score of the player.
237
+ */
238
+ score = 0;
239
+ /**
240
+ * The overall accuracy of the player.
241
+ */
242
+ accuracy = 0;
243
+ /**
244
+ * The amount of times the player has played.
245
+ */
246
+ playCount = 0;
247
+ /**
248
+ * Recent plays of the player.
249
+ */
250
+ recentPlays = [];
251
+ static async getInformation(uidOrUsername) {
252
+ const player = new Player();
253
+ const apiRequestBuilder = new osuBase.DroidAPIRequestBuilder()
254
+ .setEndpoint("getuserinfo.php")
255
+ .addParameter(typeof uidOrUsername === "number" ? "uid" : "username", uidOrUsername);
256
+ const result = await apiRequestBuilder.sendRequest();
257
+ if (result.statusCode !== 200) {
258
+ throw new Error("Error retrieving player data");
259
+ }
260
+ const data = result.data.toString("utf-8");
261
+ const resArr = data.split("<br>");
262
+ const headerRes = resArr[0].split(" ");
263
+ if (headerRes[0] === "FAILED") {
264
+ return null;
265
+ }
266
+ player.fillInformation(data);
267
+ return player;
268
+ }
269
+ /**
270
+ * Fills this instance with player information.
271
+ *
272
+ * @param info The player information from API response to fill with.
273
+ */
274
+ fillInformation(info) {
275
+ const resArr = info.split("<br>");
276
+ const headerRes = resArr[0].split(" ");
277
+ if (headerRes[0] === "FAILED") {
278
+ return this;
279
+ }
280
+ const obj = JSON.parse(resArr[1]);
281
+ this.uid = parseInt(headerRes[1]);
282
+ this.username = headerRes[2];
283
+ this.score = parseInt(headerRes[3]);
284
+ this.playCount = parseInt(headerRes[4]);
285
+ this.accuracy = parseFloat((parseFloat(headerRes[5]) * 100).toFixed(2));
286
+ this.email = headerRes[6];
287
+ this.location = headerRes[7];
288
+ this.avatarURL = `https://osudroid.moe/user/avatar?id=${cryptoJs.MD5(this.email.trim().toLowerCase()).toString()}&s=200`;
289
+ this.rank = obj.rank;
290
+ const recent = obj.recent;
291
+ for (const play of recent) {
292
+ this.recentPlays.push(new Score({
293
+ uid: this.uid,
294
+ username: this.username,
295
+ scoreID: play.scoreid,
296
+ score: play.score,
297
+ accuracy: new osuBase.Accuracy({
298
+ n300: play.perfect,
299
+ n100: play.good,
300
+ n50: play.bad,
301
+ nmiss: play.miss,
302
+ }),
303
+ rank: play.mark,
304
+ combo: play.combo,
305
+ title: play.filename,
306
+ date: (play.date + 3600 * 6) * 1000,
307
+ mods: play.mode,
308
+ hash: play.hash,
309
+ }));
310
+ }
311
+ return this;
312
+ }
313
+ /**
314
+ * Returns a string representative of the class.
315
+ */
316
+ toString() {
317
+ return `Username: ${this.username}\nUID: ${this.uid}\nRank: ${this.rank}\nScore: ${this.score}\nPlay count: ${this.playCount}`;
318
+ }
319
319
  }
320
320
 
321
321
  exports.Player = Player;
package/package.json CHANGED
@@ -1,44 +1,44 @@
1
1
  {
2
- "name": "@rian8337/osu-droid-utilities",
3
- "version": "2.2.0",
4
- "description": "A module containing utilities for osu!droid.",
5
- "keywords": [
6
- "osu",
7
- "osu-droid"
8
- ],
9
- "author": "Rian8337 <52914632+Rian8337@users.noreply.github.com>",
10
- "homepage": "https://github.com/Rian8337/osu-droid-module#readme",
11
- "license": "MIT",
12
- "main": "dist/index.js",
13
- "typings": "typings/index.d.ts",
14
- "typedocMain": "src/index.ts",
15
- "files": [
16
- "dist/**",
17
- "typings/**"
18
- ],
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/Rian8337/osu-droid-module.git"
22
- },
23
- "scripts": {
24
- "build": "rollup -c ../../rollup.config.js",
25
- "lint": "eslint --ext ts",
26
- "prepare": "npm run build",
27
- "test": "jest"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/Rian8337/osu-droid-module/issues"
31
- },
32
- "dependencies": {
33
- "@rian8337/osu-base": "^2.2.0",
34
- "@rian8337/osu-droid-replay-analyzer": "^2.2.0",
35
- "crypto-js": "^4.1.1"
36
- },
37
- "publishConfig": {
38
- "access": "public"
39
- },
40
- "devDependencies": {
41
- "@types/crypto-js": "^4.1.0"
42
- },
43
- "gitHead": "e8ab54978ffed744317da3dd0073bd4df4d97319"
2
+ "name": "@rian8337/osu-droid-utilities",
3
+ "version": "2.3.0",
4
+ "description": "A module containing utilities for osu!droid.",
5
+ "keywords": [
6
+ "osu",
7
+ "osu-droid"
8
+ ],
9
+ "author": "Rian8337 <52914632+Rian8337@users.noreply.github.com>",
10
+ "homepage": "https://github.com/Rian8337/osu-droid-module#readme",
11
+ "license": "MIT",
12
+ "main": "dist/index.js",
13
+ "typings": "typings/index.d.ts",
14
+ "typedocMain": "src/index.ts",
15
+ "files": [
16
+ "dist/**",
17
+ "typings/**"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/Rian8337/osu-droid-module.git"
22
+ },
23
+ "scripts": {
24
+ "build": "rollup -c ../../rollup.config.js",
25
+ "lint": "eslint --ext ts",
26
+ "prepare": "npm run build",
27
+ "test": "jest"
28
+ },
29
+ "bugs": {
30
+ "url": "https://github.com/Rian8337/osu-droid-module/issues"
31
+ },
32
+ "dependencies": {
33
+ "@rian8337/osu-base": "^2.3.0",
34
+ "@rian8337/osu-droid-replay-analyzer": "^2.3.0",
35
+ "crypto-js": "^4.1.1"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "devDependencies": {
41
+ "@types/crypto-js": "^4.1.0"
42
+ },
43
+ "gitHead": "3689cb59c0055b50afe21c0b2402d9fe201bb58a"
44
44
  }
@@ -1,209 +1,209 @@
1
1
  import { Accuracy, Mod } from '@rian8337/osu-base';
2
2
  import { ReplayAnalyzer } from '@rian8337/osu-droid-replay-analyzer';
3
3
 
4
- interface ScoreInformation {
5
- /**
6
- * The uid of the player.
7
- */
8
- uid?: number;
9
- /**
10
- * The ID of the score.
11
- */
12
- scoreID?: number;
13
- /**
14
- * The player's name.
15
- */
16
- username: string;
17
- /**
18
- * The title of the beatmap.
19
- */
20
- title: string;
21
- /**
22
- * The maximum combo achieved in the play.
23
- */
24
- combo: number;
25
- /**
26
- * The score achieved in the play.
27
- */
28
- score: number;
29
- /**
30
- * The rank achieved in the play.
31
- */
32
- rank: string;
33
- /**
34
- * The date of which the play was set.
35
- */
36
- date: Date | number;
37
- /**
38
- * The accuracy achieved in the play.
39
- */
40
- accuracy: Accuracy;
41
- /**
42
- * Enabled modifications in the score, including force AR and custom speed multiplier.
43
- */
44
- mods: string;
45
- /**
46
- * MD5 hash of the play.
47
- */
48
- hash: string;
49
- }
50
- /**
51
- * Represents an osu!droid score.
52
- */
53
- declare class Score {
54
- /**
55
- * The uid of the player.
56
- */
57
- uid: number;
58
- /**
59
- * The ID of the score.
60
- */
61
- scoreID: number;
62
- /**
63
- * The player's name.
64
- */
65
- username: string;
66
- /**
67
- * The title of the beatmap.
68
- */
69
- title: string;
70
- /**
71
- * The maximum combo achieved in the play.
72
- */
73
- combo: number;
74
- /**
75
- * The score achieved in the play.
76
- */
77
- score: number;
78
- /**
79
- * The rank achieved in the play.
80
- */
81
- rank: string;
82
- /**
83
- * The date of which the play was set.
84
- */
85
- date: Date;
86
- /**
87
- * The accuracy achieved in the play.
88
- */
89
- accuracy: Accuracy;
90
- /**
91
- * Enabled modifications in the score.
92
- */
93
- mods: Mod[];
94
- /**
95
- * MD5 hash of the play.
96
- */
97
- hash: string;
98
- /**
99
- * The speed multiplier of the play.
100
- */
101
- speedMultiplier: number;
102
- /**
103
- * The forced AR of the play.
104
- */
105
- forcedAR?: number;
106
- /**
107
- * The replay of the score.
108
- */
109
- replay?: ReplayAnalyzer;
110
- constructor(values?: ScoreInformation);
111
- /**
112
- * Retrieves score information on a beatmap from a player.
113
- *
114
- * @param uid The uid of the player.
115
- * @param hash The MD5 hash of the beatmap.
116
- * @returns The score, `null` if the score is not found.
117
- */
118
- static getFromHash(uid: number, hash: string): Promise<Score | null>;
119
- /**
120
- * Fills this instance with score information.
121
- *
122
- * @param info The score information from API response to fill with.
123
- */
124
- fillInformation(info: string): Score;
125
- /**
126
- * Returns the complete mod string of this score (mods, speed multiplier, and force AR combined).
127
- */
128
- getCompleteModString(): string;
129
- /**
130
- * Downloads the replay of this score.
131
- */
132
- downloadReplay(): Promise<void>;
133
- /**
134
- * Returns a string representative of the class.
135
- */
136
- toString(): string;
4
+ interface ScoreInformation {
5
+ /**
6
+ * The uid of the player.
7
+ */
8
+ uid?: number;
9
+ /**
10
+ * The ID of the score.
11
+ */
12
+ scoreID?: number;
13
+ /**
14
+ * The player's name.
15
+ */
16
+ username: string;
17
+ /**
18
+ * The title of the beatmap.
19
+ */
20
+ title: string;
21
+ /**
22
+ * The maximum combo achieved in the play.
23
+ */
24
+ combo: number;
25
+ /**
26
+ * The score achieved in the play.
27
+ */
28
+ score: number;
29
+ /**
30
+ * The rank achieved in the play.
31
+ */
32
+ rank: string;
33
+ /**
34
+ * The date of which the play was set.
35
+ */
36
+ date: Date | number;
37
+ /**
38
+ * The accuracy achieved in the play.
39
+ */
40
+ accuracy: Accuracy;
41
+ /**
42
+ * Enabled modifications in the score, including force AR and custom speed multiplier.
43
+ */
44
+ mods: string;
45
+ /**
46
+ * MD5 hash of the play.
47
+ */
48
+ hash: string;
49
+ }
50
+ /**
51
+ * Represents an osu!droid score.
52
+ */
53
+ declare class Score {
54
+ /**
55
+ * The uid of the player.
56
+ */
57
+ uid: number;
58
+ /**
59
+ * The ID of the score.
60
+ */
61
+ scoreID: number;
62
+ /**
63
+ * The player's name.
64
+ */
65
+ username: string;
66
+ /**
67
+ * The title of the beatmap.
68
+ */
69
+ title: string;
70
+ /**
71
+ * The maximum combo achieved in the play.
72
+ */
73
+ combo: number;
74
+ /**
75
+ * The score achieved in the play.
76
+ */
77
+ score: number;
78
+ /**
79
+ * The rank achieved in the play.
80
+ */
81
+ rank: string;
82
+ /**
83
+ * The date of which the play was set.
84
+ */
85
+ date: Date;
86
+ /**
87
+ * The accuracy achieved in the play.
88
+ */
89
+ accuracy: Accuracy;
90
+ /**
91
+ * Enabled modifications in the score.
92
+ */
93
+ mods: Mod[];
94
+ /**
95
+ * MD5 hash of the play.
96
+ */
97
+ hash: string;
98
+ /**
99
+ * The speed multiplier of the play.
100
+ */
101
+ speedMultiplier: number;
102
+ /**
103
+ * The forced AR of the play.
104
+ */
105
+ forcedAR?: number;
106
+ /**
107
+ * The replay of the score.
108
+ */
109
+ replay?: ReplayAnalyzer;
110
+ constructor(values?: ScoreInformation);
111
+ /**
112
+ * Retrieves score information on a beatmap from a player.
113
+ *
114
+ * @param uid The uid of the player.
115
+ * @param hash The MD5 hash of the beatmap.
116
+ * @returns The score, `null` if the score is not found.
117
+ */
118
+ static getFromHash(uid: number, hash: string): Promise<Score | null>;
119
+ /**
120
+ * Fills this instance with score information.
121
+ *
122
+ * @param info The score information from API response to fill with.
123
+ */
124
+ fillInformation(info: string): Score;
125
+ /**
126
+ * Returns the complete mod string of this score (mods, speed multiplier, and force AR combined).
127
+ */
128
+ getCompleteModString(): string;
129
+ /**
130
+ * Downloads the replay of this score.
131
+ */
132
+ downloadReplay(): Promise<void>;
133
+ /**
134
+ * Returns a string representative of the class.
135
+ */
136
+ toString(): string;
137
137
  }
138
138
 
139
- /**
140
- * Represents an osu!droid player.
141
- */
142
- declare class Player {
143
- /**
144
- * The uid of the player.
145
- */
146
- uid: number;
147
- /**
148
- * The username of the player.
149
- */
150
- username: string;
151
- /**
152
- * The avatar URL of the player.
153
- */
154
- avatarURL: string;
155
- /**
156
- * The location of the player based on ISO 3166-1 country codes. See {@link https://en.wikipedia.org/wiki/ISO_3166-1 this} Wikipedia page for more information.
157
- */
158
- location: string;
159
- /**
160
- * The email that is attached to the player's account.
161
- */
162
- email: string;
163
- /**
164
- * The overall rank of the player.
165
- */
166
- rank: number;
167
- /**
168
- * The total score of the player.
169
- */
170
- score: number;
171
- /**
172
- * The overall accuracy of the player.
173
- */
174
- accuracy: number;
175
- /**
176
- * The amount of times the player has played.
177
- */
178
- playCount: number;
179
- /**
180
- * Recent plays of the player.
181
- */
182
- readonly recentPlays: Score[];
183
- /**
184
- * Retrieves a player's info based on their uid.
185
- *
186
- * @param uid The uid of the player.
187
- * @returns The player, `null` if the player is not found.
188
- */
189
- static getInformation(uid: number): Promise<Player | null>;
190
- /**
191
- * Retrieves a player's info based on their username.
192
- *
193
- * @param username The username of the player.
194
- * @returns The player, `null` if the player is not found.
195
- */
196
- static getInformation(username: string): Promise<Player | null>;
197
- /**
198
- * Fills this instance with player information.
199
- *
200
- * @param info The player information from API response to fill with.
201
- */
202
- fillInformation(info: string): Player;
203
- /**
204
- * Returns a string representative of the class.
205
- */
206
- toString(): string;
139
+ /**
140
+ * Represents an osu!droid player.
141
+ */
142
+ declare class Player {
143
+ /**
144
+ * The uid of the player.
145
+ */
146
+ uid: number;
147
+ /**
148
+ * The username of the player.
149
+ */
150
+ username: string;
151
+ /**
152
+ * The avatar URL of the player.
153
+ */
154
+ avatarURL: string;
155
+ /**
156
+ * The location of the player based on ISO 3166-1 country codes. See {@link https://en.wikipedia.org/wiki/ISO_3166-1 this} Wikipedia page for more information.
157
+ */
158
+ location: string;
159
+ /**
160
+ * The email that is attached to the player's account.
161
+ */
162
+ email: string;
163
+ /**
164
+ * The overall rank of the player.
165
+ */
166
+ rank: number;
167
+ /**
168
+ * The total score of the player.
169
+ */
170
+ score: number;
171
+ /**
172
+ * The overall accuracy of the player.
173
+ */
174
+ accuracy: number;
175
+ /**
176
+ * The amount of times the player has played.
177
+ */
178
+ playCount: number;
179
+ /**
180
+ * Recent plays of the player.
181
+ */
182
+ readonly recentPlays: Score[];
183
+ /**
184
+ * Retrieves a player's info based on their uid.
185
+ *
186
+ * @param uid The uid of the player.
187
+ * @returns The player, `null` if the player is not found.
188
+ */
189
+ static getInformation(uid: number): Promise<Player | null>;
190
+ /**
191
+ * Retrieves a player's info based on their username.
192
+ *
193
+ * @param username The username of the player.
194
+ * @returns The player, `null` if the player is not found.
195
+ */
196
+ static getInformation(username: string): Promise<Player | null>;
197
+ /**
198
+ * Fills this instance with player information.
199
+ *
200
+ * @param info The player information from API response to fill with.
201
+ */
202
+ fillInformation(info: string): Player;
203
+ /**
204
+ * Returns a string representative of the class.
205
+ */
206
+ toString(): string;
207
207
  }
208
208
 
209
209
  export { Player, Score };