| Line 173: |
Line 173: |
| | ${requirements} | | ${requirements} |
| | </tabber>]=] | | </tabber>]=] |
| | + | |
| | + | local function formatRow(args, e, i, hourly, req) |
| | + | local id = e.disp_no |
| | + | return U.format{ |
| | + | (req and template2 or template), |
| | + | style = string.format( |
| | + | 'text-align: center; height: 35px; background: #%s; color:#000', |
| | + | i % 2 == 0 and '' or backgrounds[e.maparea_id] or backgrounds[0] |
| | + | ), |
| | + | id = tooltip(id, 'ID number as displayed in game'), |
| | + | name = e.damage_type == 1 and string.format('<span style="color:red">%s</span>', tooltip(e.name, e.details)) or tooltip(e.name, e.details), |
| | + | time = tooltip(formatTime(e.time), 'Time required for expedition'), |
| | + | hq = tooltip(formatAmount(args.explicit[id .. ' hq'], hourly and e.time), 'Admiral 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(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(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(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(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 '', |
| | + | item2 = e.win_item2[1] > 0 and formatItem(e.win_item2[1], e.win_item2[2]) or '', |
| | + | sum = args.explicit[id .. ' sum'] or '??', |
| | + | level = args.explicit[id .. ' level'] or '??', |
| | + | fleet = args.explicit[id .. ' fleet'] or '??', |
| | + | drums = args.explicit[id .. ' drums'] or '??', |
| | + | fuel_cost = e.use_fuel > 0 and '-' .. 10 * e.use_fuel or '', |
| | + | ammo_cost = e.use_bull > 0 and '-' .. 10 * e.use_bull or '', |
| | + | } |
| | + | end |
| | | | |
| | local function formatTable(args, es, hourly, req) | | local function formatTable(args, es, hourly, req) |
| Line 182: |
Line 210: |
| | name = worldNames[world], | | name = worldNames[world], |
| | } .. (req and tableHeader2Req or tableHeader2) .. U.joinLines(U.imap(es, function(e, i) | | } .. (req and tableHeader2Req or tableHeader2) .. U.joinLines(U.imap(es, function(e, i) |
| − | local id = e.disp_no
| + | return formatRow(args, e, i, hourly, req) |
| − | return U.format{ | |
| − | (req and template2 or template),
| |
| − | style = string.format(
| |
| − | 'text-align: center; height: 35px; background: #%s; color:#000',
| |
| − | i % 2 == 0 and '' or backgrounds[e.maparea_id] or backgrounds[0]
| |
| − | ),
| |
| − | id = tooltip(id, 'ID number as displayed in game'),
| |
| − | name = e.damage_type == 1 and string.format('<span style="color:red">%s</span>', tooltip(e.name, e.details)) or tooltip(e.name, e.details),
| |
| − | time = tooltip(formatTime(e.time), 'Time required for expedition'),
| |
| − | hq = tooltip(formatAmount(args.explicit[id .. ' hq'], hourly and e.time), 'Admiral 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(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(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(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(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 '',
| |
| − | item2 = e.win_item2[1] > 0 and formatItem(e.win_item2[1], e.win_item2[2]) or '',
| |
| − | sum = args.explicit[id .. ' sum'] or '??',
| |
| − | level = args.explicit[id .. ' level'] or '??',
| |
| − | fleet = args.explicit[id .. ' fleet'] or '??',
| |
| − | drums = args.explicit[id .. ' drums'] or '??',
| |
| − | fuel_cost = e.use_fuel > 0 and '-' .. 10 * e.use_fuel or '',
| |
| − | ammo_cost = e.use_bull > 0 and '-' .. 10 * e.use_bull or '',
| |
| − | }
| |
| | end)) .. "\n|}" | | end)) .. "\n|}" |
| | end | | end |
| | | | |
| | local function render(args, frame) | | local function render(args, frame) |
| | + | local id = args.explicit.id |
| | + | if id then |
| | + | local e = U.ifind(data, function(e) return e.disp_no == id end) |
| | + | return formatRow(args, e, args.explicit.odd and 1 or 0, args.explicit.hourly, args.explicit.requirements) |
| | + | end |
| | 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) |