mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-05-20 05:58:08 -05:00
Make tournaments not break when hotpatched
It might be wise to refactor this to not use a standalone tournaments object later.
This commit is contained in:
parent
ae023212b5
commit
bb7dde3b93
|
|
@ -1144,26 +1144,26 @@ function createTournament(
|
|||
output.errorReply("You cannot have a player cap that is less than 2.");
|
||||
return;
|
||||
}
|
||||
const tour = room.game = tournaments[room.id] = new Tournament(
|
||||
const tour = room.game = Tournaments.tournaments[room.id] = new Tournament(
|
||||
room, format, createTournamentGenerator(generator, generatorMod, output)!, playerCap, isRated, name
|
||||
);
|
||||
return tour;
|
||||
}
|
||||
function deleteTournament(id: string, output: CommandContext) {
|
||||
const tournament = tournaments[id];
|
||||
const tournament = Tournaments.tournaments[id];
|
||||
if (!tournament) {
|
||||
output.errorReply(`${id} doesn't exist.`);
|
||||
return false;
|
||||
}
|
||||
tournament.forceEnd();
|
||||
delete tournaments[id];
|
||||
delete Tournaments.tournaments[id];
|
||||
const room = Rooms.get(id);
|
||||
if (room) delete room.game;
|
||||
return true;
|
||||
}
|
||||
function getTournament(id: string) {
|
||||
if (tournaments[id]) {
|
||||
return tournaments[id];
|
||||
if (Tournaments.tournaments[id]) {
|
||||
return Tournaments.tournaments[id];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1616,11 +1616,11 @@ const chatCommands: ChatCommands = {
|
|||
|
||||
if (cmd === '') {
|
||||
if (!this.runBroadcast()) return;
|
||||
const update = Object.keys(tournaments).filter(roomid => {
|
||||
const tournament = tournaments[roomid];
|
||||
const update = Object.keys(Tournaments.tournaments).filter(roomid => {
|
||||
const tournament = Tournaments.tournaments[roomid];
|
||||
return !tournament.room.isPrivate && !tournament.room.isPersonal && !tournament.room.staffRoom;
|
||||
}).map(roomid => {
|
||||
const tournament = tournaments[roomid];
|
||||
const tournament = Tournaments.tournaments[roomid];
|
||||
return {
|
||||
room: tournament.room.id, title: tournament.room.title, format: tournament.name,
|
||||
generator: tournament.generator.name, isStarted: tournament.isTournamentStarted,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user