| Line 12: |
Line 12: |
| | 'Z1', 'Z3', 'Tanikaze', 'Maikaze', | | 'Z1', 'Z3', 'Tanikaze', 'Maikaze', |
| | 'Libeccio', 'Mizuho', 'Kazagumo', 'Umikaze', 'Kawakaze', 'Hayasui', 'Teruzuki', 'Graf Zeppelin', 'Arashi', 'Kashima', 'Hagikaze', | | 'Libeccio', 'Mizuho', 'Kazagumo', 'Umikaze', 'Kawakaze', 'Hayasui', 'Teruzuki', 'Graf Zeppelin', 'Arashi', 'Kashima', 'Hagikaze', |
| | + | } |
| | + | |
| | + | local ignored_ships = { |
| | + | 'Fubuki', |
| | } | | } |
| | | | |
| Line 19: |
Line 23: |
| | ship_and_nodes = '^%s*(.-)%s*:%s*(.-)%s*$', | | ship_and_nodes = '^%s*(.-)%s*:%s*(.-)%s*$', |
| | just_node = '^%s*(%a)%s*$', | | just_node = '^%s*(%a)%s*$', |
| − | node_and_diff = '^%s*(%a)%s*/%s*(%S-)%s*$' | + | node_and_diff = '^%s*(%a)%s*/%s*(%S-)%s*$', |
| | + | -- TODO: |
| | + | -- node_diff_rank = '^%s*(%a)%s*/%s*(%S-)%s*/%s*(%a)%s*$', |
| | } | | } |
| | | | |
| Line 81: |
Line 87: |
| | if find(tbl.rows, ship, 'ship') then | | if find(tbl.rows, ship, 'ship') then |
| | log('ship duplicate', ship) | | log('ship duplicate', ship) |
| | + | elseif find(ignored_ships, ship) then |
| | + | log('ship ignored', ship) |
| | else | | else |
| | table.insert(tbl.rows, { | | table.insert(tbl.rows, { |
| Line 130: |
Line 138: |
| | local table_format = { | | local table_format = { |
| | header = '{| class="article-table sortable" align="center" width="100%" style="text-align:center"\n!Type\n!Ship\n', | | header = '{| class="article-table sortable" align="center" width="100%" style="text-align:center"\n!Type\n!Ship\n', |
| − | header_node = '!width="10%%"|${node}\n', | + | header_node = '!width="10%"|${node}\n', |
| − | header_boss_node = '!width="10%%" style="background-color:pink;color:red;"|\'\'\'${node}\'\'\'\n', | + | header_boss_node = '!width="10%" style="background-color:pink;color:red;"|\'\'\'${node}\'\'\'\n', |
| − | row = '|-\n', | + | row = '|- class="drop-list-non-rare-ship"\n', |
| | + | rare_row = '|-\n', |
| | type_cell = '|${type}\n', | | type_cell = '|${type}\n', |
| − | ship_cell = '|class="drop-list-non-rare-ship"|[[${ship}]]\n', | + | ship_cell = '|[[${ship}]]\n', |
| | rare_ship_cell = '|[[${ship}|<span style="color:red;">${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', |
| Line 149: |
Line 158: |
| | | | |
| | local res = table_format.header | | local res = table_format.header |
| | + | |
| | + | function add(str) |
| | + | res = res .. str |
| | + | end |
| | + | |
| | + | function add_row(row) |
| | + | add(row.rare and table_format.rare_row or table_format.row) |
| | + | add(format{table_format.type_cell, type = row.type}) |
| | + | add(format{ |
| | + | row.rare and table_format.rare_ship_cell or table_format.ship_cell, |
| | + | ship = row.ship |
| | + | }) |
| | + | for _, node in pairs(tbl.nodes) do |
| | + | local node = row.nodes[node.name] |
| | + | add(node and format{ |
| | + | table_format.node_cell, color = node.color, diff = node.diff |
| | + | } or table_format.empty_cell) |
| | + | end |
| | + | end |
| | | | |
| | -- header | | -- header |
| | for _, node in pairs(tbl.nodes) do | | for _, node in pairs(tbl.nodes) do |
| − | res = res .. format{ | + | add(format{ |
| | node.boss and table_format.header_boss_node or table_format.header_node, | | node.boss and table_format.header_boss_node or table_format.header_node, |
| | node = node.name | | node = node.name |
| − | } | + | }) |
| | end | | end |
| | | | |
| | -- rows | | -- rows |
| − | for key, row in pairs(tbl.rows) do | + | for _, row in pairs(tbl.rows) do |
| | + | -- TODO: Sort by type/name |
| | if row.rare then | | if row.rare then |
| − | res = res .. table_format.row | + | add_row(row) |
| − | res = res .. format{table_format.type_cell, type = row.type}
| |
| − | res = res .. format{
| |
| − | table_format.rare_ship_cell,
| |
| − | ship = row.ship
| |
| − | }
| |
| − | for _, node in pairs(tbl.nodes) do
| |
| − | local node = row.nodes[node.name]
| |
| − | res = res .. (node and format{
| |
| − | table_format.node_cell,
| |
| − | color = node.color,
| |
| − | diff = node.diff
| |
| − | } or table_format.empty_cell)
| |
| − | end
| |
| | end | | end |
| | end | | end |
| | for key, row in pairs(tbl.rows) do | | for key, row in pairs(tbl.rows) do |
| | + | -- TODO: Sort by type/name |
| | if not row.rare then | | if not row.rare then |
| − | res = res .. table_format.row | + | add_row(row) |
| − | res = res .. format{table_format.type_cell, type = row.type}
| |
| − | res = res .. format{
| |
| − | table_format.ship_cell,
| |
| − | ship = row.ship
| |
| − | }
| |
| − | for _, node in pairs(tbl.nodes) do
| |
| − | local node = row.nodes[node.name]
| |
| − | res = res .. (node and format{
| |
| − | table_format.node_cell,
| |
| − | color = node.color,
| |
| − | diff = node.diff
| |
| − | } or table_format.empty_cell)
| |
| − | end
| |
| | end | | end |
| | end | | end |
| | | | |
| − | res = res .. table_format.footer | + | add(table_format.footer) |
| | | | |
| | if tbl.debug ~= '' then | | if tbl.debug ~= '' then |
| − | res = res .. format{table_format.debugger, debug = tbl.debug} | + | add(format{table_format.debugger, debug = tbl.debug}) |
| | end | | end |
| | | | |
| Line 212: |
Line 216: |
| | return showTable(parseArgs(args)) | | return showTable(parseArgs(args)) |
| | end | | end |
| | + | |
| | + | DropList.test = showTable(parseArgs({ |
| | + | 'Nagato: A/Hard, Z/Easy', |
| | + | 'Fubuki: A/Easy', |
| | + | 'Roma: Z/Hard', |
| | + | boss = 'Z', |
| | + | nodes = 'A, B, C, Z', |
| | + | })) |
| | | | |
| | return DropList | | return DropList |