| Line 135: |
Line 135: |
| | text = 'x' .. count, | | text = 'x' .. count, |
| | } | | } |
| | + | end |
| | + | |
| | + | local function formatAmount(n, time) |
| | + | if not n or not time then |
| | + | return n or '??' |
| | + | end |
| | + | return U.round(60 * n / time) |
| | end | | end |
| | | | |
| Line 146: |
Line 153: |
| | </tabber>]=] | | </tabber>]=] |
| | | | |
| − | local function render(args, frame) | + | local function table(args, es, hourly) |
| − | local world = tonumber(args.explicit.world)
| + | return U.format{ |
| − | local es = U.ifilter(data, function(e) return e.maparea_id == world end)
| |
| − | | |
| − | local total = U.format{ | |
| | tableHeader, | | tableHeader, |
| | icon = isons[world], | | icon = isons[world], |
| Line 166: |
Line 170: |
| | name = tooltip(e.name, e.details), | | name = tooltip(e.name, e.details), |
| | time = tooltip(formatTime(e.time), 'Time required for expedition'), | | time = tooltip(formatTime(e.time), 'Time required for expedition'), |
| − | hq = tooltip(args.explicit[id .. ' hq'] or '??', 'Admiral experience gained upon completion from this expedition'), | + | hq = tooltip(formatAmount(args.explicit[id .. ' hq'], hourly and e.time), 'Admiral experience gained upon completion from this expedition'), |
| − | ship = tooltip(args.explicit[id .. ' ship'] or '??', 'Ship experience gained upon completion from this expedition'), | + | ship = tooltip(formatAmount(args.explicit[id .. ' ship'], hourly and e.time), 'Ship experience gained upon completion from this expedition'), |
| − | fuel = e.win_mat_level[1] == 0 and '' or tooltip(args.explicit[id .. ' fuel'] or '??', 'Base resources gain from expedition (at 100% ratio)'), | + | fuel = e.win_mat_level[1] == 0 and '' or tooltip(formatAmount(args.explicit[id .. ' fuel'], hourly and e.time), 'Base resources gain from expedition (at 100% ratio)'), |
| − | ammo = e.win_mat_level[2] == 0 and '' or tooltip(args.explicit[id .. ' ammo'] or '??', 'Base resources gain from expedition (at 100% ratio)'), | + | ammo = e.win_mat_level[2] == 0 and '' or tooltip(formatAmount(args.explicit[id .. ' ammo'], hourly and e.time), 'Base resources gain from expedition (at 100% ratio)'), |
| − | steel = e.win_mat_level[3] == 0 and '' or tooltip(args.explicit[id .. ' steel'] or '??', 'Base resources gain from expedition (at 100% ratio)'), | + | steel = e.win_mat_level[3] == 0 and '' or tooltip(formatAmount(args.explicit[id .. ' steel'], hourly and e.time), 'Base resources gain from expedition (at 100% ratio)'), |
| − | bauxite = e.win_mat_level[4] == 0 and '' or tooltip(args.explicit[id .. ' bauxite'] or '??', 'Base resources gain from expedition (at 100% ratio)'), | + | bauxite = e.win_mat_level[4] == 0 and '' or tooltip(formatAmount(args.explicit[id .. ' bauxite'], hourly and e.time), 'Base resources gain from expedition (at 100% ratio)'), |
| | item1 = e.win_item1[1] > 0 and formatItem(e.win_item1[1], e.win_item1[2]) or '', | | item1 = e.win_item1[1] > 0 and formatItem(e.win_item1[1], e.win_item1[2]) or '', |
| | 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)) .. "\n|}" | | end)) .. "\n|}" |
| | + | end |
| | | | |
| − | return not frame and total or frame:preprocess(U.format{ | + | local function render(args, frame) |
| | + | local world = tonumber(args.explicit.world) |
| | + | local es = U.ifilter(data, function(e) return e.maparea_id == world end) |
| | + | return frame:preprocess(U.format{ |
| | tabberTemplate, | | tabberTemplate, |
| − | total = total, | + | total = table(args, es), |
| − | hourly = '', | + | hourly = table(args, es, true), |
| | requirements = '', | | requirements = '', |
| | }) | | }) |