◆少前百科是非盈利性、非官方的少女前线维基百科。 ◆如果您发现某些内容错误/空缺,请勇于修正/添加!参与进来其实很容易!点这里 加入少前百科。 ◆有任何意见、建议、纠错,欢迎在 GFwiki:反馈与建议 提出和讨论。编辑事务讨论QQ群:597764980,微博@GFwiki少前百科 ◆To foreigners,You can use twitter to contact us. |
模块:Gun info/time
此模块的文档可以在模块:Gun info/time/doc创建
local p = {} local data = {} local timeList = {} local function formatTime(seconds) local minutes = math.floor(seconds/60) local hour = math.floor(minutes/60) minutes = minutes - hour*60 return string.format('%02d:%02d:00', hour, minutes) end local function sortById(a, b) return a.id < b.id end local function list() local root = mw.html.create('table'):addClass('wikitable sortable filterable') local thead = root:tag('tr') thead:tag('th'):addClass('filterable-head'):wikitext('建造时间') thead:tag('th'):wikitext('战术人形') thead:tag('th'):wikitext('备注') for _, seconds in ipairs(timeList) do local tr = root:tag('tr') tr:tag('td'):wikitext(formatTime(seconds)) table.sort(data[seconds], sortById) local links = {} local heavyOnly = {} for _, row in ipairs(data[seconds]) do table.insert(links, '[[' .. row.name .. ']]') if row.obtain[1] == 2 then table.insert(heavyOnly, row.name) end end tr:tag('td'):wikitext(table.concat(links, '/')) local comment = tr:tag('td') if #heavyOnly == #data[seconds] then comment:wikitext('重型制造限定') elseif #heavyOnly > 0 then comment:wikitext(table.concat(heavyOnly, '、') .. '重型制造限定') end end return tostring(root) end local function filterManufacturable() for i = 0, 4 do local dataN = mw.loadData('Module:Gun info/data ' .. tostring(i)) for id, row in pairs(dataN) do if row.obtain[1] == 1 or row.obtain[1] == 2 then if data[row.produce_time] == nil then data[row.produce_time] = {} table.insert(timeList, row.produce_time) end table.insert(data[row.produce_time], row) end end end end function p.list() filterManufacturable() table.sort(timeList) return list() end return p