Index: binaries/data/mods/public/gui/common/gamedescription.js =================================================================== --- binaries/data/mods/public/gui/common/gamedescription.js +++ binaries/data/mods/public/gui/common/gamedescription.js @@ -1,4 +1,9 @@ /** + * Color for indicating the user in the playerlist and the game where he is listed. + */ +const g_UserColor = "100 150 254"; + +/** * Highlights the victory condition in the game-description. */ var g_DescriptionHighlight = "orange"; @@ -14,7 +19,6 @@ */ var g_BuddyListDelimiter = ","; - /** * Returns the nickname without the lobby rating. */ @@ -39,6 +43,11 @@ var g_BuddySymbol = '•'; /** + * Denotes which player are a lobby is the current user. + */ +var g_UserSymbol = '‣'; + +/** * Returns map description and preview image or placeholder. */ function getMapDescriptionAndPreview(mapType, mapName) @@ -151,15 +160,14 @@ // Sort player descriptions by team if (!playerDescriptions[teamIdx]) playerDescriptions[teamIdx] = []; - playerDescriptions[teamIdx].push(sprintf(playerDescription, { "playerName": '[color="' + - (typeof getPlayerColor == 'function' ? + (g_Username && playerData.Name == g_Username ? g_UserColor : typeof getPlayerColor == 'function' ? (isAI ? "white" : getPlayerColor(playerData.Name)) : rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color)) + '"]' + - (g_Buddies.indexOf(splitRatingFromNick(playerData.Name)[0]) != -1 ? g_BuddySymbol + " " : "") + + (g_Username && playerData.Name == g_Username ? g_UserSymbol + " " : g_Buddies.indexOf(splitRatingFromNick(playerData.Name)[0]) != -1 ? g_BuddySymbol + " " : "") + escapeText(playerData.Name) + "[/color]", 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 @@ -602,7 +602,7 @@ function updatePlayerList() { let playersBox = Engine.GetGUIObjectByName("playersBox"); - let sortBy = playersBox.selected_column || "name"; + let sortBy = playersBox.selected_column || "buddy"; let sortOrder = playersBox.selected_column_order || 1; let buddyStatusList = []; @@ -623,16 +623,26 @@ switch (sortBy) { case 'buddy': - sortA = (a.isBuddy ? 1 : 2) + statusA; - sortB = (b.isBuddy ? 1 : 2) + statusB; + sortA = (a.name == g_Username ? 0 : a.isBuddy ? 1 : 2) + statusA; + sortB = (b.name == g_Username ? 0 : b.isBuddy ? 1 : 2) + statusB; break; case 'rating': sortA = +a.rating; sortB = +b.rating; break; case 'status': - sortA = statusA; - sortB = statusB; + sortA = statusOrder.indexOf(a.presence); + sortB = statusOrder.indexOf(b.presence); + + // if presences equal user priored first/last + if (sortA == sortB) + { + if (a.name == g_Username) return -sortOrder; + if (b.name == g_Username) return +sortOrder; + } + + sortA += b.name.toLowerCase(); + sortB += a.name.toLowerCase(); break; case 'name': default: @@ -656,12 +666,12 @@ if (presence == "unknown") warn("Unknown presence:" + player.presence); - let statusColor = g_PlayerStatuses[presence].color; + let statusColored = (text) => '[color="' + (player.name == g_Username ? g_UserColor : g_PlayerStatuses[presence].color) + '"]' + text + '[/color]'; let coloredName = colorPlayerName((player.role == "moderator" ? g_ModeratorPrefix : "") + player.name); - let coloredPresence = '[color="' + statusColor + '"]' + g_PlayerStatuses[presence].status + "[/color]"; - let coloredRating = '[color="' + statusColor + '"]' + rating + "[/color]"; + let coloredPresence = statusColored(g_PlayerStatuses[presence].status); + let coloredRating = statusColored(rating); - buddyStatusList.push(player.isBuddy ? '[color="' + statusColor + '"]' + g_BuddySymbol + '[/color]' : ""); + buddyStatusList.push(player.isBuddy ? statusColored(player.name == g_Username ? "‣" : g_BuddySymbol) : ""); playerList.push(coloredName); presenceList.push(coloredPresence); ratingList.push(coloredRating); @@ -925,6 +935,9 @@ // Sort games with playing buddies above games with spectating buddies if (game.hasBuddies < 2 && g_Buddies.indexOf(nick) != -1) game.hasBuddies = player.Team == "observer" ? 1 : 2; + + if (player.Name == g_Username) + game.hasUser = true; } game.gameRating = @@ -934,6 +947,9 @@ return game; }).filter(game => !filterGame(game)).sort((a, b) => { + // keep user games priored first/last + if (a.hasUser) return -sortOrder; + if (b.hasUser) return +sortOrder; let sortA, sortB; switch (sortBy) { @@ -985,8 +1001,9 @@ if (game.ip == g_SelectedGameIP && game.port == g_SelectedGamePort) selectedGameIndex = +i; - list_buddy.push(game.hasBuddies ? '[color="' + g_GameColors[game.state] + '"]' + g_BuddySymbol + '[/color]' : ""); - list_name.push('[color="' + g_GameColors[game.state] + '"]' + gameName); + let statusColored = (text) => '[color="' + (game.hasUser ? g_UserColor : g_GameColors[game.state]) + '"]' + text + '[/color]'; + list_buddy.push(game.hasUser || game.hasBuddies ? statusColored(game.hasUser ? g_UserSymbol : g_BuddySymbol) : ""); + list_name.push(statusColored(gameName)); list_mapName.push(translateMapTitle(game.niceMapName)); list_mapSize.push(translateMapSize(game.mapSize)); list_mapType.push(g_MapTypes.Title[mapTypeIdx] || ""); Index: binaries/data/mods/public/gui/lobby/lobby_panels.xml =================================================================== --- binaries/data/mods/public/gui/lobby/lobby_panels.xml +++ binaries/data/mods/public/gui/lobby/lobby_panels.xml @@ -10,7 +10,7 @@