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,7 @@ 0 0 255 255 255 0 + 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,482 @@ /** * 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 = 1200; -/** - * 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 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] : "" }; -} + /** + * @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] : "" }; + } -/** - * 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); -/** - * Denotes which players are a lobby buddy of the current user. - */ -var g_BuddySymbol = '•'; + /** + * Denotes which players are a lobby buddy of the current user. + */ + var g_BuddySymbol = '★'; -/** - * 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; + /** + * 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; - for (let playerData of playerDataArray) - { - if (playerData == null || playerData.Civ && playerData.Civ == "gaia") - continue; + for (let playerData of playerDataArray) + { + if (playerData == null || playerData.Civ && playerData.Civ == "gaia") + continue; - ++playerIdx; - let teamIdx = playerData.Team; - let isAI = playerData.AI && playerData.AI != ""; - let playerState = playerStates && playerStates[playerIdx] || playerData.State; - let isActive = !playerState || playerState == "active"; + ++playerIdx; + let teamIdx = playerData.Team; + let isAI = playerData.AI && playerData.AI != ""; + let playerState = playerStates && playerStates[playerIdx] || playerData.State; + let isActive = !playerState || playerState == "active"; - 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 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"; + } + } - // Sort player descriptions by team - if (!playerDescriptions[teamIdx]) - playerDescriptions[teamIdx] = []; + // Sort player descriptions by team + if (!playerDescriptions[teamIdx]) + playerDescriptions[teamIdx] = []; - 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))), + let playerNick = splitRatingFromNick(playerData.Name).nick; - "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, + let playerRating = splitRatingFromNick(playerData.Name).rating; + playerRating ? playerRating = ' (' + coloredText(playerRating, PlayerColor.GetColorByRating(playerRating)) + ')' : playerRating = ""; - "state": - playerState == "defeated" ? - translateWithContext("playerstate", "defeated") : - translateWithContext("playerstate", "won"), + playerDescriptions[teamIdx].push(setStringTags(sprintf(playerDescription, { + "playerName": + (g_Buddies.indexOf(playerNick) != -1 ? coloredText(g_BuddySymbol, "persiangreen") + " " : "") + + coloredText(escapeText(playerNick), PlayerColor.ColorPlayerNameByRole(Engine.LobbyGetPlayerRole(playerNick))) + playerRating, - "AIdescription": translateAISettings(playerData) - })); - } + "civ": + !playerData.Civ ? + translate("Unknown Civilization") : + g_CivData && g_CivData[playerData.Civ] && g_CivData[playerData.Civ].Name ? + '[icon="icon_' + playerData.Civ + '"]' : + playerData.Civ, - let teams = Object.keys(playerDescriptions); - if (teams.indexOf("observer") > -1) - teams.splice(teams.indexOf("observer"), 1); + "status": + isAI ? '[icon="icon_bot"]' : '[icon="icon_offline"]', - let teamDescription = []; + "state": + playerState == "defeated" ? '[icon="icon_defeated"]' : '[icon="icon_victorious"]', - // If there are no teams, merge all playersDescriptions - if (teams.length == 1) - teamDescription.push(playerDescriptions[teams[0]].join("\n")); + "AIdescription": coloredText(translateAISettings(playerData), "persiangreen") + }), { "tooltip": PlayerTooltip() })); - // If there are teams, merge "Team N:" + playerDescriptions - else - teamDescription = teams.map(team => { + function PlayerTooltip() { + let txt = ""; - let teamCaption = team == -1 ? - translate("No Team") : - sprintf(translate("Team %(team)s"), { "team": +team + 1 }); + if (playerData.Offline || isAI) + { + txt += translate("Status") + ": "; + txt += isAI ? translateAIName(playerData.AI) + "\n" : translate("Offline") + "\n"; + } - // 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 (playerData.Civ) + txt += translate("Civilization") + ": " + g_CivData[playerData.Civ].Name + "\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") - })); + if (playerState) + { + txt += translate("State") + ": "; + txt += (playerState == "defeated") ? translate("Defeated") + "\n" : translate("Victorious") + "\n"; + } + return txt; + }; - return teamDescription.join("\n\n"); -} + } -/** - * 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.") - }); + let teams = Object.keys(playerDescriptions); + if (teams.indexOf("observer") > -1) + teams.splice(teams.indexOf("observer"), 1); - for (let victoryCondition of g_VictoryConditions) - { - if (initAttributes.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1) - continue; + let teamDescription = []; - 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 }); - } + // If there are no teams, merge all playersDescriptions + if (teams.length == 1) + teamDescription.push(playerDescriptions[teams[0]].join("\n")); - 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 there are teams, merge "Team N:" + playerDescriptions + else + teamDescription = teams.map(team => { - titles.push({ - "label": title, - "value": victoryCondition.Description - }); + let teamCaption = team == -1 ? + translate("No Team") : + sprintf(translate("Team %(team)s"), { "team": +team + 1 }); - if (isCaptureTheRelic) - titles.push({ - "label": translate("Relic Count"), - "value": Math.round(initAttributes.settings.RelicCount) - }); + // 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") + }); + }); - 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 (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 (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.") - }); + return teamDescription.join("\n\n"); + } - 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.") - }); + /** + * 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.") + }); - 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 }) - }); + for (let victoryCondition of g_VictoryConditions) + { + if (initAttributes.settings.VictoryConditions.indexOf(victoryCondition.Name) == -1) + continue; - 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)) - }); + 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 }); + } - titles.push({ - "label": translate("Map Description"), - "value": mapCache.getTranslatedMapDescription(initAttributes.mapType, initAttributes.map) - }); - } + 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 }); + } - titles.push({ - "label": translate("Map Type"), - "value": g_MapTypes.Title[g_MapTypes.Name.indexOf(initAttributes.mapType)] - }); + titles.push({ + "label": title, + "value": victoryCondition.Description + }); - 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 (isCaptureTheRelic) + titles.push({ + "label": translate("Relic Count"), + "value": Math.round(initAttributes.settings.RelicCount) + }); - 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 (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.settings.TriggerDifficulty !== undefined) - { - let triggerDifficulty = g_Settings.TriggerDifficulties.find(difficulty => difficulty.Difficulty == initAttributes.settings.TriggerDifficulty); - titles.push({ - "label": triggerDifficulty.Title, - "value": triggerDifficulty.Tooltip - }); - } + 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.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.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.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 - }) - }); + 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.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.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.WorldPopulationCap !== undefined) - titles.push({ - "label": translate("World Population Cap"), - "value": - g_WorldPopulationCapacities.Title[ - g_WorldPopulationCapacities.Population.indexOf( - initAttributes.settings.WorldPopulationCap)] - }); + titles.push({ + "label": translate("Map Description"), + "value": mapCache.getTranslatedMapDescription(initAttributes.mapType, initAttributes.map) + }); + } - titles.push({ - "label": translate("Treasures"), - "value": initAttributes.settings.DisableTreasures ? - translateWithContext("treasures", "Disabled") : - translateWithContext("treasures", "As defined by the map.") - }); + titles.push({ + "label": translate("Map Type"), + "value": g_MapTypes.Title[g_MapTypes.Name.indexOf(initAttributes.mapType)] + }); - titles.push({ - "label": translate("Explored Map"), - "value": initAttributes.settings.ExploreMap - }); + 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("Revealed Map"), - "value": initAttributes.settings.RevealMap - }); + 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("Allied View"), - "value": initAttributes.settings.AllyView - }); + 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("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.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.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.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 + }) + }); - 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"); -} + 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)] + }); -/** - * 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"); - } -} + if (initAttributes.settings.WorldPopulationCap !== undefined) + titles.push({ + "label": translate("World Population Cap"), + "value": + g_WorldPopulationCapacities.Title[ + g_WorldPopulationCapacities.Population.indexOf( + initAttributes.settings.WorldPopulationCap)] + }); -function translateAISettings(playerData) -{ - if (!playerData.AI) - return ""; + titles.push({ + "label": translate("Treasures"), + "value": initAttributes.settings.DisableTreasures ? + translateWithContext("treasures", "Disabled") : + translateWithContext("treasures", "As defined by the map.") + }); - 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("Explored Map"), + "value": initAttributes.settings.ExploreMap + }); + + titles.push({ + "label": translate("Revealed Map"), + "value": initAttributes.settings.RevealMap + }); + + 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), + }); + } 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,7 @@ 0 0 255 255 255 0 + 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 @@