Support new ladder protcol

See 0b3b09e987

This commit doesn't introduce the local ladder yet, it's just some
final changes to support the new protocol.
This commit is contained in:
Guangcong Luo
2015-09-19 15:15:07 -05:00
parent 186b7d9e33
commit 68b3754e7d
4 changed files with 11 additions and 2 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -1,6 +1,6 @@
{
"name": "Pokemon-Showdown",
"version": "0.10.1",
"version": "0.10.2",
"dependencies": {
"sockjs": "0.3.15",
"sugar": "1.4.1"

View File

@@ -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];