From 4f5c7fba06c0ef6d718663f7ed0e10c86d44826b Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 2 Jun 2026 10:48:43 +0900 Subject: [PATCH 1/2] check with lpdb --- lua/wikis/commons/MatchSummary/Base.lua | 18 +++++++++++++++--- lua/wikis/valorant/MatchSummary.lua | 4 +++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/lua/wikis/commons/MatchSummary/Base.lua b/lua/wikis/commons/MatchSummary/Base.lua index f10721b22fe..51ce5ac2534 100644 --- a/lua/wikis/commons/MatchSummary/Base.lua +++ b/lua/wikis/commons/MatchSummary/Base.lua @@ -13,6 +13,7 @@ local Class = Lua.import('Module:Class') 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') @@ -312,7 +313,7 @@ function MatchSummary.defaultGetByMatchId(CustomMatchSummary, args, options) 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 @@ -320,15 +321,26 @@ function MatchSummary.preProcessMapVeto(mapVetoes, options) 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), diff --git a/lua/wikis/valorant/MatchSummary.lua b/lua/wikis/valorant/MatchSummary.lua index 3ba3cfb2c96..f74288a6072 100644 --- a/lua/wikis/valorant/MatchSummary.lua +++ b/lua/wikis/valorant/MatchSummary.lua @@ -44,7 +44,9 @@ function CustomMatchSummary.createBody(match) 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 From 3f50e1c82051afc523409946d139566a8bcab87e Mon Sep 17 00:00:00 2001 From: ElectricalBoy <15651807+ElectricalBoy@users.noreply.github.com> Date: Tue, 2 Jun 2026 10:50:48 +0900 Subject: [PATCH 2/2] convert game to identifier --- lua/wikis/commons/Map.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/wikis/commons/Map.lua b/lua/wikis/commons/Map.lua index 16ac2a16093..31d66c175bc 100644 --- a/lua/wikis/commons/Map.lua +++ b/lua/wikis/commons/Map.lua @@ -9,6 +9,7 @@ local Lua = require('Module:Lua') 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') @@ -120,7 +121,7 @@ function Map.fromRecord(record) 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 }