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
3 changes: 2 additions & 1 deletion lua/wikis/commons/Map.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
-- @Liquipedia
-- page=Module:Map
Expand All @@ -9,6 +9,7 @@

local Array = Lua.import('Module:Array')
local DateExt = Lua.import('Module:Date/Ext')
local Game = Lua.import('Module:Game')
local Logic = Lua.import('Module:Logic')
local Table = Lua.import('Module:Table')

Expand Down Expand Up @@ -120,7 +121,7 @@
imageDark = Logic.nilIfEmpty(record.imagedark),
creators = creators,
creatorDisplayNames = creatorDisplayNames,
game = Table.extract(record.extradata, 'game'),
game = Game.toIdentifier{game = Table.extract(record.extradata, 'game'), useDefault = false},
gameModes = Table.extract(record.extradata, 'modes'),
extradata = record.extradata
}
Expand Down
18 changes: 15 additions & 3 deletions lua/wikis/commons/MatchSummary/Base.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
-- @Liquipedia
-- page=Module:MatchSummary/Base
Expand All @@ -13,6 +13,7 @@
local FnUtil = Lua.import('Module:FnUtil')
local Image = Lua.import('Module:Image')
local Logic = Lua.import('Module:Logic')
local Map = Lua.import('Module:Map')
local Table = Lua.import('Module:Table')
local VodLink = Lua.import('Module:VodLink')

Expand Down Expand Up @@ -312,23 +313,34 @@
end

---@param mapVetoes table
---@param options {game: string?, emptyMapDisplay: string?}?
---@param options {game: string?, emptyMapDisplay: string?, useLpdb: boolean?}?
---@return MapVetoProps?
function MatchSummary.preProcessMapVeto(mapVetoes, options)
if Logic.isEmpty(mapVetoes) then
return
end

options = options or {}
local mapInputToDisplay = function(map)

---@param map string?
---@return {name: string, link: string?}
local mapInputToDisplay = FnUtil.memoize(function(map)
if Logic.isEmpty(map) then
return {name = options.emptyMapDisplay or TBD}
end
---@cast map -nil
if options.useLpdb then
local mapData = Map.getMapByName(map)
if mapData then
return {name = mapData.displayName, link = mapData.pageName}
end
return {name = map}
end
if options.game then
return {name = map, link = map .. '/' .. options.game}
end
return {name = map, link = map}
end
end)

return {
firstVeto = tonumber(mapVetoes[1].vetostart),
Expand Down
4 changes: 3 additions & 1 deletion lua/wikis/valorant/MatchSummary.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
-- @Liquipedia
-- page=Module:MatchSummary
Expand Down Expand Up @@ -44,7 +44,9 @@
end)
},
MatchSummaryWidgets.Mvp(match.extradata.mvp),
MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(match.extradata.mapveto, {game = match.game}))
MatchSummaryWidgets.MapVeto(MatchSummary.preProcessMapVeto(
match.extradata.mapveto, {game = match.game, useLpdb = true}
))
)
end

Expand Down
Loading