diff --git a/components/infobox/wikis/pubg/infobox_league_custom.lua b/components/infobox/wikis/pubg/infobox_league_custom.lua index 8ca65717f66..3fe5fa31462 100644 --- a/components/infobox/wikis/pubg/infobox_league_custom.lua +++ b/components/infobox/wikis/pubg/infobox_league_custom.lua @@ -9,6 +9,7 @@ local Class = require('Module:Class') local Logic = require('Module:Logic') local Lua = require('Module:Lua') +local PageLink = require('Module:Page') local String = require('Module:StringUtils') local Template = require('Module:Template') local Table = require('Module:Table') @@ -27,6 +28,8 @@ local CustomInjector = Class.new(Injector) local _args local _game +local NONE_BREAKING_SPACE = ' ' +local DASH = '–' local _GAME = mw.loadData('Module:GameVersion') local _MODES = { @@ -83,18 +86,10 @@ end function CustomInjector:parse(id, widgets) if id == 'gamesettings' then return { - Cell{name = 'Game version', content = { - CustomLeague._getGameVersion() - } - }, - Cell{name = 'Game mode', content = { - CustomLeague:_getGameMode() - } - }, - Cell{name = 'Platform', content = { - CustomLeague:_getPlatform() - } - }, + Cell{name = 'Game version', content = {CustomLeague._getGameVersion()}}, + Cell{name = 'Game mode', content = {CustomLeague:_getGameMode()}}, + Cell{name = 'Patch', content = {CustomLeague._getPatchVersion()}}, + Cell{name = 'Platform', content = {CustomLeague:_getPlatform()}}, } elseif id == 'customcontent' then if _args.player_number then @@ -167,4 +162,15 @@ function CustomLeague:_getPlatform() return _PLATFORMS[platform] or _PLATFORMS['default'] end +function CustomLeague._getPatchVersion() + if String.isEmpty(_args.patch) then return nil end + local content = PageLink.makeInternalLink(_args.patch, 'Patch ' .. _args.patch) + if String.isNotEmpty(_args.epatch) then + return content .. NONE_BREAKING_SPACE .. DASH .. NONE_BREAKING_SPACE + .. PageLink.makeInternalLink(_args.epatch, 'Patch ' .. _args.epatch) + end + + return content +end + return CustomLeague