模块:舰娘:修订间差异
舰R百科,玩家自由编辑的战舰少女R百科
更多操作
无编辑摘要 |
无编辑摘要 |
||
| 第28行: | 第28行: | ||
p['统计'] = function(frame) | p['统计'] = function(frame) | ||
local normal = 0 | local normal = 0; local mod = 0; local skin = 0 | ||
local total = 0 | |||
local | |||
for index, name in pairs(byIndex) do | for index, name in pairs(byIndex) do | ||
if type(index) == 'string' | if type(index) == 'string' then | ||
skin = skin + 1 | |||
local gold = ships[name] and ships[name].gold | |||
if | if gold then | ||
local num = tonumber(gold) | |||
if num and num > 0 then total = total + num end | |||
end | end | ||
end | elseif index < 1000 then normal = normal + 1 | ||
elseif index < 2000 then mod = mod + 1 end | |||
end | end | ||
local arg = frame.args[1] | |||
if | if arg == '普通' then return normal end | ||
if | if arg == '改造' then return mod end | ||
if arg == '换装' then return skin end | |||
if arg == '换装总价' then return total end | |||
end | end | ||
| 第147行: | 第149行: | ||
local idx = ships[frame.args[1]].index | local idx = ships[frame.args[1]].index | ||
return byIndex[idx % 1000] | return byIndex[idx % 1000] | ||
end | |||
p['格式化价格'] = function(frame) | |||
local raw = frame.args[1] or '' | |||
if raw == '' or raw == '0' then return '-' end | |||
if tonumber(raw) then return raw .. '钻石' end | |||
return raw | |||
end | end | ||
return p | return p | ||