| Line 3: |
Line 3: |
| | local Ship = require('Module:Ship') | | local Ship = require('Module:Ship') |
| | local Formatting = require('Module:Formatting') | | local Formatting = require('Module:Formatting') |
| − | local format = require('Module:StringInterpolation').format | + | local format = require('Module:Core').format |
| | | | |
| | local NanaminShipInfo = { | | local NanaminShipInfo = { |
| Line 31: |
Line 31: |
| | local entry = {} | | local entry = {} |
| | for _, item in ipairs(args) do | | for _, item in ipairs(args) do |
| − | if item == "-" then | + | if item == "-" and #entry > 2 then |
| | local ship = Ship(entry[1], entry[2]) | | local ship = Ship(entry[1], entry[2]) |
| | local types = { | | local types = { |
| Line 61: |
Line 61: |
| | while mw.ustring.find(item, '/') do | | while mw.ustring.find(item, '/') do |
| | local split = mw.ustring.find(item, '/') | | local split = mw.ustring.find(item, '/') |
| − | table.insert(entry, mw.ustring.sub(item, 1, split - 1)) | + | local new_entry = mw.ustring.sub(item, 1, split - 1) |
| | + | if new_entry == "-" then new_entry = "" end |
| | + | table.insert(entry, new_entry) |
| | item = mw.ustring.sub(item, split + 1) | | item = mw.ustring.sub(item, split + 1) |
| | end | | end |
| | + | if item == "-" then item = "" end |
| | table.insert(entry, item) | | table.insert(entry, item) |
| | end | | end |
| Line 70: |
Line 73: |
| | | | |
| | function NanaminShipInfo:embed_table(entry) | | function NanaminShipInfo:embed_table(entry) |
| − | if entry[3] == "" then | + | if entry[3] == "" then entry[3] = "N/A" end |
| − | entry[3] = "N/A"
| + | local name = entry[1]:nick() and entry[1]:nick() or entry[1]:name() |
| − | end
| |
| | table.insert(self._rows, self._embedded_start) | | table.insert(self._rows, self._embedded_start) |
| | table.insert(self._rows, format{self._embedded_table, | | table.insert(self._rows, format{self._embedded_table, |
| − | name = entry[1]:name():gsub(" ", ""), | + | name = name:gsub(" ", ""), |
| | class = entry[1]:class():name(), | | class = entry[1]:class():name(), |
| | extra_levels = entry[3] or "N/A", | | extra_levels = entry[3] or "N/A", |
| Line 106: |
Line 108: |
| | count = count + 1 | | count = count + 1 |
| | | | |
| | + | local name = entries[a][1]:nick() and entries[a][1]:nick() or entries[a][1]:name() |
| | + | local image = string.gsub(entries[a][1]:battle_card(), "FastBB", "BC") |
| | table.insert(self._rows, format{self._ship_card_template, | | table.insert(self._rows, format{self._ship_card_template, |
| − | class = entries[a][1]:name():gsub(" ", ""), | + | class = name:gsub(" ", ""), |
| − | ship_card = Formatting:format_image{entries[a][1]:battle_card(), align = "left", valign = "center"}, | + | ship_card = Formatting:format_image{image, align = "left", valign = "center"}, |
| | }) | | }) |
| | table.insert(self._rows, format{self._level_template, | | table.insert(self._rows, format{self._level_template, |
| Line 149: |
Line 153: |
| | self:build_table("Heavy Cruiser") | | self:build_table("Heavy Cruiser") |
| | self:build_table("Light Cruiser") | | self:build_table("Light Cruiser") |
| | + | self:build_table("Destroyer") |
| | self:build_table("Submarine") | | self:build_table("Submarine") |
| | + | self:build_table("Other") |
| | return table.concat(self._rows, "\n") | | return table.concat(self._rows, "\n") |
| | end | | end |