From 89b8d7adfa0fa6636a5520b473d2f40bc64c6f97 Mon Sep 17 00:00:00 2001 From: Rikard Blixt Date: Wed, 23 Oct 2024 10:13:25 +0200 Subject: [PATCH] refactor(match2): move h2h links to MGI (#4942) * refactor(match2): move h2h links to MGI * fix rl typo * forgot to add aoe link data * type typo and remove special parsing * aoe typo * fix wc3 and sc --- .../match2/commons/match_group_input_util.lua | 4 +- .../match_group_input_starcraft.lua | 24 ++++++++- .../match_group_util_starcraft.lua | 2 - .../match_summary_starcraft.lua | 22 -------- .../ageofempires/match_group_input_custom.lua | 25 ++++++++- .../wikis/ageofempires/match_summary.lua | 52 ------------------- .../wikis/dota2/match_group_input_custom.lua | 2 +- .../wikis/halo/match_group_input_custom.lua | 37 +++++++++++++ .../match2/wikis/halo/match_summary.lua | 39 -------------- .../rocketleague/match_group_input_custom.lua | 30 +++++++---- .../wikis/rocketleague/match_summary.lua | 36 ------------- .../warcraft/match_group_input_custom.lua | 18 +++++++ .../match2/wikis/warcraft/match_summary.lua | 23 -------- standard/links/commons/links.lua | 16 ++++++ 14 files changed, 140 insertions(+), 190 deletions(-) diff --git a/components/match2/commons/match_group_input_util.lua b/components/match2/commons/match_group_input_util.lua index 9ce89aab185..42d4ab46490 100644 --- a/components/match2/commons/match_group_input_util.lua +++ b/components/match2/commons/match_group_input_util.lua @@ -1036,13 +1036,13 @@ function MatchGroupInputUtil.prefixPartcipants(opponentIndex) end ---@param match table ----@return table +---@return table function MatchGroupInputUtil.getLinks(match) local links = Links.transform(match) return Table.mapValues( Links.makeFullLinksForTableItems(links, 'match', false), String.nilIfEmpty - ) --[[@as table]] + ) end --- Warning, both match and standalone match may be mutated diff --git a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua index 26b8505ed49..32b3367f746 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_input_starcraft.lua @@ -52,6 +52,7 @@ function StarcraftMatchGroupInput.processMatch(match, options) local games = MatchFunctions.extractMaps(match, opponents) match.links = MatchGroupInputUtil.getLinks(match) + match.links.headtohead = MatchFunctions.getHeadToHeadLink(match, opponents) local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) and MatchFunctions.calculateMatchScore(games, opponents) @@ -217,10 +218,8 @@ end function MatchFunctions.getExtraData(match, numberOfGames) local extradata = { casters = MatchGroupInputUtil.readCasters(match, {noSort = true}), - headtohead = tostring(Logic.readBool(Logic.emptyOr(match.headtohead, Variables.varDefault('headtohead')))), ffa = 'false', } - Variables.varDefine('headtohead', extradata.headtohead) for prefix, vetoMap, vetoIndex in Table.iter.pairsByPrefix(match, 'veto') do MatchFunctions.getVeto(extradata, vetoMap, match, prefix, vetoIndex) @@ -233,6 +232,27 @@ function MatchFunctions.getExtraData(match, numberOfGames) return extradata end +---@param match table +---@param opponents table[] +---@return string? +function MatchFunctions.getHeadToHeadLink(match, opponents) + local showH2H = Logic.readBool(Logic.emptyOr(match.headtohead, Variables.varDefault('headtohead'))) + Variables.varDefine('headtohead', tostring(showH2H)) + + if not showH2H or #opponents ~= 2 or Array.any(opponents, function(opponent) + return opponent.type ~= Opponent.solo or not ((opponent.match2players or {})[1] or {}).name end) + then + return + end + + return (tostring(mw.uri.fullUrl('Special:RunQuery/Match_history')) + .. '?pfRunQueryFormName=Match+history&Head_to_head_query%5Bplayer%5D=' + .. opponents[1].players[1].name + .. '&Head_to_head_query%5Bopponent%5D=' + .. opponents[2].players[1].name + .. '&wpRunQuery=Run+query'):gsub(' ', '_') +end + ---@param extradata table ---@param map string ---@param match table diff --git a/components/match2/commons/starcraft_starcraft2/match_group_util_starcraft.lua b/components/match2/commons/starcraft_starcraft2/match_group_util_starcraft.lua index 230f54d9205..daa5d9f8abd 100644 --- a/components/match2/commons/starcraft_starcraft2/match_group_util_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_group_util_starcraft.lua @@ -53,7 +53,6 @@ local StarcraftMatchGroupUtil = Table.deepCopy(MatchGroupUtil) ---@class StarcraftMatchGroupUtilMatch: MatchGroupUtilMatch ---@field games StarcraftMatchGroupUtilGame[] ----@field headToHead boolean ---@field isFfa boolean ---@field noScore boolean? ---@field opponentMode 'uniform'|'team' @@ -109,7 +108,6 @@ function StarcraftMatchGroupUtil.matchFromRecord(record) end -- Misc - match.headToHead = Logic.readBool(Table.extract(extradata, 'headtohead')) match.isFfa = Logic.readBool(Table.extract(extradata, 'ffa')) match.noScore = Logic.readBoolOrNil(Table.extract(extradata, 'noscore')) match.casters = String.nilIfEmpty(Table.extract(extradata, 'casters')) diff --git a/components/match2/commons/starcraft_starcraft2/match_summary_starcraft.lua b/components/match2/commons/starcraft_starcraft2/match_summary_starcraft.lua index 70ce4076257..136dfe6dbbe 100644 --- a/components/match2/commons/starcraft_starcraft2/match_summary_starcraft.lua +++ b/components/match2/commons/starcraft_starcraft2/match_summary_starcraft.lua @@ -93,28 +93,6 @@ function StarcraftMatchSummary.MatchSummaryContainer(args) return matchSummary:create() end ----@param match StarcraftMatchGroupUtilMatch ----@param footer MatchSummaryFooter ----@return MatchSummaryFooter -function StarcraftMatchSummary.addToFooter(match, footer) - footer = MatchSummary.addVodsToFooter(match, footer) - - if not match.headToHead or #match.opponents ~= 2 or Array.any(match.opponents, function(opponent) - return opponent.type ~= Opponent.solo or not ((opponent.players or {})[1] or {}).pageName end) - then - return footer:addLinks(match.links) - end - match.links.headtohead = tostring(mw.uri.fullUrl('Special:RunQuery/Match_history')) - .. '?pfRunQueryFormName=Match+history&Head_to_head_query%5Bplayer%5D=' - .. match.opponents[1].players[1].pageName - .. '&Head_to_head_query%5Bopponent%5D=' - .. match.opponents[2].players[1].pageName - .. '&wpRunQuery=Run+query' - match.links.headtohead = string.gsub(match.links.headtohead, ' ', '_') - - return footer:addLinks(match.links) -end - ---@param match StarcraftMatchGroupUtilMatch ---@return MatchSummaryBody function StarcraftMatchSummary.createBody(match) diff --git a/components/match2/wikis/ageofempires/match_group_input_custom.lua b/components/match2/wikis/ageofempires/match_group_input_custom.lua index 7b30cab022a..d03f4d4f4d4 100644 --- a/components/match2/wikis/ageofempires/match_group_input_custom.lua +++ b/components/match2/wikis/ageofempires/match_group_input_custom.lua @@ -45,6 +45,7 @@ function CustomMatchGroupInput.processMatch(match, options) local games = CustomMatchGroupInput.extractMaps(match, opponents) match.links = MatchGroupInputUtil.getLinks(match) + match.links.headtohead = CustomMatchGroupInput.getHeadToHeadLink(match, opponents) local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) and CustomMatchGroupInput.calculateMatchScore(games) @@ -241,11 +242,33 @@ end ---@return table function CustomMatchGroupInput._getExtraData(match) return { - headtohead = Logic.emptyOr(match.headtohead, Variables.varDefault('tournament_headtohead')), casters = MatchGroupInputUtil.readCasters(match, {noSort = true}), } end +---@param match table +---@param opponents table[] +---@return string? +function CustomMatchGroupInput.getHeadToHeadLink(match, opponents) + if opponents[1].type ~= Opponent.solo or opponents[2].type ~= Opponent.solo then + return + end + if not Logic.readBool(Logic.emptyOr(match.headtohead, Variables.varDefault('tournament_headtohead'))) then + return nil + end + if Opponent.isEmpty(opponents[1]) or Opponent.isEmpty(opponents[2]) then + return nil + end + + local player1, player2 = + string.gsub(opponents[1].name, ' ', '_'), + string.gsub(opponents[2].name, ' ', '_') + + return tostring(mw.uri.fullUrl('Special:RunQuery/Match_history')) .. + '?pfRunQueryFormName=Match+history&Head_to_head_query%5Bplayer%5D=' ..player1 .. + '&Head_to_head_query%5Bopponent%5D=' .. player2 .. '&wpRunQuery=Run+query' +end + ---@param map table ---@param mapsInfo {name: string, link: string}[]? ---@return string? diff --git a/components/match2/wikis/ageofempires/match_summary.lua b/components/match2/wikis/ageofempires/match_summary.lua index a537db45394..35eca18e910 100644 --- a/components/match2/wikis/ageofempires/match_summary.lua +++ b/components/match2/wikis/ageofempires/match_summary.lua @@ -11,12 +11,10 @@ local DateExt = require('Module:Date/Ext') local Faction = require('Module:Faction') local Game = require('Module:Game') local Icon = require('Module:Icon') -local Logic = require('Module:Logic') local Lua = require('Module:Lua') local MapMode = require('Module:MapMode') local Operator = require('Module:Operator') local String = require('Module:StringUtils') -local Table = require('Module:Table') local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') @@ -30,17 +28,6 @@ local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-tex local DRAW_LINE = Icon.makeIcon{iconName = 'draw', color = 'bright-sun-text', size = 'initial'} local NO_CHECK = '[[File:NoCheck.png|link=]]' -local LINKDATA = { - mapdraft = { - text = 'Map Draft', - icon = 'File:Map Draft Icon.png' - }, - civdraft = { - text = 'Civ Draft', - icon = 'File:Civ Draft Icon.png' - } -} - local CustomMatchSummary = {} ---@param args table @@ -91,45 +78,6 @@ function CustomMatchSummary.createBody(match) return body end ----@param match MatchGroupUtilMatch ----@param footer MatchSummaryFooter ----@return MatchSummaryFooter -function CustomMatchSummary.addToFooter(match, footer) - footer = MatchSummary.addVodsToFooter(match, footer) - - local addLinks = function(linkType) - local currentLinkData = LINKDATA[linkType] - if not currentLinkData then - mw.log('Unknown link: ' .. linkType) - return - end - for _, link in Table.iter.pairsByPrefix(match.links, linkType, {requireIndex = false}) do - footer:addLink(link, currentLinkData.icon, currentLinkData.iconDark, currentLinkData.text) - end - end - - addLinks('mapdraft') - addLinks('civdraft') - - if not Logic.readBool(match.extradata.headtohead) or not CustomMatchSummary._isSolo(match) then - return footer - end - - if not Opponent.isEmpty(match.opponents[1]) and not Opponent.isEmpty(match.opponents[2]) then - local player1, player2 = string.gsub(match.opponents[1].name, ' ', '_'), - string.gsub(match.opponents[2].name, ' ', '_') - footer:addElement( - '[[File:Match Info Stats.png|link=' .. - tostring(mw.uri.fullUrl('Special:RunQuery/Match_history')) .. - '?pfRunQueryFormName=Match+history&Head_to_head_query%5Bplayer%5D=' .. - player1 .. - '&Head_to_head_query%5Bopponent%5D=' .. player2 .. '&wpRunQuery=Run+query|Head-to-head statistics]]' - ) - end - - return footer -end - ---@param match MatchGroupUtilMatch ---@return boolean function CustomMatchSummary._isSolo(match) diff --git a/components/match2/wikis/dota2/match_group_input_custom.lua b/components/match2/wikis/dota2/match_group_input_custom.lua index 9d679065c7b..6bb7c98e0f6 100644 --- a/components/match2/wikis/dota2/match_group_input_custom.lua +++ b/components/match2/wikis/dota2/match_group_input_custom.lua @@ -182,7 +182,7 @@ end ---@param opponents table[] ---@return table function MatchFunctions.getLinks(match, games, opponents) - ---@type table + ---@type table local links = MatchGroupInputUtil.getLinks(match) links.stratz = {} links.dotabuff = {} diff --git a/components/match2/wikis/halo/match_group_input_custom.lua b/components/match2/wikis/halo/match_group_input_custom.lua index d4134ab495a..996beff95f6 100644 --- a/components/match2/wikis/halo/match_group_input_custom.lua +++ b/components/match2/wikis/halo/match_group_input_custom.lua @@ -15,6 +15,8 @@ local Table = require('Module:Table') local Variables = require('Module:Variables') local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util') +local OpponentLibrary = require('Module:OpponentLibraries') +local Opponent = OpponentLibrary.Opponent local DEFAULT_BESTOF = 3 local DEFAULT_MODE = 'team' @@ -41,6 +43,7 @@ function CustomMatchGroupInput.processMatch(match, options) local games = MatchFunctions.extractMaps(match, #opponents) match.links = MatchGroupInputUtil.getLinks(match) + match.links.headtohead = MatchFunctions.getHeadToHeadLink(match, opponents) match.bestof = MatchFunctions.getBestOf(match.bestof) @@ -153,6 +156,40 @@ function MatchFunctions.getExtraData(match) } end +---@param match table +---@param opponents table[] +---@return string? +function MatchFunctions.getHeadToHeadLink(match, opponents) + if + opponents[1].type ~= Opponent.team or + opponents[2].type ~= Opponent.team or + not opponents[1].name or + not opponents[2].name then + + return nil + end + + local team1, team2 = string.gsub(opponents[1].name, ' ', '_'), string.gsub(opponents[2].name, ' ', '_') + local buildQueryFormLink = function(form, template, arguments) + return tostring(mw.uri.fullUrl('Special:RunQuery/' .. form, + mw.uri.buildQueryString(Table.map(arguments, function(key, value) return template .. key, value end)) + .. '&_run' + )) + end + + local headtoheadArgs = { + ['[team1]'] = team1, + ['[team2]'] = team2, + ['[games][is_list]'] = 1, + ['[tiers][is_list]'] = 1, + ['[fromdate][day]'] = '01', + ['[fromdate][month]'] = '01', + ['[fromdate][year]'] = string.sub(match.date,1,4) + } + + return buildQueryFormLink('Head2head', 'Headtohead', headtoheadArgs) +end + -- -- map related functions -- diff --git a/components/match2/wikis/halo/match_summary.lua b/components/match2/wikis/halo/match_summary.lua index 2f6cdd81209..1a28a4ed78c 100644 --- a/components/match2/wikis/halo/match_summary.lua +++ b/components/match2/wikis/halo/match_summary.lua @@ -18,9 +18,6 @@ local DisplayHelper = Lua.import('Module:MatchGroup/Display/Helper') local MatchSummary = Lua.import('Module:MatchSummary/Base') local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/All') -local OpponentLibrary = require('Module:OpponentLibraries') -local Opponent = OpponentLibrary.Opponent - local GREEN_CHECK = Icon.makeIcon{iconName = 'winner', color = 'forest-green-text', size = '110%'} local NO_CHECK = '[[File:NoCheck.png|link=]]' @@ -32,42 +29,6 @@ function CustomMatchSummary.getByMatchId(args) return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args) end ----@param match MatchGroupUtilMatch ----@param footer MatchSummaryFooter ----@return MatchSummaryFooter -function CustomMatchSummary.addToFooter(match, footer) - footer = MatchSummary.addVodsToFooter(match, footer) - - if - match.opponents[1].type == Opponent.team and - match.opponents[2].type == Opponent.team and - match.opponents[1].name and - match.opponents[2].name - then - local team1, team2 = string.gsub(match.opponents[1].name, ' ', '_'), string.gsub(match.opponents[2].name, ' ', '_') - local buildQueryFormLink = function(form, template, arguments) - return tostring(mw.uri.fullUrl('Special:RunQuery/' .. form, - mw.uri.buildQueryString(Table.map(arguments, function(key, value) return template .. key, value end)) - .. '&_run' - )) - end - - local headtoheadArgs = { - ['[team1]'] = team1, - ['[team2]'] = team2, - ['[games][is_list]'] = 1, - ['[tiers][is_list]'] = 1, - ['[fromdate][day]'] = '01', - ['[fromdate][month]'] = '01', - ['[fromdate][year]'] = string.sub(match.date,1,4) - } - - match.links.headtohead = buildQueryFormLink('Head2head', 'Headtohead', headtoheadArgs) - end - - return footer:addLinks(match.links) -end - ---@param match MatchGroupUtilMatch ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) diff --git a/components/match2/wikis/rocketleague/match_group_input_custom.lua b/components/match2/wikis/rocketleague/match_group_input_custom.lua index 97685aef886..6be6f4fb7c1 100644 --- a/components/match2/wikis/rocketleague/match_group_input_custom.lua +++ b/components/match2/wikis/rocketleague/match_group_input_custom.lua @@ -45,6 +45,7 @@ function CustomMatchGroupInput.processMatch(match, options) end) local games = CustomMatchGroupInput.extractMaps(match, #opponents) match.links = MatchGroupInputUtil.getLinks(match) + match.links.headtohead = MatchFunctions.getHeadToHeadLink(match, opponents) Array.forEach(opponents, function(opponent, opponentIndex) opponent.extradata = CustomMatchGroupInput.getOpponentExtradata(opponent) @@ -162,21 +163,30 @@ end ---@param match table ---@param opponents table[] ----@return table -function MatchFunctions.getExtraData(match, opponents) - local opponent1 = opponents[1] - local opponent2 = opponents[2] +---@return string? +function MatchFunctions.getHeadToHeadLink(match, opponents) + if not Logic.readBool(Logic.emptyOr(match.showh2h, Variables.varDefault('showh2h'))) or + opponents[1].type ~= Opponent.team or + opponents[2].type ~= Opponent.team then - local showh2h = Logic.readBool(Logic.emptyOr(match.showh2h, Variables.varDefault('showh2h'))) - and opponent1.type == Opponent.team - and opponent2.type == Opponent.team + return nil + end + local team1, team2 = mw.uri.encode(opponents[1].name), mw.uri.encode(opponents[2].name) + return tostring(mw.uri.fullUrl('Special:RunQuery/Head2head')) + .. '?RunQuery=Run&pfRunQueryFormName=Head2head&Headtohead%5Bteam1%5D=' + .. team1 .. '&Headtohead%5Bteam2%5D=' .. team2 +end + +---@param match table +---@param opponents table[] +---@return table +function MatchFunctions.getExtraData(match, opponents) return { - showh2h = showh2h, isfeatured = MatchFunctions.isFeatured(opponents, tonumber(match.liquipediatier)), casters = MatchGroupInputUtil.readCasters(match), - hasopponent1 = MatchFunctions._checkForNonEmptyOpponent(opponent1), - hasopponent2 = MatchFunctions._checkForNonEmptyOpponent(opponent2), + hasopponent1 = MatchFunctions._checkForNonEmptyOpponent(opponents[1]), + hasopponent2 = MatchFunctions._checkForNonEmptyOpponent(opponents[2]), liquipediatiertype2 = Variables.varDefault('tournament_tiertype2'), } end diff --git a/components/match2/wikis/rocketleague/match_summary.lua b/components/match2/wikis/rocketleague/match_summary.lua index 5f5d9c0195a..317657a7763 100644 --- a/components/match2/wikis/rocketleague/match_summary.lua +++ b/components/match2/wikis/rocketleague/match_summary.lua @@ -26,12 +26,6 @@ local TIMEOUT = '[[File:Cooldown_Clock.png|14x14px|link=]]' local TBD_ICON = mw.ext.TeamTemplate.teamicon('tbd') -local LINK_DATA = { - shift = {icon = 'File:ShiftRLE icon.png', text = 'ShiftRLE matchpage'}, - ballchasing = {icon = 'File:Ballchasing icon.png', text = 'Ballchasing replays'}, - headtohead = {icon = 'File:Match Info Stats.png', text = 'Head to Head history'}, -} - -- Custom Header Class ---@class RocketleagueMatchSummaryHeader: MatchSummaryHeader ---@field leftElementAdditional Html @@ -200,36 +194,6 @@ function CustomMatchSummary.createHeader(match, options) :rightOpponentTeam(header:soloOpponentTeam(match.opponents[2], match.date)) end ----@param match MatchGroupUtilMatch ----@param footer MatchSummaryFooter ----@return MatchSummaryFooter -function CustomMatchSummary.addToFooter(match, footer) - for linkType, linkData in pairs(LINK_DATA) do - for _, link in Table.iter.pairsByPrefix(match.links, linkType, {requireIndex = false}) do - footer:addLink(link, linkData.icon, linkData.iconDark, linkData.text) - end - end - - footer = MatchSummary.addVodsToFooter(match, footer) - - if not match.extradata.showh2h then - return footer - end - - local h2hLinkData = LINK_DATA.headtohead - return footer:addLink(CustomMatchSummary._getHeadToHead(match.opponents), - h2hLinkData.icon, h2hLinkData.iconDark, h2hLinkData.text) -end - ----@param opponents standardOpponent[] ----@return string -function CustomMatchSummary._getHeadToHead(opponents) - local team1, team2 = mw.uri.encode(opponents[1].name), mw.uri.encode(opponents[2].name) - return tostring(mw.uri.fullUrl('Special:RunQuery/Head2head')) - .. '?RunQuery=Run&pfRunQueryFormName=Head2head&Headtohead%5Bteam1%5D=' - .. team1 .. '&Headtohead%5Bteam2%5D=' .. team2 -end - ---@param match MatchGroupUtilMatch ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) diff --git a/components/match2/wikis/warcraft/match_group_input_custom.lua b/components/match2/wikis/warcraft/match_group_input_custom.lua index 6e74b3902ce..f7bf9423301 100644 --- a/components/match2/wikis/warcraft/match_group_input_custom.lua +++ b/components/match2/wikis/warcraft/match_group_input_custom.lua @@ -71,6 +71,7 @@ function CustomMatchGroupInput.processMatch(match, options) local games = MatchFunctions.extractMaps(match, opponents) match.links = MatchGroupInputUtil.getLinks(match) + match.links.headtohead = MatchFunctions.getHeadToHeadLink(opponents) local autoScoreFunction = MatchGroupInputUtil.canUseAutoScore(match, games) and MatchFunctions.calculateMatchScore(games, opponents) @@ -235,6 +236,23 @@ function MatchFunctions.getExtraData(match, numberOfGames) return extradata end +---@param opponents table[] +---@return string? +function MatchFunctions.getHeadToHeadLink(opponents) + if #opponents ~= 2 or Array.any(opponents, function(opponent) + return opponent.type ~= Opponent.solo or not ((opponent.match2players or {})[1] or {}).name end) + then + return + end + + return (tostring(mw.uri.fullUrl('Special:RunQuery/Head-to-Head')) + .. '?pfRunQueryFormName=Head-to-Head&Head+to+head+query%5Bplayer%5D=' + .. opponents[1].players[1].name + .. '&Head_to_head_query%5Bopponent%5D=' + .. opponents[2].players[1].name + .. '&wpRunQuery=Run+query'):gsub(' ', '_') +end + ---@param mapInput table ---@param subGroup integer ---@param opponentCount integer diff --git a/components/match2/wikis/warcraft/match_summary.lua b/components/match2/wikis/warcraft/match_summary.lua index a2626321941..946b066e3af 100644 --- a/components/match2/wikis/warcraft/match_summary.lua +++ b/components/match2/wikis/warcraft/match_summary.lua @@ -95,29 +95,6 @@ function CustomMatchSummary.getByMatchId(args) return matchSummary:create() end ----@param match table ----@param footer MatchSummaryFooter ----@return MatchSummaryFooter -function CustomMatchSummary.addToFooter(match, footer) - footer = MatchSummary.addVodsToFooter(match, footer) - - if #match.opponents ~= 2 or Array.any(match.opponents, function(opponent) - return opponent.type ~= Opponent.solo or not ((opponent.players or {})[1] or {}).pageName end) - then - return footer:addLinks(match.links) - end - - match.links.headtohead = tostring(mw.uri.fullUrl('Special:RunQuery/Head-to-Head')) - .. '?pfRunQueryFormName=Head-to-Head&Head+to+head+query%5Bplayer%5D=' - .. match.opponents[1].players[1].pageName - .. '&Head_to_head_query%5Bopponent%5D=' - .. match.opponents[2].players[1].pageName - .. '&wpRunQuery=Run+query' - match.links.headtohead = string.gsub(match.links.headtohead, ' ', '_') - - return footer:addLinks(match.links) -end - ---@param match table ---@return MatchSummaryBody function CustomMatchSummary.createBody(match) diff --git a/standard/links/commons/links.lua b/standard/links/commons/links.lua index ad8d77bc0ed..b0a70b5bdc5 100644 --- a/standard/links/commons/links.lua +++ b/standard/links/commons/links.lua @@ -350,6 +350,10 @@ local ICON_KEYS_TO_RENAME = { } local MATCH_ICONS = { + ballchasing = { + icon = 'File:Ballchasing icon.png', + text = 'Ballchasing replays' + }, breakingpoint = { icon = 'File:Breaking Point GG icon lightmode.png', iconDark = 'File:Breaking Point GG icon darkmode.png', @@ -364,6 +368,10 @@ local MATCH_ICONS = { icon = 'File:Challengermode icon.png', text = 'Match page on Challengermode' }, + civdraft = { + text = 'Civ Draft', + icon = 'File:Civ Draft Icon.png' + }, datdota = { icon = 'File:DatDota-icon.png', text = 'datDota' @@ -434,6 +442,10 @@ local MATCH_ICONS = { icon = 'File:LiveReport32.png', text = 'Live Report Thread' }, + mapdraft = { + text = 'Map Draft', + icon = 'File:Map Draft Icon.png' + }, mplink = { icon = 'File:Osu single color allmode.png', text = 'Match Data' @@ -491,6 +503,10 @@ local MATCH_ICONS = { icon = 'File:RoyaleAPI_allmode.png', text = 'RoyaleAPI Match Page' }, + shift = { + icon = 'File:ShiftRLE icon.png', + text = 'ShiftRLE matchpage' + }, siegegg = { icon = 'File:SiegeGG icon.png', text = 'SiegeGG Match Page'