From 7be6a6c08f30afd7240d507c4466996b3e46471a Mon Sep 17 00:00:00 2001 From: V4Victini Date: Fri, 11 Jul 2014 15:08:43 -0400 Subject: [PATCH] Add /formathelp command Aliases: /formatshelp and /formats Displays information about the available formats on the server. --- config/commands.js | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/config/commands.js b/config/commands.js index ac06774b4b..3e2d1498fc 100644 --- a/config/commands.js +++ b/config/commands.js @@ -936,6 +936,40 @@ var commands = exports.commands = { this.sendReplyBox(buffer); }, + formats: 'formathelp', + formatshelp: 'formathelp', + formathelp: function (target, room, user) { + if (!this.canBroadcast()) return; + if (this.broadcasting && (room.id === 'lobby' || room.battle)) return this.sendReply("This command is too spammy to broadcast in lobby/battles"); + var buf = []; + var showAll = (target === 'all'); + for (var id in Tools.data.Formats) { + var format = Tools.data.Formats[id]; + if (!format) continue; + if (format.effectType !== 'Format') continue; + if (!format.challengeShow) continue; + if (!showAll && !format.searchShow) continue; + buf.push({ + name: format.name, + gameType: format.gameType || 'singles', + mod: format.mod, + searchShow: format.searchShow, + desc: format.desc || 'No description.' + }); + } + this.sendReplyBox( + "Available Formats: (Bold formats are on ladder.)
" + + buf.map(function (data) { + var str = ""; + // Bold = Ladderable. + str += (data.searchShow ? "" + data.name + "" : data.name) + ": "; + str += "(" + (!data.mod || data.mod === 'base' ? "" : data.mod + " ") + data.gameType + " format) "; + str += data.desc; + return str; + }).join("
") + ); + }, + roomhelp: function (target, room, user) { if (room.id === 'lobby' || room.battle) return this.sendReply("This command is too spammy for lobby/battles."); if (!this.canBroadcast()) return;