Changes

m
no edit summary
Line 134: Line 134:  
   local maxHp = ship["hp"][2]
 
   local maxHp = ship["hp"][2]
 
   local HPinfo
 
   local HPinfo
   if maxHp then
+
   if maxHp and maxHp ~= '??' then
 
     local marriedHp = getMarriedHp(hp, maxHp)
 
     local marriedHp = getMarriedHp(hp, maxHp)
 
     local maxModHp = math.min(hp + 2, maxHp)
 
     local maxModHp = math.min(hp + 2, maxHp)
Line 306: Line 306:  
       string.format(
 
       string.format(
 
         "%s (%s)",
 
         "%s (%s)",
         formatBuildtime(ship.buildtime[1]),
+
         type(ship.buildtime[1]) == "number" and formatBuildtime(ship.buildtime[1]) or "??",
 
         ship.buildtime[2] and ship.buildtime[3] and "Normal, LSC" or ship.buildtime[2] and "Normal" or
 
         ship.buildtime[2] and ship.buildtime[3] and "Normal, LSC" or ship.buildtime[2] and "Normal" or
           ship.buildtime[3] and "LSC" or
+
           ship.buildtime[3] and "LSC" or "Unbuildable"
          "Unbuildable"
   
       )
 
       )
 
   end
 
   end
Line 461: Line 460:     
local function renderCategories(ship)
 
local function renderCategories(ship)
   local categories = "[[Category:Ships]][[Category:" .. ship["class"] .. "]][[Category:" .. ship["type"] .. "s]]"
+
   local categories = "[[Category:Ships]]"
 +
  if notNil(ship["class"]) then
 +
  categories = categories .. "[[Category:" .. ship["class"] .. "]]"
 +
  end
 +
  if notNil(ship["type"]) then
 +
  categories = categories .. "[[Category:" .. ship["type"] .. "s]]"
 +
  end
 
   if ship["artist"] ~= "Unknown" and ship["artist"] ~= "" then
 
   if ship["artist"] ~= "Unknown" and ship["artist"] ~= "" then
 
     categories = categories .. "[[Category:" .. ship["artist"] .. "]]"
 
     categories = categories .. "[[Category:" .. ship["artist"] .. "]]"
Line 610: Line 615:  
   local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[key] or key, "name") or {}).id] or key)
 
   local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[key] or key, "name") or {}).id] or key)
 
   local data = {}
 
   local data = {}
   data.id = ship:id() or '???'
+
   data.id = ship:id() or "??"
 
   data.no = ship:true_id()
 
   data.no = ship:true_id()
 
   data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""}
 
   data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""}
 
   local class = ship:class()
 
   local class = ship:class()
   data.class = class and class:name() or "???"
+
   data.class = class and class:name() or "??"
 
   data.display_class = ship._display_class
 
   data.display_class = ship._display_class
 
   data.type = ship:formatted_type() or ""
 
   data.type = ship:formatted_type() or ""
7,212

edits