From 68b3754e7d89d2ef8bd59b9564b9fb6da5e77f43 Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 19 Sep 2015 15:15:07 -0500 Subject: [PATCH] Support new ladder protcol See https://github.com/Zarel/Pokemon-Showdown-Client/commit/0b3b09e987ee597cc5fc5a371a1fb4d6413d8f98 This commit doesn't introduce the local ladder yet, it's just some final changes to support the new protocol. --- commands.js | 5 +++++ ladders-remote.js | 4 ++++ package.json | 2 +- rooms.js | 2 +- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/commands.js b/commands.js index b796e14cb5..fdb0262c8c 100644 --- a/commands.js +++ b/commands.js @@ -2261,6 +2261,11 @@ var commands = exports.commands = { connection.send('|queryresponse|rooms|' + JSON.stringify( Rooms.global.getRooms(user) )); + } else if (cmd === 'laddertop') { + if (!trustable) return false; + Ladders(target).getTop().then(function (result) { + connection.send('|queryresponse|laddertop|' + JSON.stringify(result)); + }); } else { // default to sending undefined if (!trustable) return false; diff --git a/ladders-remote.js b/ladders-remote.js index 72f4e74b54..70fbe887bf 100644 --- a/ladders-remote.js +++ b/ladders-remote.js @@ -18,6 +18,10 @@ function Ladder(formatid) { this.formatid = toId(formatid); } +Ladder.prototype.getTop = function () { + return Promise.resolve(undefined); +}; + Ladder.prototype.getRating = function (userid) { var formatid = this.formatid; var user = Users.getExact(userid); diff --git a/package.json b/package.json index 6d75922d80..b7d12769cf 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Pokemon-Showdown", - "version": "0.10.1", + "version": "0.10.2", "dependencies": { "sockjs": "0.3.15", "sugar": "1.4.1" diff --git a/rooms.js b/rooms.js index 7b53ace51b..aba08c0e29 100644 --- a/rooms.js +++ b/rooms.js @@ -434,7 +434,7 @@ var GlobalRoom = (function () { }; GlobalRoom.prototype.getFormatListText = function () { - var formatListText = '|formats'; + var formatListText = '|formats' + (Ladders.formatsListPrefix || ''); var curSection = ''; for (var i in Tools.data.Formats) { var format = Tools.data.Formats[i];