模块:数据:修订间差异
舰R百科,玩家自由编辑的战舰少女R百科
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第93行: | 第93行: | ||
local idx = ships[frame.args[1]].index | local idx = ships[frame.args[1]].index | ||
return byIndex[idx % 1000] | return byIndex[idx % 1000] | ||
end | |||
local curFrame = nil | |||
local function expand(template, argName1, arg1) | |||
local args = { } | |||
args[argName1] = arg1 | |||
return curFrame:expandTemplate{ title=template, args=args } | |||
--return '{{' .. template .. '|' .. argName1 .. '=' .. arg1 .. '}}' | |||
end | |||
local function genShipList(idx) | |||
local part1 = '' | |||
local part2 = '' | |||
local empty1 = true | |||
local empty2 = true | |||
local prefix = '\n|width="200px"|' | |||
for i = idx + 1, idx + 5 do | |||
part1 = part1 .. prefix | |||
if byIndex[i] ~= nil then | |||
part1 = part1 .. expand('图鉴立绘', '图鉴编号', i) | |||
empty1 = false | |||
end | |||
end | |||
if not empty1 then prefix = '\n|' end | |||
for i = idx + 6, idx + 10 do | |||
part2 = part2 .. prefix | |||
if byIndex[i] ~= nil then | |||
part2 = part2 .. expand('图鉴立绘', '图鉴编号', i) | |||
empty2 = false | |||
end | |||
end | |||
if empty1 and empty2 then | |||
return nil | |||
elseif empty1 then | |||
return '{|\n|- valign="bottom"' .. part2 .. '\n|}\n' | |||
elseif empty2 then | |||
return '{|\n|- valign="bottom"' .. part1 .. '\n|}\n' | |||
else | |||
return '{|\n|- valign="bottom"' .. part1 .. '\n|-' .. part2 .. '\n|}\n' | |||
end | |||
end | |||
p['图鉴'] = function(frame) | |||
curFrame = frame | |||
local ret = '' | |||
local buf = '' | |||
for i = 0, 400, 10 do | |||
local title = '===No.' .. (i + 1) .. '~' .. (i + 10) .. '===\n' | |||
local list = genShipList(i) | |||
if list ~= nil then | |||
ret = ret .. buf .. title .. list | |||
buf = '' | |||
else | |||
buf = buf .. title | |||
end | |||
end | |||
for i = 1000, 1400, 10 do | |||
local title = '===No.' .. (i + 1) .. '~' .. (i + 10) .. '===\n' | |||
local list = genShipList(i) | |||
if list ~= nil then | |||
ret = ret .. buf .. title .. list | |||
buf = '' | |||
else | |||
buf = buf .. title | |||
end | |||
end | |||
return ret | |||
end | end | ||
| 第211行: | 第278行: | ||
p.debug = function() | p.debug = function() | ||
f = { } | f = { } | ||
f.args = { | f.args = { } | ||
return p[' | return p['图鉴'](f) | ||
end | end | ||
return p | return p | ||