Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/common/gamedescription.js
/** | /** | ||||
* Highlights the victory condition in the game-description. | * Highlights the victory condition in the game-description. | ||||
*/ | */ | ||||
var g_DescriptionHighlight = "orange"; | var g_DescriptionHighlight = "orange"; | ||||
/** | /** | ||||
* The rating assigned to lobby players who didn't complete a ranked 1v1 yet. | |||||
*/ | |||||
var g_DefaultLobbyRating = 1200; | |||||
/** | |||||
* XEP-0172 doesn't restrict nicknames, but our lobby policy does. | * XEP-0172 doesn't restrict nicknames, but our lobby policy does. | ||||
* So use this human readable delimiter to separate buddy names in the config file. | * So use this human readable delimiter to separate buddy names in the config file. | ||||
*/ | */ | ||||
var g_BuddyListDelimiter = ","; | var g_BuddyListDelimiter = ","; | ||||
/** | |||||
* Returns the nickname without the lobby rating. | |||||
*/ | |||||
function splitRatingFromNick(playerName) | |||||
{ | |||||
let result = /^(\S+)\ \((\d+)\)$/g.exec(playerName); | |||||
if (!result) | |||||
return [playerName, g_DefaultLobbyRating]; | |||||
return [result[1], +result[2]]; | |||||
} | |||||
/** | /** | ||||
* Array of playernames that the current user has marked as buddies. | * Array of playernames that the current user has marked as buddies. | ||||
*/ | */ | ||||
var g_Buddies = Engine.ConfigDB_GetValue("user", "lobby.buddies").split(g_BuddyListDelimiter); | var g_Buddies = Engine.ConfigDB_GetValue("user", "lobby.buddies").split(g_BuddyListDelimiter); | ||||
/** | /** | ||||
* Denotes which players are a lobby buddy of the current user. | * Denotes which players are a lobby buddy of the current user. | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | for (let playerData of playerDataArray) | ||||
playerDescriptions[teamIdx].push(sprintf(playerDescription, { | playerDescriptions[teamIdx].push(sprintf(playerDescription, { | ||||
"playerName": | "playerName": | ||||
'[color="' + | '[color="' + | ||||
(typeof getPlayerColor == 'function' ? | (typeof getPlayerColor == 'function' ? | ||||
(isAI ? "white" : getPlayerColor(playerData.Name)) : | (isAI ? "white" : getPlayerColor(playerData.Name)) : | ||||
rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color)) + | rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color)) + | ||||
'"]' + | '"]' + | ||||
(g_Buddies.indexOf(removeRatingFromNick(playerData.Name)) != -1 ? g_BuddySymbol + " " : "") + | (g_Buddies.indexOf(splitRatingFromNick(playerData.Name)[0]) != -1 ? g_BuddySymbol + " " : "") + | ||||
escapeText(playerData.Name) + | escapeText(playerData.Name) + | ||||
"[/color]", | "[/color]", | ||||
"civ": | "civ": | ||||
!playerData.Civ ? | !playerData.Civ ? | ||||
translate("Unknown Civilization") : | translate("Unknown Civilization") : | ||||
g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? | g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? | ||||
translate(g_CivData[playerData.Civ].Name) : | translate(g_CivData[playerData.Civ].Name) : | ||||
▲ Show 20 Lines • Show All 239 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator