缺氧 wiki 编辑团队提示:注册账号并登录后体验更佳,且可通过参数设置定制优化您的浏览体验!

该站点为镜像站点,如果你想帮助这个由玩家志愿编辑的 wiki 站点,请前往原站点参与编辑,
同时欢迎加入编辑讨论群 851803695 与其他编辑者一起参与建设!

全站通知:

模块:表格/间歇泉产率

来自缺氧WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块的文档可以在模块:表格/间歇泉产率/doc创建

local p = {}
local getArgs = require([[Module:Arguments]]).getArgs
local utils = require([[Module:Utils]])
local K0 = utils.K0
local geyserData = mw.loadData([[Module:Data/Geysers]])
local getTable = require([[Module:表格]]).table

function p._main(args)
	local out = {}
    local ks = {}

    for k in pairs(geyserData) do
        ks[#ks+1] = k
    end

    table.sort(ks, function(a,b) --按形状排序,相同形状的 DLC 间歇泉放后面
    return geyserData[a].geyserType.shape ==  geyserData[b].geyserType.shape and 
            geyserData[a].geyserType.DlcID < geyserData[b].geyserType.DlcID or
            geyserData[a].geyserType.shape < geyserData[b].geyserType.shape
    end
    )
    
	for _, k in ipairs(ks) do
        local _name = utils.getEntry(k)
        local icon_name = ("[[File:%s.png|x48px|center|link=%s]][[%s]]"):format(_name, _name, _name)
    
        local geyser = geyserData[k]
        if not geyser.geyserType then break end
        local mGeyserType = geyser.geyserType
        local dlcIcon = mGeyserType.DlcID ~= "" and utils.DLC_ICONS[mGeyserType.DlcID] or ""
        icon_name = icon_name .. dlcIcon
        local range = "%s ~ %s"
    	local rateIterationOn = nil
    	local rateYearOn = nil
    	local rateYear = nil
    	local massIterationOn = nil
    	local massYearOn = nil
    	if geyser.outputRate ~= nil then
        	local mOutputRate = geyser.outputRate
        	local range = "%s ~ %s"
        	rateIterationOn = range:format(utils.float2str(mOutputRate.rateIterationOn.min, 2), utils.float2str(mOutputRate.rateIterationOn.max, 2))
        	rateYearOn = range:format(utils.float2str(mOutputRate.rateYearOn.min, 2), utils.float2str(mOutputRate.rateYearOn.max, 2))
        	rateYear = range:format(utils.float2str(mOutputRate.rateYear.min, 2), utils.float2str(mOutputRate.rateYear.max, 2))
    	end
		if geyser.outputMass ~= nil then
        	local mOutputMass = geyser.outputMass
        	massIterationOn = range:format(utils.kg2str(mOutputMass.massIterationOn.min, 2), utils.kg2str(mOutputMass.massIterationOn.max, 2))
        	massYearOn = range:format(utils.kg2str(mOutputMass.massYearOn.min, 2), utils.kg2str(mOutputMass.massYearOn.max, 2))
        end
		table.insert(out, {icon_name,rateIterationOn,rateYearOn,rateYear,massIterationOn,massYearOn})
	end
	mw.logObject(out)
    return getTable(out, args)
end

function p.main(frame)
    return p._main(getArgs(frame))
end

return p