Index: lobby.js
===================================================================
--- lobby.js
+++ lobby.js
@@ -527,7 +527,39 @@
g_SelectedGamePort = g_GameList[gamesBox.selected].port;
}
- g_GameList = Engine.GetGameList().filter(game => !filterGame(game)).sort((a, b) => {
+ let gameList = Engine.GetGameList();
+
+ for (let game of gameList)
+ {
+ let re = /^\S+\ \((\d+)\)$/g;
+ let players = stringifiedTeamListToPlayerData(game.players);
+ let ratings = [];
+ let specRatings = [];
+ for (let player of players) {
+ let result = re.exec(player.Name);
+ re.lastIndex = 0;
+ let rating = result ? +result[1] : 1200;
+ if (player.Team != "observer")
+ ratings.push(rating);
+ else
+ specRatings.push(rating);
+ }
+
+ var average = 1200;
+ if (ratings.length > 0)
+ average = Math.round(ratings.reduce((sum, current) => sum + current) / ratings.length);
+
+ var specAverage = 1200;
+ if (specRatings.length > 0)
+ specAverage = Math.round(specRatings.reduce((sum, current) => sum + current) / specRatings.length);
+ else
+ specAverage = "-";
+
+ game.nRank = average;
+ game.nSpecRank = specAverage;
+ }
+
+ g_GameList = gameList.filter(game => !filterGame(game)).sort((a, b) => {
let sortA, sortB;
switch (sortBy)
{
@@ -546,6 +578,14 @@
sortA = a.nbp * b.maxnbp;
sortB = b.nbp * a.maxnbp;
break;
+ case 'nRank':
+ sortA = a.nRank;
+ sortB = b.nRank;
+ break;
+ case 'nSpecRank':
+ sortA = a.nSpecRank;
+ sortB = b.nSpecRank;
+ break;
case 'status':
default:
sortA = g_GameStatusOrder.indexOf(a.state);
@@ -562,6 +602,8 @@
let list_mapSize = [];
let list_mapType = [];
let list_nPlayers = [];
+ let list_nRank = [];
+ let list_nSpecRank = [];
let list = [];
let list_data = [];
let selectedGameIndex = -1;
@@ -580,6 +622,8 @@
list_mapSize.push(translateMapSize(game.mapSize));
list_mapType.push(g_MapTypes.Title[mapTypeIdx] || "");
list_nPlayers.push(game.nbp + "/" + game.maxnbp);
+ list_nRank.push(game.nRank);
+ list_nSpecRank.push(game.nSpecRank);
list.push(gameName);
list_data.push(i);
}
@@ -589,6 +633,8 @@
gamesBox.list_mapSize = list_mapSize;
gamesBox.list_mapType = list_mapType;
gamesBox.list_nPlayers = list_nPlayers;
+ gamesBox.list_nRank = list_nRank;
+ gamesBox.list_nSpecRank = list_nSpecRank;
// Change these last, otherwise crash
gamesBox.list = list;
gamesBox.list_data = list_data;
Index: lobby.xml
===================================================================
--- lobby.xml
+++ lobby.xml
@@ -211,8 +211,14 @@
Type
-
- Players
+
+ Pl
+
+
+ Rank
+
+
+ SRank