Line 80: |
Line 80: |
| !style="cellpadding:10px;width:20%;" colspan="2" |Rewards | | !style="cellpadding:10px;width:20%;" colspan="2" |Rewards |
| |- | | |- |
− | |style="background:gray;" colspan="14"|]=] | + | |style="background:gray;" colspan="14"| |
| + | ]=] |
| | | |
| local function pad(n) | | local function pad(n) |
Line 136: |
Line 137: |
| end | | end |
| | | |
− | local function render(frame) | + | local tabberTemplate = [=[<tabber> |
− | local args = U.getTemplateArgs(frame)
| + | |-|Total yield= |
| + | ${total} |
| + | |-|Hourly yield= |
| + | ${hourly} |
| + | |-|Requirements= |
| + | ${requirements} |
| + | </tabber>]=] |
| | | |
| + | local function render(args, frame) |
| local world = tonumber(args.explicit.world) | | local world = tonumber(args.explicit.world) |
| local es = U.ifilter(data, function(e) return e.maparea_id == world end) | | local es = U.ifilter(data, function(e) return e.maparea_id == world end) |
| | | |
− | local result = { "<tabber>" } | + | local total = table.insert(result, U.format{ |
− | | |
− | table.insert(result, "|-|Total yield=")
| |
− | | |
− | table.insert(result, U.format{
| |
| tableHeader, | | tableHeader, |
| icon = isons[world], | | icon = isons[world], |
| background = headerBackgrounds[world], | | background = headerBackgrounds[world], |
| name = worldNames[world], | | name = worldNames[world], |
− | }) | + | }) .. U.joinLines(U.imap(es, function(e, i) |
− | | |
− | table.insert(result, U.joinLines(U.imap(es, function(e, i)
| |
| local id = e.disp_no | | local id = e.disp_no |
| return U.format{ | | return U.format{ |
Line 173: |
Line 175: |
| item2 = e.win_item2[1] > 0 and formatItem(e.win_item2[1], e.win_item2[2]) or '', | | item2 = e.win_item2[1] > 0 and formatItem(e.win_item2[1], e.win_item2[2]) or '', |
| } | | } |
− | end))) | + | end)) .. "\n|}" |
| | | |
− | table.insert(result, "|}") | + | return not frame and total or frame:preprocess(U.format{ |
− | | + | tabberTemplate, |
− | table.insert(result, "</tabber>")
| + | total = total, |
− | | + | hourly = '', |
− | return frame:preprocess(table.concat(result, "\n")) | + | requirements = '', |
| + | }) |
| end | | end |
| | | |
− | return {
| + | local test = { explicit = { world = '7' } } |
− | render = render,
| |
− | }
| |
− | | |
− | -- local test = { explicit = { world = '7' } }
| |
| -- print(p.test()) | | -- print(p.test()) |
| | | |
− | -- return view(render, test)
| + | return view(render, test) |