| Line 37: |
Line 37: |
| | node_diff_tooltip = '^%s*(%a)%s*/%s*(%S-)%s*{(.-)}%s*$', | | node_diff_tooltip = '^%s*(%a)%s*/%s*(%S-)%s*{(.-)}%s*$', |
| | -- TODO: | | -- TODO: |
| | + | -- * just_node_tooltip |
| | -- * Add battle ranks: | | -- * Add battle ranks: |
| | -- node_diff_rank = '^%s*(%a)%s*/%s*(%S-)%s*/%s*(%a)%s*$', | | -- node_diff_rank = '^%s*(%a)%s*/%s*(%S-)%s*/%s*(%a)%s*$', |
| Line 45: |
Line 46: |
| | | | |
| | local diff_colors = { | | local diff_colors = { |
| − | ['Easy'] = 'C8E6C9', | + | ['Easy'] = 'C8E6C9', |
| − | ['Medium'] = 'FFE0B2', | + | ['Medium'] = 'FFE0B2', |
| − | ['Hard'] = 'FFCDD2', | + | ['Hard'] = 'FFCDD2', |
| − | ['?'] = 'BBDEFB' | + | ['?'] = 'BBDEFB', |
| | + | ['Regular'] = '', -- (default color) |
| | } | | } |
| | | | |
| − | local rarity_color = { | + | local diff_names = { |
| | + | ['Easy'] = 'Easy+', |
| | + | ['Medium'] = 'Medium+', |
| | + | ['Hard'] = 'Hard+', |
| | + | ['?'] = '?', |
| | + | ['Regular'] = '✓', |
| | + | } |
| | + | |
| | + | local rarity_colors = { |
| | [true] = { | | [true] = { |
| − | [false] = 'BBDEFB', | + | [false] = '', -- ignored, non-rare (default color) |
| − | [true] = 'BBDEFB', | + | [true] = '', -- ignored, rare (default color) |
| | }, | | }, |
| | [false] = { | | [false] = { |
| − | [false] = 'C8E6C9', | + | [false] = 'green', -- non-ignored, non-rare |
| − | [true] = 'FFCDD2', | + | [true] = 'red', -- non-ignored, rare |
| | }, | | }, |
| − | }
| |
| − |
| |
| − | local diff_names = {
| |
| − | ['Easy'] = 'Easy+',
| |
| − | ['Medium'] = 'Medium+',
| |
| − | ['Hard'] = 'Hard+',
| |
| − | ['?'] = '?',
| |
| − | ['✓'] = '✓',
| |
| | } | | } |
| | | | |
| Line 79: |
Line 81: |
| | tbl.debug = tbl.debug .. string.format('%s: %s\n', message, value) | | tbl.debug = tbl.debug .. string.format('%s: %s\n', message, value) |
| | end | | end |
| | + | |
| | + | local regular = args.regular |
| | | | |
| | if not args.nodes then | | if not args.nodes then |
| Line 133: |
Line 137: |
| | if find(tbl.rows, ship, 'ship') then | | if find(tbl.rows, ship, 'ship') then |
| | log('ship duplicate', ship) | | log('ship duplicate', ship) |
| − | elseif not args.regular and ignored then | + | elseif not regular and ignored then |
| | log('ship ignored', ship) | | log('ship ignored', ship) |
| | else | | else |
| | table.insert(tbl.rows, { | | table.insert(tbl.rows, { |
| | ship = ship, | | ship = ship, |
| − | rare = not args.regular and rare, | + | rare = rare, |
| − | regular = args.regular, | + | regular = regular, |
| | + | ship_color = rarity_colors[ignored][rare], |
| | type = Formatting:format_ship_code(ship_table._type) or '?', | | type = Formatting:format_ship_code(ship_table._type) or '?', |
| − | nodes = {} | + | nodes = {}, |
| | }) | | }) |
| | local row = tbl.rows[#tbl.rows] | | local row = tbl.rows[#tbl.rows] |
| Line 155: |
Line 160: |
| | node = node_arg:match(args_grammar.just_node) | | node = node_arg:match(args_grammar.just_node) |
| | end | | end |
| − | diff = args.regular and '✓' or diff_names[diff] and diff or '?' | + | diff = regular and 'Regular' or diff_names[diff] and diff or '?' |
| | if node and diff then | | if node and diff then |
| | local node = string.upper(node) | | local node = string.upper(node) |
| Line 164: |
Line 169: |
| | else | | else |
| | row.nodes[node] = { | | row.nodes[node] = { |
| − | color = args.regular and rarity_color[ignored][rare] or diff_colors[diff], | + | color = diff_colors[diff], |
| | diff = diff_names[diff], | | diff = diff_names[diff], |
| | tooltip = tooltip, | | tooltip = tooltip, |
| Line 195: |
Line 200: |
| | type_cell = '|${type}\n', | | type_cell = '|${type}\n', |
| | -- TODO: japanese tooltips | | -- TODO: japanese tooltips |
| − | ship_cell = '|[[${ship}]]\n', | + | ship_cell = '|[[${ship}|<span style="color:${color};">${ship}</span>]]\n', |
| − | rare_ship_cell = '|[[${ship}|<span style="color:red;">${ship}</span>]]\n',
| |
| | node_cell = '|style="background-color:#${color};"|${diff}\n', | | node_cell = '|style="background-color:#${color};"|${diff}\n', |
| | empty_cell = '|\n', | | empty_cell = '|\n', |
| Line 218: |
Line 222: |
| | add(row.rare and table_format.rare_row or table_format.row) | | add(row.rare and table_format.rare_row or table_format.row) |
| | add(format{table_format.type_cell, type = row.type}) | | add(format{table_format.type_cell, type = row.type}) |
| − | add(format{ | + | add(format{ship_cell, color = row.ship_color, ship = row.ship}) |
| − | row.regular and table_format.ship_cell or row.rare and table_format.rare_ship_cell or table_format.ship_cell,
| |
| − | ship = row.ship
| |
| − | })
| |
| | for _, node in pairs(tbl.nodes) do | | for _, node in pairs(tbl.nodes) do |
| | local node = row.nodes[node.name] | | local node = row.nodes[node.name] |