Minecraft Wiki

除另有声明,转载时均必须注明出处若簡繁轉換出錯,請以遊戲內為準请勇于扩充与修正内容有兴趣逛逛我们的微博沟通交流,欢迎到社区专页需要协助,请在告示板留言

了解更多

Minecraft Wiki
Advertisement
local p = {}

-- Raw version ({{al_version}})
function p.al_version(f)
    local args = f
    if f == mw.getCurrentFrame() then 
        args = require('Module:ProcessArgs' ).merge(true)
    end
    local version = mw.text.trim( args[1] or '' )
    
    -- load the values from the submodule
    local version_data = mw.loadData('Module:al_version/Versions').versions[version]
    
    local category = ''
    local value
    local title = mw.title.getCurrentTitle()
    
    if version_data then
        if version_data.ver then
    		if version_data.ver == '未知' then
    			value = '未知'
    			if not args.nocat and title.namespace == 0 and not title.isSubpage then
					category = '[[Category:al_version未知的版本]]'
				end
    		else
    	 		value = version_data.ver
			end
        else
            value = 'N/A'
        end
    else
        value = '未知'
        if not args.nocat and title.namespace == 0 and not title.isSubpage then
            category = '[[Category:al_version未知的版本]]'
        end
    end
    return value .. category
end

-- Version table ({{al_version/table}})
function p.table(f)
    local args = f
    if f == mw.getCurrentFrame() then
        args = require('Module:ProcessArgs').merge(true)
    end
    
    local html = {}
    local values = mw.loadData('Module:al_version/Versions').list
    
    function table_header()
		table.insert(html, '<table class="wikitable sortable jquery-tablesorter">\n')
		table.insert(html, '<tr>\n')
		table.insert(html, ' <th>游戏版本</th>\n')
		table.insert(html, ' <th>al_version</th>\n')
		table.insert(html, '</tr>')
	end
	
	table.insert(html, '\n===Classic===\n')
	table_header()
	for _, version in ipairs(values) do
		if version.reset ~= nil then
			table.insert(html, '</table>')
			table.insert(html, '\n===Indev 和 Infdev===\n')
			table_header()
		end
		table.insert(html, '<tr>\n')
		table.insert(html, ' <td>[[Java版' .. version.name .. '|' .. version.name .. ']]</td>')
		table.insert(html, ' <td style="text-align:center;">' .. version.ver .. '</td>')
		table.insert(html, '</tr>')
	end
	table.insert(html, '</table>')
	
	return table.concat(html)
end

return p
Advertisement