Skip to content

Commit

Permalink
Add Patch support for PUBG (PC) (#3280)
Browse files Browse the repository at this point in the history
* Add Patch support for PUBG (PC)

* Update infobox_league_custom.lua
  • Loading branch information
Hesketh2 authored Sep 13, 2023
1 parent 489a0a2 commit ea345df
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions components/infobox/wikis/pubg/infobox_league_custom.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit ea345df

Please sign in to comment.