Minecraft Wiki
Advertisement
Deze pagina heeft nog geen documentatie. Als je weet hoe het werkt, maak het dan alsjeblieft.
local p = {}

--[[ 
    Vertalingstabel ({{Vertalingen/tabel}}).

    Vereiste modules: ProcessArgs, -Waarden-, -Waarden/Vertalingen-, DarkShadowTNT, DarkShadowTNT/vertalingen
]]
function p.translationTable( f )
    local args = f
    if f == mw.getCurrentFrame() then
        args = require( 'Module:ProcessArgs' ).merge( true )
    end
    
    local html = {}
    local groups = mw.loadData( 'Module:DarkShadowTNT/vertalingen' ).groups

    for _, group in ipairs(groups) do
        table.insert( html, "=== " .. group.name .. " ===\n" )
        if group.desc ~= nil then
            table.insert( html, group.desc .. '\n')
        end
        table.insert( html, "<table class='wikitable sortable jquery-tablesorter alternaterows' style='width:100%;font-size:smaller'>\n" )
        table.insert( html, '<tr>\n' )
        table.insert( html, "<th style='min-width:30%;max-width:30%'>Technische naam</th>\n" )
        table.insert( html, "<th style='min-width:35%;max-width:35%'>Origineel</th>\n" )
        table.insert( html, "<th style='min-width:35%;max-width:35%'>Vertaling</th>\n" )
        table.insert( html, '</tr>\n' )

        local num_same_original
        local last_original = -1
        local original_row

        for __, vertaling in ipairs(group.values) do
            table.insert( html, '<tr>' )
            table.insert( html, "<td class='searchable'><code>" .. vertaling.technical .. '</code></td>' )
            if vertaling.original ~= last_original or vertaling.force_split then
                last_original = vertaling.original
                num_same_original = 1
                table.insert( html, "<td class='searchable'>" .. vertaling.original .. '</td>' )
                protocol_row = #html
            else
                num_same_original = num_same_original + 1
                html[original_row] = '<td class=searchable rowspan="' .. num_same_original .. '">' .. vertaling.original .. '</td>'
            end
            if vertaling.dutch then
                table.insert( html, "<td class='searchable'>" .. vertaling.dutch .. '</td>' )
            else
                table.insert( html, "<td class='searchable'>—</td>" )
            end
            table.insert( html, '</tr>' )
        end

        table.insert( html, '</table>\n' )
    end

    return table.concat( html )
end

--[[
	Maak downloadlinks om de s3-links te vervangen.
]]
function p.downloadLinkConstructor( f )
	-- Merge ProcessArgs
	local args = f
	if f == mw.getCurrentFrame() then 
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		f = mw.getCurrentFrame()
	end
	-- Locate the page with hashes
	local hash = mw.loadData( 'Module:DarkShadowTNT/downloadlinks' )[versie]
	-- Get the version (either via pagename or with a defined parameter, like {{downloadlink|18w20c|client}})
	local versie = args[1] or mw.title.getCurrentTitle()
	-- Construct the links
	if args[2] == 'client' or 'clienthash' then
		local clientHash = hash.clienthash
		return 'https://launcher.mojang.com/mc/game/' .. versie .. '/client/' .. clientHash .. '/client.jar'
	elseif args[2] == 'server' or 'serverhash' then
		local serverHash = hash.serverhash
		return 'https://launcher.mojang.com/mc/game/' .. versie .. '/server/' .. serverHash .. '/server.jar'
	elseif args[2] == 'json' or 'jsonhash' then
		local jsonHash = hash.jsonhash
		return 'https://launchermeta.mojang.com/mc/game/' .. jsonHash .. '/' .. versie .. '.json'
	else
		return '<span style="color:red">Geen versie opgegeven!</span>'
	end
end

return p
Advertisement