Line 6: |
Line 6: |
| | | |
| local DropList = {} | | local DropList = {} |
| + | |
| + | -- http://kancolle.wikia.com/wiki/Thread:295964 |
| + | local rare_ships = { |
| + | |
| + | "Akitsushima", "Akizuki", "Amagi", "Isokaze", "Katsuragi", "Littorio", "Prinz Eugen", "Roma", "Tokitsukaze", |
| + | |
| + | "Akitsu Maru", "Bismarck", "Musashi", "Noshiro", "Yamato", "Taihou", |
| + | |
| + | "Agano", "Akashi", "Amatsukaze", "Asagumo", "Asashimo", "Harusame", "Hatsukaze", "Hayashimo", "I-401", "Katori", "Kiyoshimo", "Maruyu", |
| + | "Mikuma", "Nowaki", "Ooyodo", "Sakawa", "Taigei", "Takanami", "U-511", "Unryuu", "Uzuki", "Yahagi", |
| + | |
| + | "Z1", "Z3", "Tanikaze", "Maikaze", |
| + | |
| + | "Libeccio", "Mizuho", "Kazagumo", "Umikaze", "Kawakaze", "Hayasui", "Teruzuki", |
| + | |
| + | } |
| | | |
| local args_grammar = { | | local args_grammar = { |
Line 45: |
Line 61: |
| local ship_table = Ship:get_table(ship, "") | | local ship_table = Ship:get_table(ship, "") |
| if ship_table and ship_table._type then | | if ship_table and ship_table._type then |
− | table.insert(tbl.rows, {})
| + | table.insert(tbl.rows, {}) |
− | local row = tbl.rows[#tbl.rows]
| + | local row = tbl.rows[#tbl.rows] |
− | -- row.id = arg_name
| + | -- row.id = arg_name |
− | row.ship = ship
| + | row.ship = ship |
− | row.type = Formatting:format_ship_code(ship_table._type) or '?'
| + | row.rare = false |
− | row.nodes = {}
| + | for _, rare_ship in pairs(rare_ships) do |
− | for _, node in pairs(tbl.nodes) do
| + | if ship == rare_ship then |
− | row.nodes[node.name] = nil
| + | row.rare = true |
− | end
| + | end |
− | for node_and_diff in string.gmatch(nodes, args_grammar.comma_list) do
| + | end |
− | local node, diff = node_and_diff:match(args_grammar.node_and_diff)
| + | row.type = Formatting:format_ship_code(ship_table._type) or '?' |
− | if not node or not diff then
| + | row.nodes = {} |
− | node = node_and_diff:match(args_grammar.just_node)
| + | for _, node in pairs(tbl.nodes) do |
− | diff = nil
| + | row.nodes[node.name] = nil |
− | end
| + | end |
− | if node then
| + | for node_and_diff in string.gmatch(nodes, args_grammar.comma_list) do |
− | row.nodes[node] = { color = diff and diff_colors[diff] or diff_colors['?'], diff = diff and diff_names[diff] or '?' }
| + | local node, diff = node_and_diff:match(args_grammar.node_and_diff) |
− | end
| + | if not node or not diff then |
− | end
| + | node = node_and_diff:match(args_grammar.just_node) |
− | end
| + | diff = nil |
| + | end |
| + | if node then |
| + | row.nodes[node] = { color = diff and diff_colors[diff] or diff_colors['?'], diff = diff and diff_names[diff] or '?' } |
| + | end |
| + | end |
| + | end |
| end | | end |
| end | | end |
Line 79: |
Line 101: |
| cell = '|%s\n', | | cell = '|%s\n', |
| ship_cell = '|[[%s]]\n', | | ship_cell = '|[[%s]]\n', |
| + | rare_ship_cell = '|style="background-color:#pink;"|[[%s]]\n', |
| node_cell = '|style="background-color:#%s;"|%s\n', | | node_cell = '|style="background-color:#%s;"|%s\n', |
| empty_cell = '|\n', | | empty_cell = '|\n', |
Line 98: |
Line 121: |
| -- res = res .. string.format(table_format.cell, row.id) | | -- res = res .. string.format(table_format.cell, row.id) |
| res = res .. string.format(table_format.cell, row.type) | | res = res .. string.format(table_format.cell, row.type) |
− | res = res .. string.format(table_format.ship_cell, row.ship) | + | res = res .. string.format(row.rare and table_format.rare_ship_cell or table_format.ship_cell, 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] |
Line 112: |
Line 135: |
| | | |
| function DropList.show(frame) | | function DropList.show(frame) |
− | local args = getArgs{frame = frame:getParent()} | + | local args = frame.args -- getArgs{frame = frame:getParent()} |
| return showTable(parseArgs(args)) | | return showTable(parseArgs(args)) |
| end | | end |
| | | |
| return DropList | | return DropList |