Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Patch support for PUBG (PC) #3280

Merged
merged 2 commits into from
Sep 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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