Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions lua/wikis/ageofempires/Faction/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -973,7 +973,7 @@ return {
lv = 'lacviet',
['lac viet'] = 'lacviet',
},
aoe2 = {
['Age of Empires II'] = {
ach = 'achaemenids',
arm = 'armenians',
ath = 'athenians',
Expand Down Expand Up @@ -1037,7 +1037,7 @@ return {
vie = 'vietnamese',
vik = 'vikings',
},
aoe3 = {
['Age of Empires III'] = {
azt = 'aztecs',
brt = 'british',
bri = 'british',
Expand Down Expand Up @@ -1066,7 +1066,7 @@ return {
swe = 'swedes',
usa = 'unitedstates',
},
aoe4 = {
['Age of Empires IV'] = {
abb = 'abbasiddynasty',
aba = 'abbasiddynasty',
abba = 'abbasiddynasty',
Expand Down Expand Up @@ -1099,7 +1099,7 @@ return {
tug = 'tughlaqdynasty',
zhu = 'zhuxislegacy',
},
aom = {
['Age of Mythology'] = {
ama = 'amaterasu',
atl = 'atlanteans',
chi = 'chinese',
Expand Down Expand Up @@ -1130,7 +1130,7 @@ return {
hui = 'huitzilopochtli',
tez = 'tezcatlipoca',
},
aoeo = {
['Age of Empires Online'] = {
bab = 'babylonians',
cel = 'celts',
egy = 'egyptians',
Expand Down
12 changes: 6 additions & 6 deletions lua/wikis/ageofempires/Faction/IconData.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
5 changes: 2 additions & 3 deletions lua/wikis/ageofempires/MatchGroup/Input/Custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
}
Expand Down
4 changes: 1 addition & 3 deletions lua/wikis/ageofempires/MatchSummary.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 4 additions & 2 deletions lua/wikis/commons/Faction.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -169,6 +170,7 @@ end
---@field title string?
---@field game string?
---@field showName boolean?

Faction.propTypes.Icon = TypeUtil.struct{
faction = 'string',
showLink = 'boolean?',
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion lua/wikis/commons/Faction/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
1 change: 0 additions & 1 deletion lua/wikis/commons/Faction/Data/Starcraft.lua
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ local factionProps = {
}

return {
defaultGame = Info.defaultGame,
factionProps = {
[Info.defaultGame] = factionProps
},
Expand Down
1 change: 0 additions & 1 deletion lua/wikis/stormgate/Faction/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ local factionProps = {
}

return {
defaultGame = Info.defaultGame,
factionProps = {
[Info.defaultGame] = factionProps,
},
Expand Down
1 change: 0 additions & 1 deletion lua/wikis/warcraft/Faction/Data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ local factionProps = {
}

return {
defaultGame = Info.defaultGame,
factionProps = {
[Info.defaultGame] = factionProps
},
Expand Down