Skip to content

Commit

Permalink
Merge branch 'main' into aoe-mgi-custom-map-parsing-to-standard
Browse files Browse the repository at this point in the history
  • Loading branch information
hjpalpha authored Dec 19, 2024
2 parents bdffde7 + ed36b2b commit b7e8c99
Show file tree
Hide file tree
Showing 27 changed files with 269 additions and 49 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ jobs:
- name: Personal Lua Deploy
if: steps.changed-files.outputs.any_changed == 'true'
env:
WIKI_USER: ${{ secrets.LP_USER }}
WIKI_PASSWORD: ${{ secrets.LP_PASSWORD }}
WIKI_USER: ${{ secrets.LP_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }}
LUA_DEV_ENV_NAME: "/dev/${{ github.event.inputs.luadevenv }}"
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,17 @@ jobs:
- name: Resource Deploy
if: steps.res-changed-files.outputs.any_changed == 'true'
env:
WIKI_USER: ${{ secrets.LP_USER }}
WIKI_PASSWORD: ${{ secrets.LP_PASSWORD }}
WIKI_USER: ${{ secrets.LP_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }}
run: bash scripts/deploy_res.sh "${{ steps.res-changed-files.outputs.all_changed_files }}"

- name: Lua Deploy
if: steps.lua-changed-files.outputs.any_changed == 'true'
env:
WIKI_USER: ${{ secrets.LP_USER }}
WIKI_PASSWORD: ${{ secrets.LP_PASSWORD }}
WIKI_USER: ${{ secrets.LP_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }}
run: bash scripts/deploy.sh "${{ steps.lua-changed-files.outputs.all_changed_files }}"
Expand All @@ -69,8 +69,8 @@ jobs:
- name: Deploy Old Dev
if: steps.changed-files.outputs.any_changed == 'true'
env:
WIKI_USER: ${{ secrets.DEV_WIKI_USER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_PASSWORD }}
WIKI_USER: ${{ secrets.DEV_WIKI_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.DEV_WIKI_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.DEV_WIKI_BASE_URL }}
DEV_WIKI_BASIC_AUTH: ${{ secrets.DEV_WIKI_BASIC_AUTH }}
Expand All @@ -79,8 +79,8 @@ jobs:
- name: Deploy New Dev
if: steps.changed-files.outputs.any_changed == 'true'
env:
WIKI_USER: ${{ secrets.DEV_WIKI_USER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_PASSWORD }}
WIKI_USER: ${{ secrets.DEV_WIKI_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.DEV_WIKI_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.DEV_WIKI_BASE_URL2 }}
DEV_WIKI_BASIC_AUTH: ${{ secrets.DEV_WIKI_BASIC_AUTH }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:

- name: Resource Deploy
env:
WIKI_USER: ${{ secrets.LP_USER }}
WIKI_PASSWORD: ${{ secrets.LP_PASSWORD }}
WIKI_USER: ${{ secrets.LP_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }}
run: bash scripts/deploy_res.sh

- name: Lua Deploy
env:
WIKI_USER: ${{ secrets.LP_USER }}
WIKI_PASSWORD: ${{ secrets.LP_PASSWORD }}
WIKI_USER: ${{ secrets.LP_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.LP_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.LP_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.LP_BASE_URL }}
run: bash scripts/deploy.sh
Expand All @@ -42,17 +42,17 @@ jobs:

- name: Deploy Old Dev
env:
WIKI_USER: ${{ secrets.DEV_WIKI_USER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_PASSWORD }}
WIKI_USER: ${{ secrets.DEV_WIKI_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.DEV_WIKI_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.DEV_WIKI_BASE_URL }}
DEV_WIKI_BASIC_AUTH: ${{ secrets.DEV_WIKI_BASIC_AUTH }}
run: bash scripts/deploy.sh

- name: Deploy New Dev
env:
WIKI_USER: ${{ secrets.DEV_WIKI_USER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_PASSWORD }}
WIKI_USER: ${{ secrets.DEV_WIKI_BOTUSER }}
WIKI_PASSWORD: ${{ secrets.DEV_WIKI_BOTPASSWORD }}
WIKI_UA_EMAIL: ${{ secrets.DEV_WIKI_UA_EMAIL }}
WIKI_BASE_URL: ${{ secrets.DEV_WIKI_BASE_URL2 }}
DEV_WIKI_BASIC_AUTH: ${{ secrets.DEV_WIKI_BASIC_AUTH }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
--

local Class = require('Module:Class')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local Variables = require('Module:Variables')

Expand Down Expand Up @@ -38,6 +39,12 @@ function CustomHiddenDataBox.addCustomVariables(args, queryResult)
Variables.varDefine('tournament_icon_dark', Variables.varDefault('tournament_icondark'))
Variables.varDefine('tournament_parent_page', Variables.varDefault('tournament_parent'))

Variables.varDefine('headtohead', tostring(Logic.readBool(Logic.emptyOr(
args.headtohead,
Variables.varDefault('headtohead'),
(queryResult.extradata or {}).headtohead
))))

BasicHiddenDataBox.checkAndAssign('tournament_patch', args.patch, queryResult.patch)
end

Expand Down
4 changes: 4 additions & 0 deletions components/infobox/wikis/dota2/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
local Array = require('Module:Array')
local Class = require('Module:Class')
local Game = require('Module:Game')
local Logic = require('Module:Logic')
local Lua = require('Module:Lua')
local String = require('Module:StringUtils')
local Variables = require('Module:Variables')
Expand Down Expand Up @@ -86,18 +87,21 @@ end
function CustomLeague:addToLpdb(lpdbData, args)
lpdbData.extradata.individual = String.isNotEmpty(args.player_number) and 'true' or ''
lpdbData.extradata.dpcpoints = String.isNotEmpty(args.points) or ''
lpdbData.extradata.headtohead = self.data.headtohead

return lpdbData
end

---@param args table
function CustomLeague:customParseArguments(args)
self.data.publishertier = (self.publisherTier or {}).name
self.data.headtohead = tostring(Logic.readBool(args.headtohead))
end

---@param args table
function CustomLeague:defineCustomPageVariables(args)
-- Custom Vars
Variables.varDefine('headtohead', self.data.headtohead)
Variables.varDefine('tournament_pro_circuit_points', args.points or '')
local isIndividual = String.isNotEmpty(args.individual) or String.isNotEmpty(args.player_number)
Variables.varDefine('tournament_individual', isIndividual and 'true' or '')
Expand Down
2 changes: 1 addition & 1 deletion components/match2/commons/match_group_input_util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1176,7 +1176,7 @@ end
--- The Parser injection may optionally have the following functions:
--- - calculateMapScore(map): fun(opponentIndex): integer?
--- - getExtraData(match, map, opponents): table?
--- - getMapName(map): string?, string?
--- - getMapName(map, mapIndex, match): string?, string?
--- - getMapMode(match, map, opponents): string?
--- - getPlayersOfMapOpponent(map, opponent, opponentIndex): table[]?
--- - getPatch(game): string?
Expand Down
9 changes: 7 additions & 2 deletions components/match2/commons/match_summary_base_ffa.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,11 @@ local MATCH_OVERVIEW_COLUMNS = {
return 'bg-' .. (opponent.advanceBg or '')
end,
value = function (opponent, idx)
if not STATUS_ICONS[opponent.advanceBg] then
if not STATUS_ICONS[opponent.placementStatus] then
return
end
return IconWidget{
iconName = STATUS_ICONS[opponent.advanceBg],
iconName = STATUS_ICONS[opponent.placementStatus],
}
end,
},
Expand Down Expand Up @@ -569,6 +569,11 @@ function MatchSummaryFfa.updateMatchOpponents(match)

-- Sort match level based on final placement & score
Array.sortInPlaceBy(match.opponents, FnUtil.identity, MatchSummaryFfa.placementSortFunction)

-- Set the status of the current placement
Array.forEach(match.opponents, function(opponent, idx)
opponent.placementStatus = ((match.extradata.placementinfo or {})[idx] or {}).status
end)
end

---@param game table
Expand Down
13 changes: 7 additions & 6 deletions components/match2/wikis/ageofempires/match_legacy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,13 @@ function MatchLegacy.storeGames(match, match2)
Array.forEach(opponents, function(opponent, opponentIndex)
-- opponent.players can have gaps
for _, player in pairs(opponent.players) do
if Table.isEmpty(player) then return end
local prefix = 'o' .. opponentIndex .. 'p' .. player.index
game.extradata[prefix] = player.pageName
game.extradata[prefix .. 'faction'] = player.civ
game.extradata[prefix .. 'name'] = player.displayname
game.extradata[prefix .. 'flag'] = player.flag
if Table.isNotEmpty(player) then
local prefix = 'o' .. opponentIndex .. 'p' .. player.index
game.extradata[prefix] = player.pageName
game.extradata[prefix .. 'faction'] = player.civ
game.extradata[prefix .. 'name'] = player.displayname
game.extradata[prefix .. 'flag'] = player.flag
end
end
end)
elseif game.mode == '1v1' then
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
-- @Liquipedia
-- wiki=marvelrivals
-- 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 Logic = require('Module:Logic')
local Lua = require('Module:Lua')

local BaseCopyPaste = Lua.import('Module:GetMatchGroupCopyPaste/wiki/Base')

---@class MarvelRivalsMatch2CopyPaste: 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 showScore = bestof == 0
local opponent = WikiCopyPaste.getOpponent(mode, showScore)

local lines = Array.extendWith({},
'{{Match',
showScore and (INDENT .. '|finished=') or nil,
INDENT .. '|date=',
Logic.readBool(args.streams) and (INDENT .. '|twitch=|youtube=|vod=') or nil,
Array.map(Array.range(1, opponents), function(opponentIndex)
return INDENT .. '|opponent' .. opponentIndex .. '=' .. opponent
end),
bestof ~= 0 and Array.map(Array.range(1, bestof), function(mapIndex)
return INDENT .. '|map' .. mapIndex .. '={{Map|map=|score1=|score2=|winner=}}'
end) or nil,
INDENT .. '}}'
)

return table.concat(lines, '\n')
end

return WikiCopyPaste
59 changes: 59 additions & 0 deletions components/match2/wikis/marvelrivals/match_group_input_custom.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
-- @Liquipedia
-- wiki=marvelrivals
-- page=Module:MatchGroup/Input/Custom
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Lua = require('Module:Lua')

local MatchGroupInputUtil = Lua.import('Module:MatchGroup/Input/Util')

local CustomMatchGroupInput = {}
local MatchFunctions = {
DEFAULT_MODE = 'team',
getBestOf = MatchGroupInputUtil.getBestOf,
}
local MapFunctions = {}

---@param match table
---@param options table?
---@return table
function CustomMatchGroupInput.processMatch(match, options)
return MatchGroupInputUtil.standardProcessMatch(match, MatchFunctions)
end

--
-- match related functions
--
---@param match table
---@param opponents table[]
---@return table[]
function MatchFunctions.extractMaps(match, opponents)
return MatchGroupInputUtil.standardProcessMaps(match, opponents, MapFunctions)
end

---@param maps table[]
---@return fun(opponentIndex: integer): integer?
function MatchFunctions.calculateMatchScore(maps)
return function(opponentIndex)
return MatchGroupInputUtil.computeMatchScoreFromMapWinners(maps, opponentIndex)
end
end

--
-- map related functions
--

---@param match table
---@param map table
---@param opponents table[]
---@return table
function MapFunctions.getExtraData(match, map, opponents)
return {
comment = map.comment,
}
end

return CustomMatchGroupInput
51 changes: 51 additions & 0 deletions components/match2/wikis/marvelrivals/match_summary.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
---
-- @Liquipedia
-- wiki=marvelrivals
-- page=Module:MatchSummary
--
-- Please see https://github.com/Liquipedia/Lua-Modules to contribute
--

local Lua = require('Module:Lua')

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 WidgetUtil = Lua.import('Module:Widget/Util')

local CustomMatchSummary = {}

---@param args table
---@return Html
function CustomMatchSummary.getByMatchId(args)
return MatchSummary.defaultGetByMatchId(CustomMatchSummary, args)
end

---@param date string
---@param game MatchGroupUtilGame
---@param gameIndex integer
---@return Widget?
function CustomMatchSummary.createGame(date, game, gameIndex)
if not game.map then
return
end

local function makeTeamSection(opponentIndex)
return {
MatchSummaryWidgets.GameWinLossIndicator{winner = game.winner, opponentIndex = opponentIndex},
DisplayHelper.MapScore(game.scores[opponentIndex], opponentIndex, game.resultType, game.walkover, game.winner)
}
end

return MatchSummaryWidgets.Row{
classes = {'brkts-popup-body-game'},
children = WidgetUtil.collect(
MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(1)},
MatchSummaryWidgets.GameCenter{children = DisplayHelper.Map(game)},
MatchSummaryWidgets.GameTeamWrapper{children = makeTeamSection(2), flipped = true},
MatchSummaryWidgets.GameComment{children = game.comment}
)
}
end

return CustomMatchSummary
2 changes: 1 addition & 1 deletion components/match2/wikis/osu/match_group_input_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function MapFunctions.computeOpponentScore(props, autoScore)

props.score = string.gsub(props.score or '', ',', '')

return MatchGroupInputUtil.computeOpponentScore(props)
return MatchGroupInputUtil.computeOpponentScore(props, autoScore)
end

return CustomMatchGroupInput
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function MapFunctions.computeOpponentScore(props, autoScore)
props.score = props.score:gsub('m', '')
end

return MatchGroupInputUtil.computeOpponentScore(props)
return MatchGroupInputUtil.computeOpponentScore(props, autoScore)
end


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function MapFunctions.computeOpponentScore(props, autoScore)
props.score = props.score:gsub('%%', '')
end

return MatchGroupInputUtil.computeOpponentScore(props, MapFunctions.calculateMapScore)
return MatchGroupInputUtil.computeOpponentScore(props, autoScore)
end

return CustomMatchGroupInput
Loading

0 comments on commit b7e8c99

Please sign in to comment.