-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathTournament.js
38 lines (35 loc) · 1.29 KB
/
Tournament.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class Tournament {
constructor(room, type) {
this.room = room;
this.official = type === 'official' || type === 'o';
this.chill = type === 'chill';
let tourcheck = room.id + (this.official ? "-o" : "");
if (type === "monopoke") tourcheck = '1v1-o'; // I know this looks ugly
if (type === "late") return;
if (Config.tours[tourcheck]) {
let t = Config.tours[tourcheck];
this.room.send(`/tour autostart ${t[0]}`);
this.room.send(`/tour autodq ${t[1]}`);
if (t[2]) this.room.send('/tour scouting disallow');
}
else if (Config.tours[room.id]) {
let t = Config.tours[room.id];
this.room.send(`/tour autostart ${t[0]}`);
this.room.send(`/tour autodq ${t[1]}`);
if (t[2]) this.room.send('/tour scouting disallow');
}
else {
this.room.send(`/tour autostart 2`);
this.room.send(`/tour autodq 2`);
}
if (this.official) room.send('.official');
if (this.chill) room.send('/modchat +');
}
end() {
if (this.chill) this.room.send('/modchat ac');
}
}
Tournament.prototype.toString = function() {
return "Tournament in " + this.room.name;
}
module.exports = Tournament;