Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
21d45b8
commons part
hjpalpha Sep 13, 2025
95186b4
warcraft
hjpalpha Sep 13, 2025
3adac78
has no remaining usage
hjpalpha Sep 13, 2025
e198667
sc2
hjpalpha Sep 13, 2025
e7d1264
broodwar
hjpalpha Sep 13, 2025
851ebee
fix bw
hjpalpha Sep 13, 2025
32bd55b
rl
hjpalpha Sep 13, 2025
8dc33f6
wow
hjpalpha Sep 13, 2025
df82f92
arenafps
hjpalpha Sep 13, 2025
bfc27e5
heroes
hjpalpha Sep 13, 2025
5b257c0
hok
hjpalpha Sep 13, 2025
d7a8553
battalion
hjpalpha Sep 13, 2025
0ef4c3d
cr (needs 2 conversion entry points ...)
hjpalpha Sep 13, 2025
c9713cd
squadrons
hjpalpha Sep 13, 2025
16981f5
trackmania (needs 2 conversion entry points too...)
hjpalpha Sep 13, 2025
7465a84
val
hjpalpha Sep 13, 2025
d605d8b
ow
hjpalpha Sep 13, 2025
730a44f
lol
hjpalpha Sep 13, 2025
88b4d6c
dota2
hjpalpha Sep 13, 2025
f8c1e50
brawlstars
hjpalpha Sep 13, 2025
407d72f
aoe
hjpalpha Sep 13, 2025
000b1c3
fix some typos
hjpalpha Sep 13, 2025
216c0ca
wildrift
hjpalpha Sep 13, 2025
db7e135
cod
hjpalpha Sep 13, 2025
c1b56af
hs
hjpalpha Sep 13, 2025
7025eec
r6
hjpalpha Sep 13, 2025
1e8c70f
typo
hjpalpha Sep 14, 2025
992b254
include #6552
hjpalpha Sep 14, 2025
6ec1118
some fixes
hjpalpha Sep 14, 2025
cbb9c60
forgot to remove from testing
hjpalpha Sep 14, 2025
d4e0339
fix header stuff
hjpalpha Sep 14, 2025
1d34760
fix matchsection
hjpalpha Sep 14, 2025
0e7fbf4
some setting fixes
hjpalpha Sep 14, 2025
62f8f25
simplify a tiny bit
hjpalpha Sep 14, 2025
b53d6b4
commons part for single match converter support
hjpalpha Sep 14, 2025
6fd26ab
aoe singlematch
hjpalpha Sep 14, 2025
cde8919
single match for the rest
hjpalpha Sep 14, 2025
9852bbb
fix r6 a bit
hjpalpha Sep 16, 2025
d252137
account for map veto
hjpalpha Sep 16, 2025
bf986c9
catch other tables inside matches via json
hjpalpha Sep 16, 2025
92bbe52
linter: unused import
hjpalpha Sep 16, 2025
7ed05c4
some warcraft fixes
hjpalpha Sep 16, 2025
e42b54e
fix wc player processing
hjpalpha Sep 16, 2025
94f4e79
some ow fixes
hjpalpha Sep 17, 2025
24b9107
fix some more
hjpalpha Sep 17, 2025
2f77a91
catch edge case with mapveto
hjpalpha Sep 19, 2025
6526bf3
from feedback
hjpalpha Sep 19, 2025
f84154f
heroes mini fix
hjpalpha Sep 19, 2025
d60cc44
arenafps
hjpalpha Sep 19, 2025
a54347f
width for singlematch
hjpalpha Sep 20, 2025
792e313
sc
hjpalpha Sep 20, 2025
b28fe0b
hs + suppress noDuplicateChecck=false args
hjpalpha Sep 20, 2025
d398ca9
fix aoe edge case
hjpalpha Sep 20, 2025
394dc5b
hs: kick pX... stuff on match level
hjpalpha Sep 20, 2025
8b17f81
as per 6585
hjpalpha Sep 23, 2025
5eda13c
fix trackmania old wrapper edge case (unrelated to conversion)
hjpalpha Sep 21, 2025
0dc94b1
battalion
hjpalpha Sep 24, 2025
71a60fa
trackmania
hjpalpha Sep 26, 2025
980ae57
update bot jobs
hjpalpha Sep 28, 2025
946fa04
catch wrong type
hjpalpha Oct 3, 2025
dedcc09
update bot job progression
hjpalpha Oct 3, 2025
4be9871
wr & hok
hjpalpha Oct 6, 2025
0385cdf
wow
hjpalpha Oct 6, 2025
1666f56
Merge branch 'main' into matchlist-generator-wrappers
hjpalpha Oct 6, 2025
315398b
fix: hok wrapper wrongly assumes that map is always set (unrelated to…
hjpalpha Oct 6, 2025
416444e
hok: bestof heuristic
hjpalpha Oct 6, 2025
fb4efd3
update bot runs
hjpalpha Oct 10, 2025
c6df909
squadrons
hjpalpha Oct 17, 2025
3fadffb
Merge branch 'main' into matchlist-generator-wrappers
ElectricalBoy Oct 28, 2025
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
76 changes: 72 additions & 4 deletions lua/wikis/ageofempires/MatchMaps/Legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local Array = Lua.import('Module:Array')
local Json = Lua.import('Module:Json')
local Logic = Lua.import('Module:Logic')
local MatchGroup = Lua.import('Module:MatchGroup')
local MatchGroupLegacy = Lua.import('Module:MatchGroup/Legacy')
local PageVariableNamespace = Lua.import('Module:PageVariableNamespace')
local Table = Lua.import('Module:Table')
local Template = Lua.import('Module:Template')
Expand Down Expand Up @@ -72,11 +73,11 @@ function MatchMapsLegacy._readMaps(matchArgs)
end
--handle MatchMaps mapXwin
local mapWinners = Table.filterByKey(matchArgs, function (key)
local winner = key:match('map(%d+)win')
local winner = string.match(key, 'map(%d+)win')
return winner ~= nil
end)
Table.iter.forEachPair(mapWinners, function (key)
local mapKey = key:match('(map%d+)')
local mapKey = string.match(key, '(map%d+)')
local mapWinner = Table.extract(matchArgs, mapKey .. 'win')
matchArgs[mapKey] = matchArgs[mapKey] or {}
matchArgs[mapKey].winner = matchArgs[mapKey].winner or mapWinner
Expand All @@ -87,11 +88,17 @@ end
---@param frame Frame
---@return Html
function MatchMapsLegacy.convertMatch(frame)
local matchArgs = MatchMapsLegacy._mergeDetailsIntoArgs(Arguments.getArgs(frame))
local args = Arguments.getArgs(frame)
local generate = Logic.readBool(Table.extract(args, 'generate'))
local matchArgs = MatchMapsLegacy._mergeDetailsIntoArgs(args)
MatchMapsLegacy._readOpponents(matchArgs)
MatchMapsLegacy._readMaps(matchArgs)
matchArgs.winner = matchArgs.winner or Table.extract(matchArgs, 'win')

if generate then
return Json.stringify(matchArgs)
end

Template.stashReturnValue(matchArgs, 'LegacyMatchlist')
return mw.html.create('div'):css('display', 'none')
end
Expand Down Expand Up @@ -121,7 +128,7 @@ function MatchMapsLegacy.showmatch(frame)
id = id,
hide = true,
store = store,
noDuplicateCheck = not store,
noDuplicateCheck = not store or nil,
R1M1 = match
})

Expand Down Expand Up @@ -202,4 +209,65 @@ function MatchMapsLegacy.matchlistEnd()
return MatchGroup.MatchList(matchListArgs)
end

--- for bot conversion to proper match2 matchlists
---@param frame Frame
---@return string
function MatchMapsLegacy.generate(frame)
local args = Arguments.getArgs(frame)

local store = Logic.readBoolOrNil(args.store)

local offset = 0
local title = args.title
if not title and not Json.parseIfTable(args[1]) then
title = args[1]
offset = 1
end

local parsedArgs = {
id = args.id,
title = title,
width = args.width or '320px',
collapsed = Logic.nilOr(Logic.readBoolOrNil(args.hide), true),
attached = Logic.nilOr(Logic.readBoolOrNil(args.hide), true),
store = store,
matchsection = args.matchsection,
patch = args.patch,
}

local gsl = args.gsl
if Logic.isNotEmpty(gsl) then
if gsl == GSL_WINNERS or gsl == GSL_LOSERS then
gsl = gsl .. 'first'
parsedArgs.gsl = gsl
end
end

---@type table[]
local matches = Array.mapIndexes(function(index)
return args[index + offset]
end)

Array.forEach(matches, function(match, matchIndex)
parsedArgs['M' .. matchIndex] = match
end)

return MatchGroupLegacy.generateWikiCodeForMatchList(parsedArgs)
end

---@param frame Frame
---@return string
function MatchMapsLegacy.generateSingleMatch(frame)
local args = Arguments.getArgs(frame)
args.generate = true

assert(args.id, 'Missing id')

return MatchGroupLegacy.generateWikiCodeForSingleMatch{
match = MatchMapsLegacy.convertMatch(args),
id = args.id,
width = args.width,
}
end

return MatchMapsLegacy
35 changes: 32 additions & 3 deletions lua/wikis/arenafps/MatchMaps/Legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local Array = Lua.import('Module:Array')
local Json = Lua.import('Module:Json')
local Logic = Lua.import('Module:Logic')
local MatchGroup = Lua.import('Module:MatchGroup')
local MatchGroupLegacy = Lua.import('Module:MatchGroup/Legacy')
local PageVariableNamespace = Lua.import('Module:PageVariableNamespace')
local Table = Lua.import('Module:Table')

Expand Down Expand Up @@ -110,7 +111,7 @@ function MatchMapsLegacy.showmatch(frame)
id = id,
hide = true,
store = store,
noDuplicateCheck = not store,
noDuplicateCheck = not store or nil,
R1M1 = match
})

Expand All @@ -120,10 +121,17 @@ function MatchMapsLegacy.showmatch(frame)
})
end

---@param frame any
---@return string
function MatchMapsLegacy.generate(frame)
return MatchMapsLegacy.matchList(frame, true)
end

-- invoked by Template:LegacyMatchList
---@param frame Frame
---@param generate true?
---@return string
function MatchMapsLegacy.matchList(frame)
function MatchMapsLegacy.matchList(frame, generate)
globalVars:set('islegacy', 'true')
local args = Arguments.getArgs(frame)
assert(args.id, 'Missing id')
Expand All @@ -133,7 +141,7 @@ function MatchMapsLegacy.matchList(frame)
Table.mergeInto(args, {
isLegacy = true,
store = store,
noDuplicateCheck = not store,
noDuplicateCheck = not store or nil,
collapsed = hide,
attached = hide,
title = Logic.nilOr(Table.extract(args, 'title'), args[1]),
Expand All @@ -148,7 +156,28 @@ function MatchMapsLegacy.matchList(frame)
end

globalVars:delete('islegacy')

if generate then
args.isLegacy = nil
return MatchGroupLegacy.generateWikiCodeForMatchList(args)
end

return MatchGroup.MatchList(args)
end

---@param frame Frame
---@return string
function MatchMapsLegacy.generateSingleMatch(frame)
local args = Arguments.getArgs(frame)
args.generate = true

assert(args.id, 'Missing id')

return MatchGroupLegacy.generateWikiCodeForSingleMatch{
match = MatchMapsLegacy.convertMatch(args),
id = args.id,
width = args.width,
}
end

return MatchMapsLegacy
45 changes: 45 additions & 0 deletions lua/wikis/battalion/MatchGroup/Legacy/MatchList.lua
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
local Lua = require('Module:Lua')

local Arguments = Lua.import('Module:Arguments')
local Array = Lua.import('Module:Array')
local Json = Lua.import('Module:Json')
local Logic = Lua.import('Module:Logic')
local Match = Lua.import('Module:Match')
local MatchGroup = Lua.import('Module:MatchGroup')
local MatchGroupLegacy = Lua.import('Module:MatchGroup/Legacy')
local Opponent = Lua.import('Module:Opponent/Custom')
local PageVariableNamespace = Lua.import('Module:PageVariableNamespace')
local Table = Lua.import('Module:Table')
Expand All @@ -24,6 +26,42 @@ local LegacyMatchList = {}

local NUMBER_OF_OPPONENTS = 2

--- for bot conversion to proper match2 matchlists
---@param frame Frame
---@return string
function LegacyMatchList.generate(frame)
local args = Arguments.getArgs(frame)

local store = Logic.readBoolOrNil(args.store)

local offset = 0
local title = args.title
if not title and not Json.parseIfTable(args[1]) then
title = args[1]
offset = 1
end

local parsedArgs = {
id = args.id,
title = title,
width = args.width,
collapsed = Logic.nilOr(Logic.readBoolOrNil(args.hide), true),
attached = Logic.nilOr(Logic.readBoolOrNil(args.hide), true),
store = store,
}

---@type table[]
local matches = Array.mapIndexes(function(index)
return Json.parseIfTable(args[index + offset])
end)

Array.forEach(matches, function(match, matchIndex)
parsedArgs['M' .. matchIndex] = Match.makeEncodedJson(match)
end)

return MatchGroupLegacy.generateWikiCodeForMatchList(parsedArgs)
end

-- invoked by Template:Legacy Match list start
---@param frame Frame
function LegacyMatchList.init(frame)
Expand All @@ -42,9 +80,12 @@ end

-- invoked by Template:Match maps
---@param frame Frame
---@return string?
function LegacyMatchList.matchMaps(frame)
local args = Arguments.getArgs(frame)

local generate = Logic.readBool(Table.extract(args, 'generate'))

local processedArgs = Table.copy(args)
LegacyMatchList._handleOpponents(processedArgs)

Expand All @@ -57,6 +98,10 @@ function LegacyMatchList.matchMaps(frame)
-- all other args from the match maps calls are just passed along directly
-- as they can be read by the match2 processing

if generate then
return Json.stringify(processedArgs)
end

Template.stashReturnValue(processedArgs, 'LegacyMatchlist')
end

Expand Down
67 changes: 65 additions & 2 deletions lua/wikis/brawlstars/MatchMaps/Legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ local Array = Lua.import('Module:Array')
local Logic = Lua.import('Module:Logic')
local Json = Lua.import('Module:Json')
local MatchGroup = Lua.import('Module:MatchGroup')
local MatchGroupLegacy = Lua.import('Module:MatchGroup/Legacy')
local PageVariableNamespace = Lua.import('Module:PageVariableNamespace')
local Table = Lua.import('Module:Table')
local Template = Lua.import('Module:Template')
Expand Down Expand Up @@ -226,13 +227,19 @@ end
---@return Html
function MatchMapsLegacy.convertMatch(frame)
local args = Arguments.getArgs(frame)
local generate = Logic.readBool(Table.extract(args, 'generate'))

local details = Json.parseIfString(args.details or '{}')

args, details = MatchMapsLegacy._handleDetails(args, details)
args = MatchMapsLegacy._handleOpponents(args)
args = MatchMapsLegacy._setHeaderIfEmpty(args, details)
args = MatchMapsLegacy._copyDetailsToArgs(args, details)

if generate then
return Json.stringify(args)
end

Template.stashReturnValue(args, 'LegacyMatchlist')
return mw.html.create('div'):css('display', 'none')
end
Expand All @@ -257,7 +264,7 @@ function MatchMapsLegacy.showmatch(frame)
id = args.id,
hide = true,
store = store,
noDuplicateCheck = not store,
noDuplicateCheck = not store or nil,
R1M1 = matches[1]
})

Expand Down Expand Up @@ -299,7 +306,7 @@ function MatchMapsLegacy.matchListEnd()
isLegacy = true,
id = bracketId,
store = store,
noDuplicateCheck = not store,
noDuplicateCheck = not store or nil,
collapsed = hide,
attached = hide,
title = matchlistVars:get('matchListTitle'),
Expand All @@ -325,4 +332,60 @@ function MatchMapsLegacy.matchListEnd()
return MatchGroup.MatchList(args)
end

--- for bot conversion to proper match2 matchlists
---@param frame Frame
---@return string
function MatchMapsLegacy.generate(frame)
local args = Arguments.getArgs(frame)

local store = Logic.readBoolOrNil(args.store)

local offset = 0
local title = args.title
if not title and not Json.parseIfTable(args[1]) then
title = args[1]
offset = 1
end

local parsedArgs = {
id = args.id,
title = title,
width = args.width or '300px',
collapsed = Logic.nilOr(Logic.readBoolOrNil(args.hide), true),
attached = Logic.nilOr(Logic.readBoolOrNil(args.hide), true),
store = store,
}

local matchsection = Logic.nilOr(args.lpdb_title, args.title)
if Logic.readBoolOrNil(matchsection) ~= false then
parsedArgs.matchsection = matchsection
end

---@type table[]
local matches = Array.mapIndexes(function(index)
return args[index + offset]
end)

Array.forEach(matches, function(match, matchIndex)
parsedArgs['M' .. matchIndex] = match
end)

return MatchGroupLegacy.generateWikiCodeForMatchList(parsedArgs)
end

---@param frame Frame
---@return string
function MatchMapsLegacy.generateSingleMatch(frame)
local args = Arguments.getArgs(frame)
args.generate = true

assert(args.id, 'Missing id')

return MatchGroupLegacy.generateWikiCodeForSingleMatch{
match = MatchMapsLegacy.convertMatch(args),
id = args.id,
width = args.width,
}
end

return MatchMapsLegacy
Loading
Loading