diff --git a/lua/wikis/ageofempires/Faction/Data.lua b/lua/wikis/ageofempires/Faction/Data.lua index 97839a49041..e081aa89f49 100644 --- a/lua/wikis/ageofempires/Faction/Data.lua +++ b/lua/wikis/ageofempires/Faction/Data.lua @@ -934,24 +934,24 @@ local factionPropsAoEO = { return { factionProps = { - aoe1 = factionPropsAoE1, - aoe2 = factionPropsAoE2, - aoe3 = factionPropsAoE3, - aoe4 = factionPropsAoE4, - aom = factionPropsAoM, - aoeo = factionPropsAoEO, + ['Age of Empires I'] = factionPropsAoE1, + ['Age of Empires II'] = factionPropsAoE2, + ['Age of Empires III'] = factionPropsAoE3, + ['Age of Empires IV'] = factionPropsAoE4, + ['Age of Mythology'] = factionPropsAoM, + ['Age of Empires Online'] = factionPropsAoEO, }, defaultFaction = 'unknown', factions = { - aoe1 = Array.extractKeys(factionPropsAoE1), - aoe2 = Array.extractKeys(factionPropsAoE2), - aoe3 = Array.extractKeys(factionPropsAoE3), - aoe4 = Array.extractKeys(factionPropsAoE4), - aom = Array.extractKeys(factionPropsAoM), - aoeo = Array.extractKeys(factionPropsAoEO), + ['Age of Empires I'] = Array.extractKeys(factionPropsAoE1), + ['Age of Empires II'] = Array.extractKeys(factionPropsAoE2), + ['Age of Empires III'] = Array.extractKeys(factionPropsAoE3), + ['Age of Empires IV'] = Array.extractKeys(factionPropsAoE4), + ['Age of Mythology'] = Array.extractKeys(factionPropsAoM), + ['Age of Empires Online'] = Array.extractKeys(factionPropsAoEO), }, aliases = { - aoe1 = { + ['Age of Empires I'] = { asr = 'assyrians', asy = 'assyrians', bab = 'babylonians', @@ -973,7 +973,7 @@ return { lv = 'lacviet', ['lac viet'] = 'lacviet', }, - aoe2 = { + ['Age of Empires II'] = { ach = 'achaemenids', arm = 'armenians', ath = 'athenians', @@ -1037,7 +1037,7 @@ return { vie = 'vietnamese', vik = 'vikings', }, - aoe3 = { + ['Age of Empires III'] = { azt = 'aztecs', brt = 'british', bri = 'british', @@ -1066,7 +1066,7 @@ return { swe = 'swedes', usa = 'unitedstates', }, - aoe4 = { + ['Age of Empires IV'] = { abb = 'abbasiddynasty', aba = 'abbasiddynasty', abba = 'abbasiddynasty', @@ -1099,7 +1099,7 @@ return { tug = 'tughlaqdynasty', zhu = 'zhuxislegacy', }, - aom = { + ['Age of Mythology'] = { ama = 'amaterasu', atl = 'atlanteans', chi = 'chinese', @@ -1130,7 +1130,7 @@ return { hui = 'huitzilopochtli', tez = 'tezcatlipoca', }, - aoeo = { + ['Age of Empires Online'] = { bab = 'babylonians', cel = 'celts', egy = 'egyptians', diff --git a/lua/wikis/ageofempires/Faction/IconData.lua b/lua/wikis/ageofempires/Faction/IconData.lua index 5fb5a02eb7a..98e2aae7052 100644 --- a/lua/wikis/ageofempires/Faction/IconData.lua +++ b/lua/wikis/ageofempires/Faction/IconData.lua @@ -532,11 +532,11 @@ local byFactionAoEO = { return { byFaction = { - aoe1 = byFactionAoE1, - aoe2 = byFactionAoE2, - aoe3 = byFactionAoE3, - aoe4 = byFactionAoE4, - aom = byFactionAoM, - aoeo = byFactionAoEO, + ['Age of Empires I'] = byFactionAoE1, + ['Age of Empires II'] = byFactionAoE2, + ['Age of Empires III'] = byFactionAoE3, + ['Age of Empires IV'] = byFactionAoE4, + ['Age of Mythology'] = byFactionAoM, + ['Age of Empires Online'] = byFactionAoEO, }, } diff --git a/lua/wikis/ageofempires/MatchGroup/Input/Custom.lua b/lua/wikis/ageofempires/MatchGroup/Input/Custom.lua index b5af7facf98..734612d8b1c 100644 --- a/lua/wikis/ageofempires/MatchGroup/Input/Custom.lua +++ b/lua/wikis/ageofempires/MatchGroup/Input/Custom.lua @@ -11,7 +11,6 @@ local Array = Lua.import('Module:Array') local DateExt = Lua.import('Module:Date/Ext') local Faction = Lua.import('Module:Faction') local FnUtil = Lua.import('Module:FnUtil') -local Game = Lua.import('Module:Game') local Json = Lua.import('Module:Json') local Logic = Lua.import('Module:Logic') local Operator = Lua.import('Module:Operator') @@ -257,7 +256,7 @@ function MapFunctions.getPlayersOfMapOpponent(map, opponent, opponentIndex) end, function(playerIndex, playerIdData, playerInputData) local civ = Logic.emptyOr(civs[playerIndex], Faction.defaultFaction) - civ = Faction.read(civ, {game = Game.abbreviation{game = map.game}:lower()}) + civ = Faction.read(civ, {game = map.game}) return { civ = civ, displayName = playerIdData.displayname or playerInputData.name, @@ -352,7 +351,7 @@ function FfaMapFunctions.getPlayersOfMapOpponent(map, opponent, opponentMapInput end, function(playerIndex, playerIdData, playerInputData) local faction = Logic.emptyOr(factions[playerIndex], Faction.defaultFaction) - faction = Faction.read(faction, {game = Game.abbreviation{game = map.game}:lower()}) + faction = Faction.read(faction, {game = map.game}) return { faction = faction, } diff --git a/lua/wikis/ageofempires/MatchSummary.lua b/lua/wikis/ageofempires/MatchSummary.lua index 4071b65c362..883805f05f1 100644 --- a/lua/wikis/ageofempires/MatchSummary.lua +++ b/lua/wikis/ageofempires/MatchSummary.lua @@ -9,7 +9,6 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Faction = Lua.import('Module:Faction') -local Game = Lua.import('Module:Game') local Logic = Lua.import('Module:Logic') local MapMode = Lua.import('Module:MapMode') local Operator = Lua.import('Module:Operator') @@ -179,12 +178,11 @@ end ---@param gameData string? ---@return VNode function GameRowComponentProps._createFactionIcon(civ, gameData) - local normGame = Game.abbreviation{game = gameData}:lower() return Html.Span{ classes = {'brkts-champion-icon'}, children = Faction.Icon{ faction = civ or '', - game = normGame, + game = gameData, size = 64, showTitle = true, showLink = true, diff --git a/lua/wikis/commons/Faction.lua b/lua/wikis/commons/Faction.lua index 3c82f3c1e05..32666a1635b 100644 --- a/lua/wikis/commons/Faction.lua +++ b/lua/wikis/commons/Faction.lua @@ -10,6 +10,7 @@ local Lua = require('Module:Lua') local Array = Lua.import('Module:Array') local Class = Lua.import('Module:Class') local FnUtil = Lua.import('Module:FnUtil') +local Game = Lua.import('Module:Game') local String = Lua.import('Module:StringUtils') local Table = Lua.import('Module:Table') local TypeUtil = Lua.import('Module:TypeUtil') @@ -63,7 +64,7 @@ function Faction._parseOptions(options) options = {} end - options.game = options.game or Data.defaultGame + options.game = Game.toIdentifier{game = options.game, useDefault = true} return options end @@ -169,6 +170,7 @@ end ---@field title string? ---@field game string? ---@field showName boolean? + Faction.propTypes.Icon = TypeUtil.struct{ faction = 'string', showLink = 'boolean?', @@ -201,7 +203,7 @@ function Faction.Icon(props) size = size .. 'px' end - props.game = props.game or Data.defaultGame + props.game = Game.toIdentifier{game = props.game, useDefault = true} local iconData = props.game and (IconData.byFaction[props.game] or {})[faction] or {} local iconName = iconData.icon diff --git a/lua/wikis/commons/Faction/Data.lua b/lua/wikis/commons/Faction/Data.lua index b31f1cd02c3..a55edd11d8e 100644 --- a/lua/wikis/commons/Faction/Data.lua +++ b/lua/wikis/commons/Faction/Data.lua @@ -10,7 +10,6 @@ local Lua = require('Module:Lua') local Info = Lua.import('Module:Info', {loadData = true}) return { - defaultGame = Info.defaultGame, factionProps = {[Info.defaultGame] = {}}, defaultFaction = '', factions = { diff --git a/lua/wikis/commons/Faction/Data/Starcraft.lua b/lua/wikis/commons/Faction/Data/Starcraft.lua index 901e235a47a..4bd73401b7c 100644 --- a/lua/wikis/commons/Faction/Data/Starcraft.lua +++ b/lua/wikis/commons/Faction/Data/Starcraft.lua @@ -46,7 +46,6 @@ local factionProps = { } return { - defaultGame = Info.defaultGame, factionProps = { [Info.defaultGame] = factionProps }, diff --git a/lua/wikis/stormgate/Faction/Data.lua b/lua/wikis/stormgate/Faction/Data.lua index 37504c32637..32640873bd5 100644 --- a/lua/wikis/stormgate/Faction/Data.lua +++ b/lua/wikis/stormgate/Faction/Data.lua @@ -51,7 +51,6 @@ local factionProps = { } return { - defaultGame = Info.defaultGame, factionProps = { [Info.defaultGame] = factionProps, }, diff --git a/lua/wikis/warcraft/Faction/Data.lua b/lua/wikis/warcraft/Faction/Data.lua index f405d3e147c..34cc0732b5c 100644 --- a/lua/wikis/warcraft/Faction/Data.lua +++ b/lua/wikis/warcraft/Faction/Data.lua @@ -60,7 +60,6 @@ local factionProps = { } return { - defaultGame = Info.defaultGame, factionProps = { [Info.defaultGame] = factionProps },