Index: binaries/data/mods/public/gui/lobby/lobby.js =================================================================== --- binaries/data/mods/public/gui/lobby/lobby.js +++ binaries/data/mods/public/gui/lobby/lobby.js @@ -1043,7 +1043,7 @@ if (!game) return; - let username = g_UserRating ? g_Username + " (" + g_UserRating + ")" : g_Username; + let username = g_UserRating ? g_Username + " (" + getRejoinRating(game) + ")" : g_Username; if (game.state == "init" || stringifiedTeamListToPlayerData(game.players).some(player => player.Name == username)) joinSelectedGame(); @@ -1096,13 +1096,29 @@ "ip": ip, "port": port, "name": g_Username, - "rating": g_UserRating, + "rating": getRejoinRating(game), "useSTUN": !!game.stunIP, "hostJID": game.hostUsername + "@" + g_LobbyServer + "/0ad" }); } /** + * In some cases the current player rating is not in sync, so a player might not be able to rejoin + * or join as a late observer. + * TODO: The rating bot should always update players with the most recent rating. + */ +function getRejoinRating(game) +{ + for (let player of stringifiedTeamListToPlayerData(game.players)) + { + let [nick, rating] = splitRatingFromNick(player.Name); + if (nick == g_Username) + return rating; + } + return g_UserRating; +} + +/** * Open the dialog box to enter the game name. */ function hostGame()