diff --git a/components/match2/wikis/brawlhalla/match_legacy.lua b/components/match2/wikis/brawlhalla/match_legacy.lua index a49b653fbe..e20e265f3e 100644 --- a/components/match2/wikis/brawlhalla/match_legacy.lua +++ b/components/match2/wikis/brawlhalla/match_legacy.lua @@ -61,7 +61,8 @@ function MatchLegacy._convertParameters(match2) local headList = function (opponentIndex, playerIndex) local heads = Set{} Array.forEach(match2.match2games or {}, function(game) - local player = ((game.opponents[opponentIndex] or {}).players or {})[playerIndex] + local opponents = Json.parseIfString(game.opponents) or {} + local player = ((opponents[opponentIndex] or {}).players or {})[playerIndex] if Logic.isDeepEmpty(player) then return end heads:add(player.char) end) diff --git a/components/match2/wikis/fighters/match_legacy.lua b/components/match2/wikis/fighters/match_legacy.lua index 8feae83ca7..8ef92f398e 100644 --- a/components/match2/wikis/fighters/match_legacy.lua +++ b/components/match2/wikis/fighters/match_legacy.lua @@ -38,8 +38,9 @@ function MatchLegacy._storeGames(match, match2) game.extradata = {} if game.mode == 'singles' then - local player1 = game2.opponents[1].players[1] - local player2 = game2.opponents[2].players[1] + local opponents = Json.parseIfString(game2.opponents) or {} + local player1 = opponents[1].players[1] + local player2 = opponents[2].players[1] game.extradata.char1 = table.concat(Array.map(player1.characters or {}, Operator.property('name')), ',') game.extradata.char2 = table.concat(Array.map(player2.characters or {}, Operator.property('name')), ',') end @@ -103,7 +104,8 @@ function MatchLegacy._convertParameters(match2) local headList = function(opponentIndex, playerIndex) local heads = Set{} Array.forEach(match2.match2games or {}, function(game) - local player = (game.opponents[opponentIndex].players or {})[playerIndex] + local opponents = Json.parseIfString(game.opponents) or {} + local player = (opponents[opponentIndex].players or {})[playerIndex] if player and Logic.isNotEmpty(player.characters) then Array.forEach( Array.map(player.characters, Operator.property('name')), diff --git a/components/match2/wikis/smash/match_legacy.lua b/components/match2/wikis/smash/match_legacy.lua index aa3fd02b64..ad6d5bdea8 100644 --- a/components/match2/wikis/smash/match_legacy.lua +++ b/components/match2/wikis/smash/match_legacy.lua @@ -104,7 +104,8 @@ function MatchLegacy._convertParameters(match2) local headList = function(opponentIndex, playerIndex) local heads = Set{} Array.forEach(match2.match2games or {}, function(game) - local player = (game.opponents[opponentIndex].players or {})[playerIndex] + local opponents = Json.parseIfString(game.opponents) or {} + local player = (opponents[opponentIndex].players or {})[playerIndex] if player and Logic.isNotEmpty(player.characters) then Array.forEach( Array.map(player.characters, Operator.property('name')), diff --git a/components/match2/wikis/starcraft/match_legacy.lua b/components/match2/wikis/starcraft/match_legacy.lua index 5443be53c9..da04e62f7b 100644 --- a/components/match2/wikis/starcraft/match_legacy.lua +++ b/components/match2/wikis/starcraft/match_legacy.lua @@ -48,7 +48,8 @@ function MatchLegacy._storeGames(match, match2) game.extradata.winnerrace = game.extradata.winnerfaction game.extradata.loserrace = game.extradata.loserfaction - Array.forEach(game.opponents, function(opponent, opponentIndex) + local opponents = Json.parseIfString(game.opponents) or {} + Array.forEach(opponents, function(opponent, opponentIndex) Array.forEach(opponent.players or {}, function(player, playerIndex) if Logic.isDeepEmpty(player) then return end local matchPlayer = match2.match2opponents[opponentIndex].match2players[playerIndex] or {} @@ -79,7 +80,8 @@ function MatchLegacy._storeGames(match, match2) submatch.opponent2score = scores[2] or 0 submatch.extradata = {} - Array.forEach(game.opponents, function(opponent, opponentIndex) + local opponents = Json.parseIfString(game.opponents) or {} + Array.forEach(opponents, function(opponent, opponentIndex) Array.forEach(opponent.players or {}, function(player, playerIndex) if Logic.isDeepEmpty(player) then return end local matchPlayer = match2.match2opponents[opponentIndex].match2players[playerIndex] or {} diff --git a/components/match2/wikis/warcraft/match_legacy.lua b/components/match2/wikis/warcraft/match_legacy.lua index 3ee5b741d8..4beb2f6526 100644 --- a/components/match2/wikis/warcraft/match_legacy.lua +++ b/components/match2/wikis/warcraft/match_legacy.lua @@ -167,11 +167,13 @@ function MatchLegacy._groupIntoSubmatches(match2, objectName) local submatchIndex = tonumber(game.subgroup) if game.mode ~= '1v1' or not submatchIndex then return end + local opponents = Json.parseIfString(game.opponents) or {} + if not submatches[submatchIndex] then submatches[submatchIndex] = { games = {}, objectName = objectName .. '_Submatch_' .. submatchIndex, - opponents = MatchLegacy._constructSubmatchOpponents(game.opponents or {}, match2.match2opponents) + opponents = MatchLegacy._constructSubmatchOpponents(opponents, match2.match2opponents) } end local submatch = submatches[submatchIndex] @@ -247,7 +249,8 @@ function MatchLegacy._storeGame(game2, gameIndex, match) game.opponent1score = game2.scores[1] game.opponent2score = game2.scores[2] - local factions, heroes = MatchLegacy._heroesAndFactionFromGameOpponents(game2.opponents) + local opponents = Json.parseIfString(game2.opponents) or {} + local factions, heroes = MatchLegacy._heroesAndFactionFromGameOpponents(opponents) for opponentIndex = 1, 2 do game.extradata['opponent' .. opponentIndex .. 'race'] = factions[opponentIndex] or game.extradata['opponent' .. opponentIndex .. 'race']