bancho.js 0.11.4 → 0.11.6
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/CHANGELOG.md +11 -0
- package/README.md +1 -1
- package/index.d.ts +6 -0
- package/lib/BanchoClient.js +2 -2
- package/lib/Multiplayer/BanchoLobby.js +44 -0
- package/lib/Multiplayer/BanchoLobbyRegexes.js +39 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
## Version 0.11
|
|
4
4
|
|
|
5
|
+
### Version 0.11.6
|
|
6
|
+
|
|
7
|
+
- **BanchoLobby: Add timer events**
|
|
8
|
+
Added the following events for `!mp timer`: `timerTick`, `timerAborted`, `timerEnded`
|
|
9
|
+
Added the following events for `!mp start`: `startTimerStarted`, `startTimerTick`, `startTimerAborted`
|
|
10
|
+
They are emitted with a `seconds` parameter where applicable.
|
|
11
|
+
|
|
12
|
+
### Version 0.11.5
|
|
13
|
+
|
|
14
|
+
- Apply new personal account rate limits
|
|
15
|
+
|
|
5
16
|
### Version 0.11.4
|
|
6
17
|
|
|
7
18
|
- Add argument types to utility functions
|
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
[](https://nodei.co/npm/bancho.js/)
|
|
4
4
|
[](https://git.cartooncraft.fr/ThePooN/bancho.js/commits/master)
|
|
5
5
|
|
|
6
|
-
## Current release: 0.11.
|
|
6
|
+
## Current release: 0.11.6
|
|
7
7
|
|
|
8
8
|
# Introduction
|
|
9
9
|
|
package/index.d.ts
CHANGED
|
@@ -599,6 +599,12 @@ declare module "bancho.js" {
|
|
|
599
599
|
on(event: "winCondition", listener: (winCondition: number) => void): this
|
|
600
600
|
on(event: "userNotFound", listener: () => void): this
|
|
601
601
|
on(event: "userNotFoundUsername", listener: (username: string) => void): this
|
|
602
|
+
on(event: "timerEnded", listener: () => void): this
|
|
603
|
+
on(event: "timerAborted", listener: () => void): this
|
|
604
|
+
on(event: "timerTick", listener: (seconds: number) => void): this
|
|
605
|
+
on(event: "startTimerStarted", listener: (seconds: number) => void): this
|
|
606
|
+
on(event: "startTimerAborted", listener: () => void): this
|
|
607
|
+
on(event: "startTimerTick", listener: (seconds: number) => void): this
|
|
602
608
|
}
|
|
603
609
|
|
|
604
610
|
export class BanchoLobbyPlayer {
|
package/lib/BanchoClient.js
CHANGED
|
@@ -63,8 +63,8 @@ class BanchoClient extends EventEmitter {
|
|
|
63
63
|
const options = {
|
|
64
64
|
host: "irc.ppy.sh",
|
|
65
65
|
port: 6667,
|
|
66
|
-
limiterTimespan:
|
|
67
|
-
limiterPrivate:
|
|
66
|
+
limiterTimespan: 25000,
|
|
67
|
+
limiterPrivate: 18,
|
|
68
68
|
limiterPublic: undefined,
|
|
69
69
|
botAccount: false,
|
|
70
70
|
gamemode: null,
|
|
@@ -413,6 +413,50 @@ class BanchoLobby extends EventEmitter {
|
|
|
413
413
|
|
|
414
414
|
this.emit("matchSettings", ret);
|
|
415
415
|
break;
|
|
416
|
+
case "timerEnded":
|
|
417
|
+
case "timerAborted":
|
|
418
|
+
/**
|
|
419
|
+
* Emitted when a timer ends
|
|
420
|
+
* @event BanchoLobby#timerEnded
|
|
421
|
+
*/
|
|
422
|
+
/**
|
|
423
|
+
* Emitted when a timer is aborted
|
|
424
|
+
* @event BanchoLobby#timerAborted
|
|
425
|
+
*/
|
|
426
|
+
this.emit(regex.name);
|
|
427
|
+
break;
|
|
428
|
+
case "timerTick":
|
|
429
|
+
/**
|
|
430
|
+
* Emitted when a timer ticks
|
|
431
|
+
* @event BanchoLobby#timerTick
|
|
432
|
+
* @type {object}
|
|
433
|
+
* @prop {number} seconds
|
|
434
|
+
*/
|
|
435
|
+
this.emit(regex.name, ret.seconds);
|
|
436
|
+
break;
|
|
437
|
+
case "startTimerStarted":
|
|
438
|
+
/**
|
|
439
|
+
* Emitted when a start timer is started
|
|
440
|
+
* @event BanchoLobby#startTimerStarted
|
|
441
|
+
*/
|
|
442
|
+
this.emit(regex.name, ret.seconds);
|
|
443
|
+
break;
|
|
444
|
+
case "startTimerAborted":
|
|
445
|
+
/**
|
|
446
|
+
* Emitted when a start timer is aborted
|
|
447
|
+
* @event BanchoLobby#startTimerAborted
|
|
448
|
+
*/
|
|
449
|
+
this.emit(regex.name);
|
|
450
|
+
break;
|
|
451
|
+
case "startTimerTick":
|
|
452
|
+
/**
|
|
453
|
+
* Emitted when a start timer ticks
|
|
454
|
+
* @event BanchoLobby#startTimerTick
|
|
455
|
+
* @type {object}
|
|
456
|
+
* @prop {number} seconds
|
|
457
|
+
*/
|
|
458
|
+
this.emit(regex.name, ret.seconds);
|
|
459
|
+
break;
|
|
416
460
|
}
|
|
417
461
|
}
|
|
418
462
|
}
|
|
@@ -291,6 +291,45 @@ module.exports = {
|
|
|
291
291
|
},
|
|
292
292
|
hostCleared: function(str) {
|
|
293
293
|
return str == "Cleared match host";
|
|
294
|
+
},
|
|
295
|
+
timerEnded: function(str) {
|
|
296
|
+
return str == "Countdown finished";
|
|
297
|
+
},
|
|
298
|
+
timerAborted: function(str) {
|
|
299
|
+
return str == "Countdown aborted";
|
|
300
|
+
},
|
|
301
|
+
timerTick: function(str) {
|
|
302
|
+
const r = /^Countdown ends in (\d+) (minute|second)s?(?: and (\d+) seconds?)?$/;
|
|
303
|
+
if(r.test(str)) {
|
|
304
|
+
const m = r.exec(str);
|
|
305
|
+
|
|
306
|
+
return {
|
|
307
|
+
seconds: Number(m[1]) * (m[2] === "minute" ? 60 : 1) + (m[3] ? Number(m[3]) : 0)
|
|
308
|
+
};
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
startTimerStarted: function(str) {
|
|
312
|
+
const r = /^Queued the match to start in (\d+) (minute|second)s?(?: and (\d+) seconds?)?$/;
|
|
313
|
+
if(r.test(str)) {
|
|
314
|
+
const m = r.exec(str);
|
|
315
|
+
|
|
316
|
+
return {
|
|
317
|
+
seconds: Number(m[1]) * (m[2] === "minute" ? 60 : 1) + (m[3] ? Number(m[3]) : 0)
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
startTimerAborted: function(str) {
|
|
322
|
+
return str == "Aborted the match start timer";
|
|
323
|
+
},
|
|
324
|
+
startTimerTick: function(str) {
|
|
325
|
+
const r = /^Match starts in (\d+) (minute|second)s?(?: and (\d+) seconds?)?$/;
|
|
326
|
+
if(r.test(str)) {
|
|
327
|
+
const m = r.exec(str);
|
|
328
|
+
|
|
329
|
+
return {
|
|
330
|
+
seconds: Number(m[1]) * (m[2] === "minute" ? 60 : 1) + (m[3] ? Number(m[3]) : 0)
|
|
331
|
+
};
|
|
332
|
+
}
|
|
294
333
|
}
|
|
295
334
|
}
|
|
296
335
|
};
|