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 @@ -14,11 +14,6 @@ const g_CivData = loadCivData(false, false); /** - * A symbol which is prepended to the username of moderators. - */ -var g_ModeratorPrefix = "@"; - -/** * Current username. Cannot contain whitespace. */ const g_Username = Engine.LobbyGetNick(); @@ -54,10 +49,32 @@ "unknown": { "color": "178 178 178", "status": translateWithContext("lobby presence", "Unknown") } }; -var g_RoleNames = { - "moderator": translate("Moderator"), - "participant": translate("Player"), - "visitor": translate("Muted Player") +var g_LobbyRoles = { + "moderator": { + "label": translate("Moderator"), + "description": translate("This user enforces the Terms of Use, can mute, kick or ban players."), + "nickprefix": "@" + }, + "participant": { + "label": translate("Player"), + "description": translate("This is a regular player."), + "nickprefix": "" + }, + "visitor": { + "label": translate("Muted Player"), + "description": translate("This player does not deserve to speak."), + "nickprefix": "*" + }, + "xpartamupp": { + "label": translate("Gamelist Bot"), + "description": translate("This is the bot who provides the list of active games."), + "nickprefix": "#" + }, + "echelon": { + "label": translate("Rating Bot"), + "description": translate("This bot gives players a score who played a rated 1v1."), + "nickprefix": "#" + } }; /** @@ -467,7 +484,7 @@ Engine.GetGUIObjectByName("middlePanel").size = "20%+5 " + (g_Dialog ? "18" : "40") + " 100%-255 100%-20"; Engine.GetGUIObjectByName("rightPanel").size = "100%-250 " + (g_Dialog ? "18" : "40") + " 100%-20 100%-20"; - Engine.GetGUIObjectByName("leftPanel").size = "20 " + (g_Dialog ? "18" : "40") + " 20% 100%-315"; + Engine.GetGUIObjectByName("leftPanel").size = "20 " + (g_Dialog ? "18" : "40") + " 20% 100%-335"; if (g_Dialog) { @@ -750,7 +767,7 @@ let statusColor = g_PlayerStatuses[presence].color; buddyStatusList.push(player.isBuddy ? coloredText(g_BuddySymbol, statusColor) : ""); - playerList.push(colorPlayerName((player.role == "moderator" ? g_ModeratorPrefix : "") + player.name)); + playerList.push(colorPlayerName(player.name, "", getLobbyRole(player.name).nickprefix + player.name)); presenceList.push(coloredText(g_PlayerStatuses[presence].status, statusColor)); ratingList.push(coloredText(rating, statusColor)); nickList.push(player.name); @@ -889,7 +906,19 @@ function updateUserRoleText(playerName) { - Engine.GetGUIObjectByName("roleText").caption = g_RoleNames[Engine.LobbyGetPlayerRole(playerName) || "participant"]; + let lobbyRole = getLobbyRole(playerName); + Engine.GetGUIObjectByName("roleText").caption = lobbyRole ? lobbyRole.label : translate("N/A"); + Engine.GetGUIObjectByName("roleDescription").caption = lobbyRole ? lobbyRole.description : ""; + +} + +function getLobbyRole(nickname) +{ + for (let botName of ["xpartamupp", "echelon"]) + if (Engine.LobbyGetPlayerUsername(nickname) == Engine.ConfigDB_GetValue("user", "lobby." + botName)) + return g_LobbyRoles[botName]; + + return g_LobbyRoles[Engine.LobbyGetPlayerRole(nickname)] || undefined; } /** @@ -1387,8 +1416,8 @@ { if (msg.from) { - if (Engine.LobbyGetPlayerRole(msg.from) == "moderator") - msg.from = g_ModeratorPrefix + msg.from; + let lobbyRole = getLobbyRole(msg.from); + msg.from = (lobbyRole ? lobbyRole.nickprefix : "") + msg.from; // Highlight local user's nick if (g_Username != msg.from) @@ -1559,21 +1588,19 @@ } /** - * Returns the given playername wrapped in an appropriate color-tag. - * - * @param {string} playername - * @param {string} rating + * Returns the given string or playername colorized in a unique color for that player. + * This helps the reader to follow the chat conversation. */ -function colorPlayerName(playername, rating) +function colorPlayerName(playername, rating = "", string = "") { return coloredText( (rating ? sprintf( translate("%(nick)s (%(rating)s)"), { - "nick": playername, + "nick": string || playername, "rating": rating - }) : playername + }) : (string || playername) ), - getPlayerColor(playername.replace(g_ModeratorPrefix, ""))); + getPlayerColor(playername)); } function senderFont(text) 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 @@ -16,7 +16,6 @@ selected_column_order="1" type="olist" sortable="true" - size="0 0 100% 100%" font="sans-bold-stroke-13" > @@ -43,35 +42,36 @@ - - -