-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(match2): support freefire (#5160)
* copy paste of pubm * add manual points support * move `Horizontallist` check to commons * rename `pointmodifier` to `startingpoints` (as this is what the code treats it as) add support for it on all BR wikis * setttings for game details * missign check * parsing typo * add styling too * update default points
- Loading branch information
Showing
15 changed files
with
507 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 0 additions & 24 deletions
24
components/match2/wikis/apexlegends/brkts_wiki_specific.lua
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=freefire | ||
-- page=Module:GameSummary | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local CustomGameSummary = {} | ||
|
||
local Array = require('Module:Array') | ||
local FnUtil = require('Module:FnUtil') | ||
local Lua = require('Module:Lua') | ||
local Page = require('Module:Page') | ||
local Table = require('Module:Table') | ||
|
||
local MatchGroupUtil = Lua.import('Module:MatchGroup/Util') | ||
|
||
local SummaryHelper = Lua.import('Module:MatchSummary/Ffa') | ||
local MatchSummaryWidgets = Lua.import('Module:Widget/Match/Summary/Ffa/All') | ||
local HtmlWidgets = Lua.import('Module:Widget/Html/All') | ||
local IconWidget = Lua.import('Module:Widget/Image/Icon/Fontawesome') | ||
|
||
---@class FreefireMatchGroupUtilGame: MatchGroupUtilGame | ||
---@field stream table | ||
|
||
---@param props {bracketId: string, matchId: string, gameIdx: integer} | ||
---@return Html | ||
function CustomGameSummary.getGameByMatchId(props) | ||
---@class ApexMatchGroupUtilMatch | ||
local match = MatchGroupUtil.fetchMatchForBracketDisplay(props.bracketId, props.matchId) | ||
|
||
local game = match.games[props.gameIdx] | ||
assert(game, 'Error Game ID ' .. tostring(props.gameIdx) .. ' not found') | ||
|
||
game.stream = match.stream | ||
|
||
CustomGameSummary._opponents(game, match.opponents) | ||
local scoringData = SummaryHelper.createScoringData(match) | ||
|
||
return MatchSummaryWidgets.Tab{ | ||
matchId = match.matchId, | ||
idx = props.gameIdx, | ||
children = { | ||
CustomGameSummary._createGameDetails(game), | ||
MatchSummaryWidgets.PointsDistribution{killScore = scoringData.kill, placementScore = scoringData.placement}, | ||
SummaryHelper.standardGame(game) | ||
} | ||
} | ||
end | ||
|
||
---@param game table | ||
---@return Widget | ||
function CustomGameSummary._createGameDetails(game) | ||
return MatchSummaryWidgets.ContentItemContainer{contentClass = 'panel-content__game-schedule', | ||
items = { | ||
{ | ||
icon = MatchSummaryWidgets.CountdownIcon{game = game}, | ||
content = MatchSummaryWidgets.GameCountdown{game = game}, | ||
}, | ||
game.map and { | ||
icon = IconWidget{iconName = 'map'}, | ||
content = HtmlWidgets.Span{children = Page.makeInternalLink(game.map)}, | ||
} or nil, | ||
} | ||
} | ||
end | ||
|
||
---@param game table | ||
---@param matchOpponents table[] | ||
function CustomGameSummary._opponents(game, matchOpponents) | ||
-- Add match opponent data to game opponent | ||
game.opponents = Array.map(game.opponents, | ||
function(gameOpponent, opponentIdx) | ||
local matchOpponent = matchOpponents[opponentIdx] | ||
local newGameOpponent = Table.merge(matchOpponent, gameOpponent) | ||
-- These values are only allowed to come from Game and not Match | ||
newGameOpponent.placement = gameOpponent.placement | ||
newGameOpponent.score = gameOpponent.score | ||
newGameOpponent.status = gameOpponent.status | ||
return newGameOpponent | ||
end | ||
) | ||
|
||
-- Sort game level based on placement | ||
Array.sortInPlaceBy(game.opponents, FnUtil.identity, SummaryHelper.placementSortFunction) | ||
end | ||
|
||
return CustomGameSummary |
68 changes: 68 additions & 0 deletions
68
components/match2/wikis/freefire/get_match_group_copy_paste_wiki.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
-- @Liquipedia | ||
-- wiki=freefire | ||
-- page=Module:GetMatchGroupCopyPaste/wiki | ||
-- | ||
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute | ||
-- | ||
|
||
local Array = require('Module:Array') | ||
local Class = require('Module:Class') | ||
local Lua = require('Module:Lua') | ||
|
||
local OpponentLibraries = require('Module:OpponentLibraries') | ||
local Opponent = OpponentLibraries.Opponent | ||
|
||
local BaseCopyPaste = Lua.import('Module:GetMatchGroupCopyPaste/wiki/Base') | ||
|
||
---WikiSpecific Code for MatchList and Bracket Code Generators | ||
---@class FreefireMatchCopyPaste: Match2CopyPasteBase | ||
local WikiCopyPaste = Class.new(BaseCopyPaste) | ||
|
||
local INDENT = WikiCopyPaste.Indent | ||
|
||
---returns the Code for a Match, depending on the input | ||
---@param bestof integer | ||
---@param mode string | ||
---@param index integer | ||
---@param opponents integer | ||
---@param args table | ||
---@return string | ||
function WikiCopyPaste.getMatchCode(bestof, mode, index, opponents, args) | ||
local lines = Array.extend( | ||
'{{Match|finished=', | ||
INDENT .. '|p_kill=1 |p1=12 |p2=9 |p3=8 |p4=7 |p5=6 |p6=5 |p7=4 |p8=3 |p9=2 |p10=1 |p11=0 |p12=0', | ||
{INDENT .. '|twitch=|youtube='}, | ||
Array.map(Array.range(1, bestof), function(mapIndex) | ||
return INDENT .. '|map' .. mapIndex .. '={{Map|date=|finished=|map=|vod=}}' | ||
end), | ||
Array.map(Array.range(1, opponents), function(opponentIndex) | ||
return INDENT .. '|opponent' .. opponentIndex .. '=' .. WikiCopyPaste._getOpponent(mode, bestof) | ||
end), | ||
'}}' | ||
) | ||
|
||
return table.concat(lines, '\n') | ||
end | ||
|
||
--subfunction used to generate the code for the Opponent template, depending on the type of opponent | ||
---@param mode string | ||
---@param mapCount integer | ||
---@return string | ||
function WikiCopyPaste._getOpponent(mode, mapCount) | ||
local mapScores = table.concat(Array.map(Array.range(1, mapCount), function(idx) | ||
return '|m' .. idx .. '={{MS||}}' | ||
end)) | ||
|
||
if mode == Opponent.solo then | ||
return '{{SoloOpponent||flag=' .. mapScores .. '}}' | ||
elseif mode == Opponent.team then | ||
return '{{TeamOpponent|' .. mapScores .. '}}' | ||
elseif mode == Opponent.literal then | ||
return '{{Literal|' .. mapScores .. '}}' | ||
end | ||
|
||
return '' | ||
end | ||
|
||
return WikiCopyPaste |
Oops, something went wrong.