2,509
个编辑
小 (ulk测试) |
小 (ulk测试) |
||
第45行: | 第45行: | ||
function handlers.ratingPlus(v) return v and '+' or '' end | function handlers.ratingPlus(v) return v and '+' or '' end | ||
local function stringify(cond) | local function stringify(cond) | ||
local res = templates[cond.type]:gsub('%$([a-zA-Z12_]+)', function(k) | |||
local nk = tonumber(k) | local nk = tonumber(k) | ||
if nk then return stringify(cond.conditions[nk]) end | if nk then return stringify(cond.conditions[nk]) end | ||
第51行: | 第51行: | ||
return cond[k] | return cond[k] | ||
end) | end) | ||
return res | |||
end | end | ||
第56行: | 第57行: | ||
local view = {} | local view = {} | ||
for _, chartUlk in ipairs(mad.listOf 'unlocks') do | for _, chartUlk in ipairs(mad.listOf 'unlocks') do | ||
local id, rc = chartUlk.songId, chartUlk.ratingClass | local id, rc = chartUlk.songId, chartUlk.ratingClass + 1 | ||
for _, cond in ipairs(chartUlk.conditions) do | |||
for _, cond in ipairs(chartUlk. | |||
local className | local className | ||
if cond.type == 0 then | if cond.type == 0 then | ||
第72行: | 第66行: | ||
end | end | ||
if className then | if className then | ||
local row = view[id] | |||
if not row then | |||
row = {} | |||
view[id] = row | |||
end | |||
local cell = row[rc] | |||
if not cell then | |||
cell = {} | |||
row[rc] = cell | |||
end | |||
table.insert(cell, mw.html.create 'span':addClass(className):wikitext(stringify(cond))) | table.insert(cell, mw.html.create 'span':addClass(className):wikitext(stringify(cond))) | ||
end | end |
个编辑