Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -472,6 +472,7 @@ room = "arena26" ; Default MUC room to join server = "lobby.wildfiregames.com" ; Address of lobby server tls = true ; Whether to use TLS encryption when connecting to the server. +shortensizename = true ; Shorten the mapsize names of items in the maptype column. verify_certificate = false ; Whether to reject connecting to the lobby if the TLS certificate is invalid (TODO: wait for Gloox GnuTLS trust implementation to be fixed) terms_url = "https://trac.wildfiregames.com/browser/ps/trunk/binaries/data/mods/public/gui/prelobby/common/terms/"; Allows the user to save the text and print the terms terms_of_service = "0" ; Version (hash) of the Terms of Service that the user has accepted @@ -481,6 +482,8 @@ echelon = "echelon26" ; Name of the server-side XMPP-account that manages ratings buddies = "," ; Comma separated list of playernames that the current user has marked as buddies rememberpassword = true ; Whether to store the encrypted password in the user config +buddysymbol = "★" ; The symbol that marks buddies used globally in the lobby. +statussymbol = "●" ; The symbol that marks the status used in the lobby. [lobby.columns] gamerating = false ; Show the average rating of the participating players in a column of the gamelist @@ -493,6 +496,27 @@ delay = 200 ; Duration in milliseconds that is waited between STUN messages. ; Smaller numbers speed up joins but also become less stable. +[lobby.colors] +enable = false ; User can disable this but keept their custom settings. +username = "255 255 255" ; The color of all username occurrences in the lobby. +rating = "0 0 0" ; The color of all rating occurrences in the lobby. +buddy.username = "255 255 255" ; The color of all buddy username occurrences in the lobby. +buddy.icon = "0 160 160" ; The color of all buddy icon occurrences in the lobby. +chat.message = "243 242 240" ; The color of chat messages in the lobby. +chat.statusmessage = "237 227 167" ; The color of chat status messages in the lobby. +chat.notification = "0 160 160" ; The color of chat notification highlight in the lobby. +gamelist.name.available = "255 255 255" ; The color of game names that are available to join. +gamelist.name.waiting = "255 165 0" ; The color of game names that are at max capacity but not started yet. +gamelist.name.started = "255 0 0" ; The color of game names that are in progress. +gamelist.name.unavailable = "143 142 140" ; The color of game names that are unavailable to join because of game version mismatch, incompatible mods etc. +gamelist.map.name = "255 255 255" ; The color of items under the map name column in the lobby. +gamelist.map.type = "243 242 240" ; The color of items under the map type column in the lobby. +gamelist.map.size = "255 165 0" ; The color of map size under the map type column in the lobby. +gamelist.players.current = "243 242 240" ; The color of the current players number under the players column in the lobby. +gamelist.players.max = "243 242 240" ; The color of the max players number under the players column in the lobby. +gamelist.players.observers = "243 242 240" ; The color of the observers number under the players column in the lobby. +gamelist.players.symbols = "243 242 240" ; The color of the symbols under the players column in the lobby. + [mod] enabledmods = "mod public" Index: binaries/data/mods/mod/gui/common/modern/setup.xml =================================================================== --- binaries/data/mods/mod/gui/common/modern/setup.xml +++ binaries/data/mods/mod/gui/common/modern/setup.xml @@ -54,6 +54,8 @@ 0 0 255 255 255 0 + 255 0 255 + 0 160 160 237 227 167 243 242 240 143 142 140 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,459 +1,478 @@ /** * 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; + /** + * The rating assigned to lobby players who didn't complete a ranked 1v1 yet. + */ + var g_DefaultLobbyRating = 0; -/** - * 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. - */ -var g_BuddyListDelimiter = ","; + /** + * 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. + */ + var g_BuddyListDelimiter = ","; + /** + * @Returns {object} containing the name and rating seperately. + */ + function splitRatingFromNick(playerName) + { + let result = /^(\S+)\ \((\d+)\)$/g.exec(playerName); + return { "nick": result ? result[1] : playerName, "rating": result ? +result[2] : "" }; + } -/** - * Returns the nickname without the lobby rating. - */ -function splitRatingFromNick(playerName) -{ - let result = /^(\S+)\ \((\d+)\)$/g.exec(playerName); - return { "nick": result ? result[1] : playerName, "rating": result ? +result[2] : "" }; -} + /** + * Array of playernames that the current user has marked as buddies. + */ + var g_Buddies = Engine.ConfigDB_GetValue("user", "lobby.buddies").split(g_BuddyListDelimiter); -/** - * Array of playernames that the current user has marked as buddies. - */ -var g_Buddies = Engine.ConfigDB_GetValue("user", "lobby.buddies").split(g_BuddyListDelimiter); + /** + * Returns a formatted string describing the player assignments. + * Needs g_CivData to translate! + * + * @param {Object} playerDataArray - As known from game setup and sim state. + * @param {(string[]|false)} playerStates - One of "won", "defeated", "active" for each player. + * @returns {string} + */ + function formatPlayerInfo(playerDataArray, playerStates) + { + let playerDescriptions = {}; + let playerIdx = 0; -/** - * Denotes which players are a lobby buddy of the current user. - */ -var g_BuddySymbol = '•'; + for (let playerData of playerDataArray) + { + if (playerData == null || playerData.Civ && playerData.Civ == "gaia") + continue; -/** - * Returns a formatted string describing the player assignments. - * Needs g_CivData to translate! - * - * @param {Object} playerDataArray - As known from game setup and sim state. - * @param {(string[]|false)} playerStates - One of "won", "defeated", "active" for each player. - * @returns {string} - */ -function formatPlayerInfo(playerDataArray, playerStates) -{ - let playerDescriptions = {}; - let playerIdx = 0; + ++playerIdx; + let teamIdx = playerData.Team; + let isAI = playerData.AI && playerData.AI != ""; + let playerState = playerStates && playerStates[playerIdx] || playerData.State; + let isActive = !playerState || playerState == "active"; - for (let playerData of playerDataArray) - { - if (playerData == null || playerData.Civ && playerData.Civ == "gaia") - continue; + let playerDescription; + if (isAI) + { + if (playerData.Civ) + { + if (isActive) + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = translate("%(status)s %(civ)s %(playerName)s (%(AIdescription)s)"); + else + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = translate("%(status)s %(civ)s %(state)s %(playerName)s (%(AIdescription)s)"); + } + else + { + if (isActive) + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = translate("%(status)s %(playerName)s (%(AIdescription)s)"); + else + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = translate("%(status)s %(state)s %(playerName)s (%(AIdescription)s)"); + } + } + else + { + if (playerData.Offline) + { + // Can only occur in the lobby for now. + if (isActive) + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = "%(status)s %(civ)s %(playerName)s"; + else + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = "%(status)s %(civ)s %(state)s %(playerName)s"; + } + else + { + if (playerData.Civ) + if (isActive) + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = "%(civ)s %(playerName)s"; + else + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = "%(civ)s %(state)s %(playerName)s"; + else + if (isActive) + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = "%(playerName)s"; + else + // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu + playerDescription = "%(state)s %(playerName)s"; + } + } - ++playerIdx; - let teamIdx = playerData.Team; - let isAI = playerData.AI && playerData.AI != ""; - let playerState = playerStates && playerStates[playerIdx] || playerData.State; - let isActive = !playerState || playerState == "active"; + // Sort player descriptions by team + if (!playerDescriptions[teamIdx]) + playerDescriptions[teamIdx] = []; - let playerDescription; - if (isAI) - { - if (playerData.Civ) - { - if (isActive) - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(civ)s, %(AIdescription)s)"); - else - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(civ)s, %(AIdescription)s, %(state)s)"); - } - else - { - if (isActive) - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(AIdescription)s)"); - else - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(AIdescription)s, %(state)s)"); - } - } - else - { - if (playerData.Offline) - { - // Can only occur in the lobby for now, so no strings with civ needed - if (isActive) - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (OFFLINE)"); - else - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (OFFLINE, %(state)s)"); - } - else - { - if (playerData.Civ) - if (isActive) - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(civ)s)"); - else - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(civ)s, %(state)s)"); - else - if (isActive) - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s"); - else - // Translation: Describe a player in a selected game, f.e. in the replay- or savegame menu - playerDescription = translate("%(playerName)s (%(state)s)"); - } - } + let playerNick = splitRatingFromNick(playerData.Name).nick; - // Sort player descriptions by team - if (!playerDescriptions[teamIdx]) - playerDescriptions[teamIdx] = []; + let playerRating = splitRatingFromNick(playerData.Name).rating; + playerRating ? playerRating = ' (' + PlayerColor.ColorByRating(playerRating) + ')' : playerRating = ""; - let playerNick = splitRatingFromNick(playerData.Name).nick; - playerDescriptions[teamIdx].push(sprintf(playerDescription, { - "playerName": - coloredText( - (g_Buddies.indexOf(playerNick) != -1 ? g_BuddySymbol + " " : "") + - escapeText(playerData.Name), - (typeof getPlayerColor == 'function' ? - (isAI ? "white" : getPlayerColor(playerNick)) : - rgbToGuiColor(playerData.Color || g_Settings.PlayerDefaults[playerIdx].Color))), + playerDescriptions[teamIdx].push(setStringTags(sprintf(playerDescription, { + "playerName": + (g_Buddies.indexOf(playerNick) != -1 ? setStringTags(g_BuddySymbol, PlayerColor.ColorTags.buddyIcon) + " " : "") + + PlayerColor.ColorPlayerNameByRole(escapeText(playerNick), Engine.LobbyGetPlayerRole(playerNick)) + playerRating, - "civ": - !playerData.Civ ? - translate("Unknown Civilization") : - g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? - translate(g_CivData[playerData.Civ].Name) : - playerData.Civ, + "civ": + !playerData.Civ ? + translate("Unknown Civilization") : + g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? + '[icon="icon_' + playerData.Civ + '"]' : playerData.Civ, - "state": - playerState == "defeated" ? - translateWithContext("playerstate", "defeated") : - translateWithContext("playerstate", "won"), + "status": + isAI ? '[icon="icon_bot"]' : '[icon="icon_offline"]', - "AIdescription": translateAISettings(playerData) - })); - } + "state": + playerState == "defeated" ? '[icon="icon_defeated"]' : '[icon="icon_victorious"]', - let teams = Object.keys(playerDescriptions); - if (teams.indexOf("observer") > -1) - teams.splice(teams.indexOf("observer"), 1); + "AIdescription": setStringTags(translateAISettings(playerData), PlayerColor.ColorTags.username) + }), { "tooltip": PlayerTooltip() })); - let teamDescription = []; + function PlayerTooltip() { + let txt = ""; + let civ = !playerData.Civ ? translate("Unknown Civilization") : + g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? + g_CivData[playerData.Civ].Name : playerData.Civ; - // If there are no teams, merge all playersDescriptions - if (teams.length == 1) - teamDescription.push(playerDescriptions[teams[0]].join("\n")); + if (playerData.Offline || isAI) + { + txt += translate("Status") + ": "; + txt += isAI ? translateAIName(playerData.AI) + "\n" : translate("Offline") + "\n"; + } - // If there are teams, merge "Team N:" + playerDescriptions - else - teamDescription = teams.map(team => { + if (playerData.Civ) + txt += translate("Civilization") + ": " + civ + "\n"; - let teamCaption = team == -1 ? - translate("No Team") : - sprintf(translate("Team %(team)s"), { "team": +team + 1 }); + if (playerState) + { + txt += translate("State") + ": "; + txt += (playerState == "defeated") ? translate("Defeated") + "\n" : translate("Victorious") + "\n"; + } + return txt; + }; - // Translation: Describe players of one team in a selected game, f.e. in the replay- or savegame menu or lobby - return sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { - "team": '[font="sans-bold-14"]' + teamCaption + "[/font]", - "playerDescriptions": playerDescriptions[team].join("\n") - }); - }); + } - if (playerDescriptions.observer) - teamDescription.push(sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { - "team": '[font="sans-bold-14"]' + translatePlural("Observer", "Observers", playerDescriptions.observer.length) + "[/font]", - "playerDescriptions": playerDescriptions.observer.join("\n") - })); + let teams = Object.keys(playerDescriptions); + if (teams.indexOf("observer") > -1) + teams.splice(teams.indexOf("observer"), 1); - return teamDescription.join("\n\n"); -} + let teamDescription = []; -/** - * Sets an additional map label, map preview image and describes the chosen game settings more closely. - * - * Requires g_VictoryConditions. - */ -function getGameDescription(initAttributes, mapCache) -{ - let titles = []; - if (!initAttributes.settings.VictoryConditions.length) - titles.push({ - "label": translateWithContext("victory condition", "Endless Game"), - "value": translate("No winner will be determined, even if everyone is defeated.") - }); + // If there are no teams, merge all playersDescriptions + if (teams.length == 1) + teamDescription.push(playerDescriptions[teams[0]].join("\n")); - for (let victoryCondition of g_VictoryConditions) - { - if (initAttributes.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1) - continue; + // If there are teams, merge "Team N:" + playerDescriptions + else + teamDescription = teams.map(team => { - let title = translateVictoryCondition(victoryCondition.Name); - if (victoryCondition.Name == "wonder") - { - let wonderDuration = Math.round(initAttributes.settings.WonderDuration); - title = sprintf( - translatePluralWithContext( - "victory condition", - "Wonder (%(min)s minute)", - "Wonder (%(min)s minutes)", - wonderDuration - ), - { "min": wonderDuration }); - } + let teamCaption = team == -1 ? + translate("No Team") : + sprintf(translate("Team %(team)s"), { "team": +team + 1 }); - let isCaptureTheRelic = victoryCondition.Name == "capture_the_relic"; - if (isCaptureTheRelic) - { - let relicDuration = Math.round(initAttributes.settings.RelicDuration); - title = sprintf( - translatePluralWithContext( - "victory condition", - "Capture the Relic (%(min)s minute)", - "Capture the Relic (%(min)s minutes)", - relicDuration - ), - { "min": relicDuration }); - } + // Translation: Describe players of one team in a selected game, f.e. in the replay- or savegame menu or lobby + return sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { + "team": setStringTags(teamCaption, GameDetails.prototype.CaptionTags), + "playerDescriptions": playerDescriptions[team].join("\n") + }); + }); - titles.push({ - "label": title, - "value": victoryCondition.Description - }); + if (playerDescriptions.observer) + teamDescription.push(sprintf(translate("%(team)s:\n%(playerDescriptions)s"), { + "team": setStringTags(translatePlural("Observer", "Observers", playerDescriptions.observer.length), GameDetails.prototype.CaptionTags), + "playerDescriptions": playerDescriptions.observer.join("\n") + })); - if (isCaptureTheRelic) - titles.push({ - "label": translate("Relic Count"), - "value": Math.round(initAttributes.settings.RelicCount) - }); + return teamDescription.join("\n\n"); + } - if (victoryCondition.Name == "regicide") - if (initAttributes.settings.RegicideGarrison) - titles.push({ - "label": translate("Hero Garrison"), - "value": translate("Heroes can be garrisoned.") - }); - else - titles.push({ - "label": translate("Exposed Heroes"), - "value": translate("Heroes cannot be garrisoned and they are vulnerable to raids.") - }); - } + /** + * Sets an additional map label, map preview image and describes the chosen game settings more closely. + * + * Requires g_VictoryConditions. + */ + function getGameDescription(initAttributes, mapCache) + { + let titles = []; + if (!initAttributes.settings.VictoryConditions.length) + titles.push({ + "label": translateWithContext("victory condition", "Endless Game"), + "value": translate("No winner will be determined, even if everyone is defeated.") + }); - if (initAttributes.settings.LockTeams) - titles.push({ - "label": translate("Locked Teams"), - "value": translate("Players can't change the initial teams.") - }); - else - titles.push({ - "label": translate("Diplomacy"), - "value": translate("Players can make alliances and declare war on allies.") - }); + for (let victoryCondition of g_VictoryConditions) + { + if (initAttributes.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1) + continue; - if (initAttributes.settings.LastManStanding) - titles.push({ - "label": translate("Last Man Standing"), - "value": translate("Only one player can win the game. If the remaining players are allies, the game continues until only one remains.") - }); - else - titles.push({ - "label": translate("Allied Victory"), - "value": translate("If one player wins, his or her allies win too. If one group of allies remains, they win.") - }); + let title = translateVictoryCondition(victoryCondition.Name); + if (victoryCondition.Name == "wonder") + { + let wonderDuration = Math.round(initAttributes.settings.WonderDuration); + title = sprintf( + translatePluralWithContext( + "victory condition", + "Wonder (%(min)s minute)", + "Wonder (%(min)s minutes)", + wonderDuration + ), + { "min": wonderDuration }); + } - let ceasefire = Math.round(initAttributes.settings.Ceasefire); - titles.push({ - "label": translate("Ceasefire"), - "value": - !ceasefire ? - translate("disabled") : - ceasefire == 1 ? - translate("For the first minute, other players will stay neutral.") : - sprintf(translatePlural( - "For the first %(min)s minute, other players will stay neutral.", - "For the first %(min)s minutes, other players will stay neutral.", - ceasefire), - { "min": ceasefire }) - }); + let isCaptureTheRelic = victoryCondition.Name == "capture_the_relic"; + if (isCaptureTheRelic) + { + let relicDuration = Math.round(initAttributes.settings.RelicDuration); + title = sprintf( + translatePluralWithContext( + "victory condition", + "Capture the Relic (%(min)s minute)", + "Capture the Relic (%(min)s minutes)", + relicDuration + ), + { "min": relicDuration }); + } - if (initAttributes.map == "random") - titles.push({ - "label": translateWithContext("Map Selection", "Random Map"), - "value": translate("Randomly select a map from the list.") - }); - else - { - titles.push({ - "label": translate("Map Name"), - "value": mapCache.translateMapName( - mapCache.getTranslatableMapName(initAttributes.mapType, initAttributes.map, initAttributes)) - }); + titles.push({ + "label": title, + "value": victoryCondition.Description + }); - titles.push({ - "label": translate("Map Description"), - "value": mapCache.getTranslatedMapDescription(initAttributes.mapType, initAttributes.map) - }); - } + if (isCaptureTheRelic) + titles.push({ + "label": translate("Relic Count"), + "value": Math.round(initAttributes.settings.RelicCount) + }); - titles.push({ - "label": translate("Map Type"), - "value": g_MapTypes.Title[g_MapTypes.Name.indexOf(initAttributes.mapType)] - }); + if (victoryCondition.Name == "regicide") + if (initAttributes.settings.RegicideGarrison) + titles.push({ + "label": translate("Hero Garrison"), + "value": translate("Heroes can be garrisoned.") + }); + else + titles.push({ + "label": translate("Exposed Heroes"), + "value": translate("Heroes cannot be garrisoned and they are vulnerable to raids.") + }); + } - if (initAttributes.mapType == "random") - { - let mapSize = g_MapSizes.Name[g_MapSizes.Tiles.indexOf(initAttributes.settings.Size)]; - if (mapSize) - titles.push({ - "label": translate("Map Size"), - "value": mapSize - }); - } + if (initAttributes.settings.LockTeams) + titles.push({ + "label": translate("Locked Teams"), + "value": translate("Players can't change the initial teams.") + }); + else + titles.push({ + "label": translate("Diplomacy"), + "value": translate("Players can make alliances and declare war on allies.") + }); - if (initAttributes.settings.Biome) - { - let biome = g_Settings.Biomes.find(b => b.Id == initAttributes.settings.Biome); - titles.push({ - "label": biome ? biome.Title : translateWithContext("biome", "Random Biome"), - "value": biome ? biome.Description : translate("Randomly select a biome from the list.") - }); - } + if (initAttributes.settings.LastManStanding) + titles.push({ + "label": translate("Last Man Standing"), + "value": translate("Only one player can win the game. If the remaining players are allies, the game continues until only one remains.") + }); + else + titles.push({ + "label": translate("Allied Victory"), + "value": translate("If one player wins, his or her allies win too. If one group of allies remains, they win.") + }); - if (initAttributes.settings.TriggerDifficulty !== undefined) - { - let triggerDifficulty = g_Settings.TriggerDifficulties.find(difficulty => difficulty.Difficulty == initAttributes.settings.TriggerDifficulty); - titles.push({ - "label": triggerDifficulty.Title, - "value": triggerDifficulty.Tooltip - }); - } + let ceasefire = Math.round(initAttributes.settings.Ceasefire); + titles.push({ + "label": translate("Ceasefire"), + "value": + !ceasefire ? + translate("disabled") : + ceasefire == 1 ? + translate("For the first minute, other players will stay neutral.") : + sprintf(translatePlural( + "For the first %(min)s minute, other players will stay neutral.", + "For the first %(min)s minutes, other players will stay neutral.", + ceasefire), + { "min": ceasefire }) + }); - if (initAttributes.settings.Nomad !== undefined) - titles.push({ - "label": initAttributes.settings.Nomad ? translate("Nomad Mode") : translate("Civic Centers"), - "value": - initAttributes.settings.Nomad ? - translate("Players start with only few units and have to find a suitable place to build their city.") : - translate("Players start with a Civic Center.") - }); + if (initAttributes.map == "random") + titles.push({ + "label": translateWithContext("Map Selection", "Random Map"), + "value": translate("Randomly select a map from the list.") + }); + else + { + titles.push({ + "label": translate("Map Name"), + "value": mapCache.translateMapName( + mapCache.getTranslatableMapName(initAttributes.mapType, initAttributes.map, initAttributes)) + }); - if (initAttributes.settings.StartingResources !== undefined) - titles.push({ - "label": translate("Starting Resources"), - "value": - initAttributes.settings.PlayerData && - initAttributes.settings.PlayerData.some(pData => pData && pData.Resources !== undefined) ? - translateWithContext("starting resources", "Per Player") : - sprintf(translate("%(startingResourcesTitle)s (%(amount)s)"), { - "startingResourcesTitle": - g_StartingResources.Title[ - g_StartingResources.Resources.indexOf( - initAttributes.settings.StartingResources)], - "amount": initAttributes.settings.StartingResources - }) - }); + titles.push({ + "label": translate("Map Description"), + "value": mapCache.getTranslatedMapDescription(initAttributes.mapType, initAttributes.map) + }); + } - if (initAttributes.settings.PopulationCap !== undefined) - titles.push({ - "label": translate("Population Limit"), - "value": - initAttributes.settings.PlayerData && - initAttributes.settings.PlayerData.some(pData => pData && pData.PopulationLimit !== undefined) ? - translateWithContext("population limit", "Per Player") : - g_PopulationCapacities.Title[ - g_PopulationCapacities.Population.indexOf( - initAttributes.settings.PopulationCap)] - }); + titles.push({ + "label": translate("Map Type"), + "value": g_MapTypes.Title[g_MapTypes.Name.indexOf(initAttributes.mapType)] + }); - if (initAttributes.settings.WorldPopulationCap !== undefined) - titles.push({ - "label": translate("World Population Cap"), - "value": - g_WorldPopulationCapacities.Title[ - g_WorldPopulationCapacities.Population.indexOf( - initAttributes.settings.WorldPopulationCap)] - }); + if (initAttributes.mapType == "random") + { + let mapSize = g_MapSizes.Name[g_MapSizes.Tiles.indexOf(initAttributes.settings.Size)]; + if (mapSize) + titles.push({ + "label": translate("Map Size"), + "value": mapSize + }); + } - titles.push({ - "label": translate("Treasures"), - "value": initAttributes.settings.DisableTreasures ? - translateWithContext("treasures", "Disabled") : - translateWithContext("treasures", "As defined by the map.") - }); + if (initAttributes.settings.Biome) + { + let biome = g_Settings.Biomes.find(b => b.Id == initAttributes.settings.Biome); + titles.push({ + "label": biome ? biome.Title : translateWithContext("biome", "Random Biome"), + "value": biome ? biome.Description : translate("Randomly select a biome from the list.") + }); + } - titles.push({ - "label": translate("Explored Map"), - "value": initAttributes.settings.ExploreMap - }); + if (initAttributes.settings.TriggerDifficulty !== undefined) + { + let triggerDifficulty = g_Settings.TriggerDifficulties.find(difficulty => difficulty.Difficulty == initAttributes.settings.TriggerDifficulty); + titles.push({ + "label": triggerDifficulty.Title, + "value": triggerDifficulty.Tooltip + }); + } - titles.push({ - "label": translate("Revealed Map"), - "value": initAttributes.settings.RevealMap - }); + if (initAttributes.settings.Nomad !== undefined) + titles.push({ + "label": initAttributes.settings.Nomad ? translate("Nomad Mode") : translate("Civic Centers"), + "value": + initAttributes.settings.Nomad ? + translate("Players start with only few units and have to find a suitable place to build their city.") : + translate("Players start with a Civic Center.") + }); - titles.push({ - "label": translate("Allied View"), - "value": initAttributes.settings.AllyView - }); + if (initAttributes.settings.StartingResources !== undefined) + titles.push({ + "label": translate("Starting Resources"), + "value": + initAttributes.settings.PlayerData && + initAttributes.settings.PlayerData.some(pData => pData && pData.Resources !== undefined) ? + translateWithContext("starting resources", "Per Player") : + sprintf(translate("%(startingResourcesTitle)s (%(amount)s)"), { + "startingResourcesTitle": + g_StartingResources.Title[ + g_StartingResources.Resources.indexOf( + initAttributes.settings.StartingResources)], + "amount": initAttributes.settings.StartingResources + }) + }); - titles.push({ - "label": translate("Cheats"), - "value": initAttributes.settings.CheatsEnabled - }); - const ratingDescription = translate("When the winner of this match is determined, the lobby score will be adapted."); + if (initAttributes.settings.PopulationCap !== undefined) + titles.push({ + "label": translate("Population Limit"), + "value": + initAttributes.settings.PlayerData && + initAttributes.settings.PlayerData.some(pData => pData && pData.PopulationLimit !== undefined) ? + translateWithContext("population limit", "Per Player") : + g_PopulationCapacities.Title[ + g_PopulationCapacities.Population.indexOf( + initAttributes.settings.PopulationCap)] + }); - if (initAttributes.settings.RatingEnabled && - initAttributes.settings.PlayerData.length == 2) - titles.push({ - "label": translate("Rated game"), - "value": ratingDescription - }); - else if (g_IsNetworked && Engine.HasXmppClient()) - titles.push({ - "label": translate("Rated game"), - "value": initAttributes.settings.RatingEnabled === true ? ratingDescription : translateWithContext("game setup option", "disabled") - }); + if (initAttributes.settings.WorldPopulationCap !== undefined) + titles.push({ + "label": translate("World Population Cap"), + "value": + g_WorldPopulationCapacities.Title[ + g_WorldPopulationCapacities.Population.indexOf( + initAttributes.settings.WorldPopulationCap)] + }); - return titles.map(title => sprintf(translate("%(label)s %(details)s"), { - "label": coloredText(title.label, g_DescriptionHighlight), - "details": - title.value === true ? translateWithContext("game setup option", "enabled") : - title.value || translateWithContext("game setup option", "disabled") - })).join("\n"); -} + titles.push({ + "label": translate("Treasures"), + "value": initAttributes.settings.DisableTreasures ? + translateWithContext("treasures", "Disabled") : + translateWithContext("treasures", "As defined by the map.") + }); -/** - * Sets the win/defeat icon to indicate current player's state. - */ -function setOutcomeIcon(state, image) -{ - if (state == "won") - { - image.sprite = "stretched:session/icons/victory.png"; - image.tooltip = translate("Victorious"); - } - else if (state == "defeated") - { - image.sprite = "stretched:session/icons/defeat.png"; - image.tooltip = translate("Defeated"); - } -} + titles.push({ + "label": translate("Explored Map"), + "value": initAttributes.settings.ExploreMap + }); -function translateAISettings(playerData) -{ - if (!playerData.AI) - return ""; + titles.push({ + "label": translate("Revealed Map"), + "value": initAttributes.settings.RevealMap + }); - return sprintf(translate("%(AIdifficulty)s %(AIbehavior)s %(AIname)s"), { - "AIname": translateAIName(playerData.AI), - "AIdifficulty": translateAIDifficulty(playerData.AIDiff), - "AIbehavior": translateAIBehavior(playerData.AIBehavior), - }); -} + titles.push({ + "label": translate("Allied View"), + "value": initAttributes.settings.AllyView + }); + + titles.push({ + "label": translate("Cheats"), + "value": initAttributes.settings.CheatsEnabled + }); + const ratingDescription = translate("When the winner of this match is determined, the lobby score will be adapted."); + + if (initAttributes.settings.RatingEnabled && + initAttributes.settings.PlayerData.length == 2) + titles.push({ + "label": translate("Rated game"), + "value": ratingDescription + }); + else if (g_IsNetworked && Engine.HasXmppClient()) + titles.push({ + "label": translate("Rated game"), + "value": initAttributes.settings.RatingEnabled === true ? ratingDescription : translateWithContext("game setup option", "disabled") + }); + + return titles.map(title => sprintf(translate("%(label)s %(details)s"), { + "label": coloredText(title.label, g_DescriptionHighlight), + "details": + title.value === true ? translateWithContext("game setup option", "enabled") : + title.value || translateWithContext("game setup option", "disabled") + })).join("\n"); + } + + /** + * Sets the win/defeat icon to indicate current player's state. + */ + function setOutcomeIcon(state, image) + { + if (state == "won") + { + image.sprite = "stretched:session/icons/victory.png"; + image.tooltip = translate("Victorious"); + } + else if (state == "defeated") + { + image.sprite = "stretched:session/icons/defeat.png"; + image.tooltip = translate("Defeated"); + } + } + + function translateAISettings(playerData) + { + if (!playerData.AI) + return ""; + + return sprintf(translate("%(AIdifficulty)s"), { + "AIplayername": playerData.Name, + "AIname": translateAIName(playerData.AI), + "AIdifficulty": translateAIDifficulty(playerData.AIDiff), + "AIbehavior": translateAIBehavior(playerData.AIBehavior), + }); + } \ No newline at end of file Index: binaries/data/mods/public/gui/common/setup.xml =================================================================== --- binaries/data/mods/public/gui/common/setup.xml +++ binaries/data/mods/public/gui/common/setup.xml @@ -116,6 +116,8 @@ 0 0 255 255 255 0 + 255 0 255 + 0 160 160 237 227 167 243 242 240 143 142 140 Index: binaries/data/mods/public/gui/common/styles.xml =================================================================== --- binaries/data/mods/public/gui/common/styles.xml +++ binaries/data/mods/public/gui/common/styles.xml @@ -85,7 +85,7 @@