• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Module:KanmusuModule"

From Kancolle Wiki
Jump to navigation Jump to search
m
 
(173 intermediate revisions by 10 users not shown)
Line 1: Line 1:
local shipmodule = {}
+
local U = require("Module:Core")
local shipdb = require("Module:ShipDatabase")
 
shipmodule.data = shipdb.KanmusuData
 
  
function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template
+
-- Some formatting
    local shipNum = frame.args[1]
 
    local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
 
  
    local CardImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'Card.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Card]]</div>'
+
local function formatBuildtime(minutes)
    local CardDmgImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'CardDmg.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Damaged Card]]</div>'
+
  return U.format {"${hours}:${minutes:2}", hours = math.floor(minutes / 60), minutes = minutes % 60}
    local BannerImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'Banner.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Banner|class=imageCenter]]</div>'
+
end
    local BannerDmgImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'BannerDmg.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Damaged Banner|class=imageCenter]]</div>'
 
  
    local Cards = '<td rowspan="10" style="text-align: center;">' .. frame:extensionTag('slideshow', CardImg .. CardDmgImg, {sequence = 'forward', transition = 'fade', refresh = '10000'}) .. '</td>'
+
local function formatTooltip(content, title)
    local Banners = '<td colspan="3" style="text-align: center;">' .. frame:extensionTag('slideshow', BannerImg .. BannerDmgImg, {sequence = 'forward', transition = 'fade', refresh = '10000'}) .. '</td>'
+
  return tostring(mw.html.create("span"):attr("title", title):addClass("explain"):wikitext(content))
 +
end
  
    local row1 = '<tr>' .. Cards .. '<th style="text-align: center;">' .. shipNum .. '</th>' .. Banners .. '</tr>'
+
-- Some calculations
  
    local kanji, form
+
local function getTotalAircraft(ship)
local formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "[改甲航]")
+
  local total = 0
if formNum == nil then
+
  if ship.aircraft ~= "" then
kanji = shipmodule.data[shipNum]["name"][1]
+
    for i, _ in pairs(ship.aircraft) do
form = ""
+
      if ship.aircraft[i] == nil or ship.aircraft[i] == "" then
else
+
        total = total + 0
kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1)
+
      else
form = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], formNum , -1)
+
        total = total + ship.aircraft[i]
end
+
      end
local JaName = frame:expandTemplate{ title = 'ruby-ja', args = { kanji , shipmodule.data[shipNum]["name"][2] } } .. form
+
    end
 +
  end
 +
  return total
 +
end
  
    local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. shipmodule.data[shipNum]["name"][3] .. '</th></tr>'
+
local function getMarriedHp(hp, maxHp)
    local row3 = '<tr><td colspan="4" style="text-align: center;">' .. shipmodule.data[shipNum]["class"] .. ' Class ' .. shipmodule.data[shipNum]["type"] .. '</td></tr>'
+
  return math.min(maxHp, hp + ({4, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1])
    local row4 = '<tr><td colspan="4"><hr style="border: 0; height: 1px; background-image: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));" /></td></tr>'
+
end
 
 
    local statLabel = '<th style="width: 65px; {{border-radius|12px 4px 4px 12px}} padding-left: 5px; padding-right: 5px; background-color: #eae1d1; color: #a3965c; text-align: right; vertical-align: baseline;">'
 
    local statBox = '<td style="{{border-radius|4px 12px 12px 4px}} padding-left: 5px; padding-right: 5px; border: 1px solid #a3965c; text-align: left; vertical-align: baseline;">'
 
  
    local HPinfo = statLabel .. 'HP [[File:IcoHP.png|HP]]</th>' .. statBox .. shipmodule.data[shipNum]["hp"] .. '</td>'
+
-- The ship infobox stuff, legacy
    local FPinfo = statLabel .. 'ATK [[File:IcoAtk.png|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>'
 
  
    local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>'
+
local function renderStats(ship)
 
+
  local shipName = ship.name[3]
    local Armorinfo = statLabel .. 'DEF [[File:IcoArmor.png|Armor]]</th>' .. statBox .. shipmodule.data[shipNum]["armor"][1] .. '→' .. shipmodule.data[shipNum]["armor"][2] .. '</td>'
+
  local CardImg = '<div class="top-image">[[File:Ship Card ' .. shipName .. ".png|218x300px|link=]]</div>"
     local Torpedoinfo = statLabel .. 'TORP [[File:IcoTorpedo.png|Torpedo]]</th>' .. statBox
+
  local CardDmgImg = '<div class="bottom-image">[[File:Ship Card ' .. shipName .. " Damaged.png|218x300px|link=]]</div>"
     if shipmodule.data[shipNum]["torpedo"] == 0 then
+
  local BannerImg = '<div class="top-image">[[File:Ship Banner ' .. shipName .. ".png|link=]]</div>"
        Torpedoinfo = Torpedoinfo .. shipmodule.data[shipNum]["torpedo"]
+
  local BannerDmgImg = '<div class="bottom-image">[[File:Ship Banner ' .. shipName .. " Damaged.png|link=]]</div>"
 +
  local Cards =
 +
    '<td rowspan="10" class="double-image" style="width:218px;height:300px">' .. CardImg .. CardDmgImg .. "</td>"
 +
  local Banners =
 +
    '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>"
 +
  local sortNoText = ship.no and (ship.no < 1000 and ship.no or formatTooltip(ship.id, ship.no)) or ship.id
 +
  local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>"
 +
  -- Formatting Japanese
 +
  local kanji, form
 +
  local formNum = mw.ustring.find(ship["name"][1], "[乙改甲航]")
 +
  if formNum == nil then
 +
    if mw.ustring.find(ship["name"][1], "%szwei") ~= nil then
 +
      formNum = mw.ustring.find(ship["name"][1], "%szwei")
 +
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 +
      form = "&#32;zwei"
 +
    elseif mw.ustring.find(ship["name"][1], "%sdrei") ~= nil then
 +
      formNum = mw.ustring.find(ship["name"][1], "%sdrei")
 +
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 +
      form = "&#32;drei"
 +
     elseif mw.ustring.find(ship["name"][1], "%sdue") ~= nil then
 +
      formNum = mw.ustring.find(ship["name"][1], "%sdue")
 +
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 +
      form = "&#32;due"
 +
    elseif mw.ustring.find(ship["name"][1], "%sдва") ~= nil then
 +
      formNum = mw.ustring.find(ship["name"][1], "%sдва")
 +
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 +
      form = "&#32;два"
 +
     elseif mw.ustring.find(ship["name"][1], "%sMk.II") ~= nil then
 +
      if mw.ustring.find(ship["name"][1], "%sMk.II Mod.2") ~= nil then
 +
        formNum = mw.ustring.find(ship["name"][1], "%sMk.II Mod.2")
 +
        kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 +
        form = "&#32;Mk.II Mod.2"
 +
      else
 +
        formNum = mw.ustring.find(ship["name"][1], "%sMk.II")
 +
        kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 +
        form = "&#32;Mk.II"
 +
      end
 +
    elseif mw.ustring.find(ship["name"][1], "%sреволюция") ~= nil then -- Gangut "Kai" exception
 +
      kanji = mw.text.split(ship["name"][1], "%s")[1] .. "<br/>" .. mw.text.split(ship["name"][1], "%s")[2]
 +
      form = ""
 
     else
 
     else
        Torpedoinfo = Torpedoinfo .. shipmodule.data[shipNum]["torpedo"][1] .. '→' .. shipmodule.data[shipNum]["torpedo"][2]
+
      kanji = ship["name"][1]
 +
      form = ""
 
     end
 
     end
 
+
  else
     local row6 = '<tr>' .. Armorinfo .. Torpedoinfo .. '</tr>'
+
     kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
 
+
    form = mw.ustring.sub(ship["name"][1], formNum, -1)
    local Evasioninfo = statLabel .. 'EVA [[File:IcoEvasion.png|Evasion]]</th>' .. statBox .. shipmodule.data[shipNum]["evasion"][1] .. '' .. shipmodule.data[shipNum]["evasion"][2] .. '</td>'
+
  end
     local AAinfo = statLabel .. 'AA [[File:IcoAA.png|Anti-Air]]</th>' .. statBox
+
  local JaName = ""
    if shipmodule.data[shipNum]["aa"] == 0 then
+
  if
        AAinfo = AAinfo .. shipmodule.data[shipNum]["aa"]
+
    ship.name[3] == "Verniy" or ship.name[3] == "Gangut" or ship.name[3] == "Oktyabrskaya Revolyutsiya" or ship.name[3] == "Tashkent" or ship.name[3] == "Tashkent Kai" or ship.name[3] == "Gangut Dva"
 +
  then -- Russian ship markup
 +
    JaName =
 +
      '<ruby lang="ru"><rb>' ..
 +
      kanji ..
 +
        '<span lang="ru">' ..
 +
          form .. "</span>" .. '</rb><rp> (</rp><rt lang="ja">' .. ship["name"][2] .. "</rt><rp>) </rp></ruby>"
 +
  else
 +
     if ship.name[2] then
 +
      JaName =
 +
        '<ruby lang="ja"><rb>' ..
 +
        kanji .. "<span>" .. form .. "</span>" .. "</rb><rp> (</rp><rt>" .. ship.name[2] .. "</rt><rp>) </rp></ruby>"
 
     else
 
     else
        AAinfo = AAinfo .. shipmodule.data[shipNum]["aa"][1] .. '→' .. shipmodule.data[shipNum]["aa"][2]
+
      JaName = '<ruby lang="ja"><rb>' .. kanji .. "<span>" .. form .. "</span>" .. "</rb></ruby>"
 
     end
 
     end
 +
  end
 +
  -- Summary of basic ship info
 +
  local isCVE =
 +
    ship.type == "Light Carrier" and type(ship.asw) == "table" and type(ship.asw[1]) == "number" and ship.asw[1] > 0
 +
  local shipType =
 +
    isCVE and string.format('<span class="explain" title="CVE">%s[[Category:Escort Carriers]]</span>', ship.type) or
 +
    ship.type
 +
  local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. ship.name[3] .. "</th></tr>"
 +
  local class_string = ship.display_class and formatTooltip(ship.class, "Game library: " .. ship.display_class) or ship.class
 +
  local row3 = '<tr><td colspan="4" style="text-align: center;">' .. class_string .. " " .. shipType .. "</td></tr>"
 +
  local row4 =
 +
    '<tr><td colspan="4"><hr style="border: 0; height: 1px; background-image: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));" /></td></tr>'
 +
  -- Ship stats table
 +
  local statLabel =
 +
    '<th style="width: 65px; {{border-radius|12px 4px 4px 12px}} padding-left: 5px; padding-right: 5px; background-color: #eae1d1; color: #a3965c; text-align: right; vertical-align: baseline;">'
 +
  local statBox =
 +
    '<td style="{{border-radius|4px 12px 12px 4px}} padding-left: 5px; padding-right: 5px; border: 1px solid #a3965c; text-align: left; vertical-align: baseline;">'
 +
  local hp = ship["hp"][1]
 +
  local maxHp = ship["hp"][2]
 +
  local HPinfo
 +
  if maxHp then
 +
    local marriedHp = getMarriedHp(hp, maxHp)
 +
    local maxModHp = math.min(hp + 2, maxHp)
 +
    local maxModMarriedHp = math.min(marriedHp + 2, maxHp)
 +
    local hpSpan1 = hp == maxModHp and hp or formatTooltip(hp, string.format("%d with HP modernization", maxModHp))
 +
    local hpSpan2 =
 +
      formatTooltip(
 +
      marriedHp,
 +
      marriedHp == maxModMarriedHp and "Married" or string.format("Married, %d with HP modernization", maxModMarriedHp)
 +
    )
 +
    HPinfo = statLabel .. "HP [[File:IcoHP.png|HP]]</th>" .. statBox .. hpSpan1 .. "→" .. hpSpan2 .. "</td>"
 +
  else
 +
    HPinfo = statLabel .. "HP [[File:IcoHP.png|HP]]</th>" .. statBox .. hp .. "</td>"
 +
  end
 +
  local FPinfo =
 +
    statLabel .. "FP [[File:IcoAtk.png|18px|Firepower]]</th>" .. statBox .. ship["fp"][1] .. "→" .. ship["fp"][2] .. "</td>"
 +
  local row5 = "<tr>" .. HPinfo .. FPinfo .. "</tr>"
 +
  -- Armor & Torpedo
 +
  local Armorinfo =
 +
    statLabel ..
 +
    "ARM [[File:IcoArmor.png|Armor]]</th>" .. statBox .. ship["armor"][1] .. "→" .. ship["armor"][2] .. "</td>"
 +
  local Torpedoinfo = statLabel .. "TORP[[File:IcoTorpedo.png|Torpedo]]</th>" .. statBox
 +
  if ship["torpedo"] == 0 then
 +
    Torpedoinfo = Torpedoinfo .. ship["torpedo"]
 +
  else
 +
    Torpedoinfo = Torpedoinfo .. ship["torpedo"][1] .. "→" .. ship["torpedo"][2]
 +
  end
 +
  local row6 = "<tr>" .. Armorinfo .. Torpedoinfo .. "</tr>"
 +
  -- Evasion & AA
 +
  local Evasioninfo =
 +
    statLabel ..
 +
    "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox .. ship["evasion"][1] .. "→" .. ship["evasion"][2] .. "</td>"
 +
  local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox
 +
  if ship["aa"] == 0 then
 +
    AAinfo = AAinfo .. ship["aa"]
 +
  else
 +
    AAinfo = AAinfo .. ship["aa"][1] .. "→" .. ship["aa"][2]
 +
  end
 +
  local row7 = "<tr>" .. Evasioninfo .. AAinfo .. "</tr>"
 +
  -- Planes & ASW
 +
  local aircraftTotal = getTotalAircraft(ship)
 +
  local Planeinfo = statLabel .. "PLA [[File:IcoAircraft.png|Aircraft]]</th>" .. statBox .. aircraftTotal .. "</td>"
 +
  local ASWinfo = statLabel .. "ASW [[File:IcoASW.png|Anti-Submarine Warfare]]</th>" .. statBox
 +
  if ship["asw"] == 0 then
 +
    ASWinfo = ASWinfo .. ship["asw"]
 +
  else
 +
    ASWinfo = ASWinfo .. ship["asw"][1] .. "→" .. ship["asw"][2]
 +
  end
 +
  local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>"
 +
  -- Speed & LOS
 +
  local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>"
 +
  local LOSinfo =
 +
    statLabel ..
 +
    "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox .. ship["los"][1] .. "→" .. ship["los"][2] .. "</td>"
 +
  local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>"
 +
  -- Range & Luck
 +
  local Rangeinfo = statLabel .. "RGE [[File:IcoRange.png|Range]]</th>" .. statBox .. ship["range"] .. "</td>"
 +
  local Luckinfo =
 +
    statLabel .. "LUK [[File:IcoLuck.png|Luck]]</th>" .. statBox .. ship["luck"][1] .. "→" .. ship["luck"][2] .. "</td>"
 +
  local row10 = "<tr>" .. Rangeinfo .. Luckinfo .. "</tr>"
 +
  local StatTable =
 +
    "<table>" .. row1 .. row2 .. row3 .. row4 .. row5 .. row6 .. row7 .. row8 .. row9 .. row10 .. "</table>"
 +
  return StatTable
 +
end
  
     local row7 = '<tr>' .. Evasioninfo .. AAinfo .. '</tr>'
+
local function renderEquipment(ship)
 
+
  local equipHeader = ""
     local aircraftTotal = 0
+
  local planeStyle = '<td style="width: 25%; white-space: nowrap; text-align: center; vertical-align: top;">'
     if shipmodule.data[shipNum]["aircraft"] ~= "" then
+
  local equipStyle = ""
    local aircraftslot = {0, 0, 0, 0}
+
  if ship["aircraft"] ~= "" then
        for i = 1, 4, 1 do
+
     local equipHeader1 =
            if shipmodule.data[shipNum]["aircraft"][i] ~= nil then
+
      '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #efe6d7; color: #a3965c;">Aircraft</th>'
            aircraftslot[i] = shipmodule.data[shipNum]["aircraft"][i]
+
    local equipHeader2 =
        else
+
      '<th style="width: 75%; white-space: nowrap; {{border-radius|4px 12px 12px 4px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
              aircraftslot[i] = 0
+
    equipHeader = equipHeader1 .. equipHeader2
             end
+
    equipStyle = '<td style="width: 75%; max-width: 375px; text-align: center; vertical-align: baseline;">'
 +
  else
 +
     equipHeader =
 +
      '<th style="white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
 +
     equipStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
 +
  end
 +
  local numRows = math.max(4, U.isize(ship["equip"]))
 +
  local equipTable = ""
 +
  for i = 1, numRows, 1 do
 +
    local equipRow = "<tr>"
 +
    if ship["aircraft"] ~= "" then
 +
      if ship["aircraft"][i] ~= nil then
 +
        equipRow = equipRow .. planeStyle .. ship["aircraft"][i] .. "</td>" .. equipStyle
 +
      else
 +
        equipRow = equipRow .. planeStyle .. "</td>" .. equipStyle
 +
      end
 +
      if ship["equip"] ~= "" then
 +
        if ship["equip"][i] == "" or ship["equip"][i] == "Unequipped" then
 +
          equipRow = equipRow .. "-Unequipped-</td></tr>"
 +
        elseif ship["equip"][i] == nil then
 +
          equipRow = equipRow .. "''-Locked-''</td></tr>"
 +
        else
 +
          if string.find(ship["equip"][i], "%★") then
 +
            local a, b = string.match(ship["equip"][i], "^(.+)★(.+)$")
 +
            equipRow = equipRow .. "[[" .. a .. "|" .. a .. "★" .. b .. "]]</td></tr>"
 +
          else
 +
             equipRow = equipRow .. "[[" .. ship["equip"][i] .. "]]</td></tr>"
 +
          end
 
         end
 
         end
        aircraftTotal = aircraftslot[1] + aircraftslot[2] + aircraftslot[3] + aircraftslot[4]
+
      else
    else
+
         equipRow = equipRow .. "''-Locked-''</td></tr>"
         aircraftTotal = 0
+
      end
    end
 
    local Planeinfo = statLabel .. 'PLA [[File:IcoAircraft.png|Aircraft]]</th>' .. statBox .. aircraftTotal .. '</td>'
 
    local ASWinfo = statLabel .. 'ASW [[File:IcoASW.png|Anti-Submarine Warfare]]</th>' .. statBox
 
    if shipmodule.data[shipNum]["asw"] == 0 then
 
        ASWinfo = ASWinfo .. shipmodule.data[shipNum]["asw"]
 
    else
 
        ASWinfo = ASWinfo .. shipmodule.data[shipNum]["asw"][1] .. '→' .. shipmodule.data[shipNum]["asw"][2]
 
    end
 
 
 
    local row8 = '<tr>' .. Planeinfo .. ASWinfo .. '</tr>'
 
 
 
    local Speedinfo = statLabel .. 'SPD [[File:IcoSpeed.png|Speed]]</th>' .. statBox .. shipmodule.data[shipNum]["spd"] .. '</td>'
 
    local LOSinfo = statLabel .. 'LOS [[File:IcoLOS.png|Line of Sight]]</th>' .. statBox .. shipmodule.data[shipNum]["los"][1] .. '→' .. shipmodule.data[shipNum]["los"][2] .. '</td>'
 
 
 
    local row9 = '<tr>' .. Speedinfo .. LOSinfo .. '</tr>'
 
 
 
    local Rangeinfo = statLabel .. 'RGE [[File:IcoRange.png|Range]]</th>' .. statBox .. shipmodule.data[shipNum]["range"] .. '</td>'
 
    local Luckinfo = statLabel .. 'LUK [[File:IcoLuck.png|Luck]]</th>' .. statBox .. shipmodule.data[shipNum]["luck"][1] .. '→' .. shipmodule.data[shipNum]["luck"][2] .. '</td>'
 
 
 
    local row10 = '<tr>' .. Rangeinfo .. Luckinfo .. '</tr>'
 
    local StatTable = '<table>' .. row1 .. row2 .. row3 .. row4 .. row5 .. row6 .. row7 .. row8 .. row9 .. row10 .. '</table>'
 
 
 
    -- Upper part complete
 
 
 
    local RscHeader = '<th style="white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
 
    local RscData = '<td style="white-space: nowrap; text-align: center;">'
 
    local RscData2 = '<td colspan="3" style="white-space: nowrap; text-align: center;">'
 
 
 
    local constrheader = ''
 
    local constrdata = ''
 
 
 
    if shipmodule.data[shipNum]["remodellv"] ~= nil and shipmodule.data[shipNum]["remodellv"] ~= "" then
 
        constrheader = 'Remodel Level'
 
        constrdata = shipmodule.data[shipNum]["remodellv"]
 
 
     else
 
     else
        constrheader = 'Build Time'
+
      equipRow = equipRow .. equipStyle
        if shipmodule.data[shipNum]["buildtime"] == nil or shipmodule.data[shipNum]["buildtime"] == "" then
+
      if ship["equip"] ~= "" then
            constrdata = 'Not Buildable'
+
        if ship["equip"][i] == "" or ship["equip"][i] == "Unequipped" then
 +
          equipRow = equipRow .. "-Unequipped-</td></tr>"
 +
        elseif ship["equip"][i] == nil then
 +
          equipRow = equipRow .. "''Locked''</td></tr>"
 
         else
 
         else
             constrdata = shipmodule.data[shipNum]["buildtime"]
+
          if string.find(ship["equip"][i], "%★") then
 +
             local a, b = string.match(ship["equip"][i], "^(.+)★(.+)$")
 +
            equipRow = equipRow .. "[[" .. a .. "|" .. a .. "★" .. b .. "]]</td></tr>"
 +
          else
 +
            equipRow = equipRow .. "[[" .. ship["equip"][i] .. "]]</td></tr>"
 +
          end
 
         end
 
         end
 +
      else
 +
        equipRow = equipRow .. "''Locked''</td></tr>"
 +
      end
 
     end
 
     end
 +
    equipTable = equipTable .. equipRow
 +
  end
 +
  return '<table style="width: 100%">' .. equipHeader .. equipTable .. "</table>"
 +
end
  
    local remodelsteel = '[[File:IcoSteel.png|18px|Steel]]'
+
local function renderModernization(ship)
    local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]'
+
  local RscHeader =
   
+
    '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
    local remodelinfo = ''
+
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
    if shipmodule.data[shipNum]["remodelreq"] ~= "" then
+
  local RscData2 = '<td colspan="3" style="width: 75%; white-space: nowrap; text-align: center;">'
        remodelsteel = remodelsteel .. ' ' .. shipmodule.data[shipNum]["remodelreq"][1]
+
  -- Construction info
        remodelammo = remodelammo .. ' ' .. shipmodule.data[shipNum]["remodelreq"][2]
+
  local constrheader = ""
         remodelinfo = remodelsteel .. ' ' .. remodelammo
+
  local constrdata = ""
         if shipmodule.data[shipNum]["remodelreq"][3] == 1 then
+
  if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
        local remodelBP = '[[File:IcoBlueprint.png|18px|Blueprint]]'
+
    constrheader = "Remodel Level"
        remodelinfo = remodelinfo .. ' ' .. remodelBP
+
    constrdata = ship["remodellv"]
        elseif shipmodule.data[shipNum]["remodelreq"][3] == 2 then
+
  else
        local remodelCatapult = '[[File:IcoCatapult.png|18px|Prototype Flight Deck Catapult]]'
+
    constrheader = '<span class="explain-dash" title="h:mm">Build Time</span>'
        remodelinfo = remodelinfo .. ' ' .. remodelBP .. ' ' .. remodelCatapult
+
    constrdata =
    end
+
      type(ship.buildtime) ~= "table" and "??" or
 +
      string.format(
 +
        "%s (%s)",
 +
         formatBuildtime(ship.buildtime[1]),
 +
         ship.buildtime[2] and ship.buildtime[3] and "Normal, LSC" or ship.buildtime[2] and "Normal" or
 +
          ship.buildtime[3] and "LSC" or
 +
          "Unbuildable"
 +
      )
 +
  end
 +
  local remodelinfo = ""
 +
  if ship.remodelreq and ship.remodelreq ~= "" then
 +
    remodelinfo =
 +
      string.format(
 +
      "[[File:IcoAmmo.png|18px|Ammo]] %d [[File:IcoSteel.png|18px|Steel]] %d",
 +
      ship.remodelreq[2],
 +
      ship.remodelreq[1]
 +
    )
 +
    if ship.remodelbp then
 +
      remodelinfo =
 +
        remodelinfo ..
 +
        " " ..
 +
          string.format("[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d", ship.remodelbp)
 
     end
 
     end
 
+
    if ship.remodelcatapult then
     local row11 = ''
+
      remodelinfo =
     if constrheader == 'Build Time' then
+
        remodelinfo ..
        row11 = '<tr>' .. RscHeader .. constrheader .. '</th>' .. RscData .. constrdata .. '</td><td colspan="2">&nbsp;</td></tr>'
+
        " " ..
     else
+
          string.format(
         row11 = '<tr>' .. RscHeader .. constrheader .. '</th>' .. RscData .. constrdata .. '</td>' .. RscHeader .. 'Remodel Req</th>' .. RscData .. remodelinfo .. '</td></tr>'
+
            "[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult|link=Prototype Flight Deck Catapult]] %d",
 +
            ship.remodelcatapult
 +
          )
 +
     end
 +
     if ship.remodelar then
 +
      remodelinfo =
 +
        remodelinfo ..
 +
        " " ..
 +
          string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.remodelar)
 +
    end
 +
    if ship.remodeldevmat or ship.remodelconmat or ship.remodelgunmat or ship.remodelairmat or ship.remodelarmmat or ship.remodelboiler or ship.overseastech or ship.remodelscrew then
 +
      remodelinfo = remodelinfo .. "<br>"
 +
    end
 +
    if ship.remodeldevmat then
 +
      remodelinfo =
 +
        remodelinfo .. " " .. string.format("[[File:IcoDevmat.png|18px|Development Material]] %d", ship.remodeldevmat)
 +
    end
 +
    if ship.remodelconmat then
 +
      remodelinfo =
 +
        remodelinfo .. " " .. string.format("[[File:IcoConmat.png|18px|Construction Material]] %d", ship.remodelconmat)
 +
    end
 +
    if ship.remodelgunmat then
 +
      remodelinfo =
 +
        remodelinfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material|link=New Model Gun Development Material]] %d",
 +
            ship.remodelgunmat
 +
          )
 +
    end
 +
     if ship.remodelairmat then
 +
      remodelinfo =
 +
         remodelinfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material|link=New Model Aviation Development Material]] %d",
 +
            ship.remodelairmat
 +
          )
 +
    end
 +
    if ship.remodelarmmat then
 +
      remodelinfo =
 +
        remodelinfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material|link=New Model Armament Material]] %d",
 +
            ship.remodelarmmat
 +
          )
 +
    end
 +
    if ship.remodelboiler then
 +
      remodelinfo =
 +
        remodelinfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model High Temperature High Pressure Boiler.png|18px|New Model High Temperature High Pressure Boiler|link=New Model High Temperature High Pressure Boiler]] %d",
 +
            ship.remodelboiler
 +
          )
 +
    end
 +
    if ship.overseastech then
 +
      remodelinfo =
 +
        remodelinfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon Latest Overseas Warship Technology.png|18px|Latest Overseas Warship Technology|link=Latest Overseas Warship Technology]] %d",
 +
            ship.overseastech
 +
          )
 +
    end
 +
    if ship.remodelscrew then
 +
      remodelinfo =
 +
        remodelinfo .. " " .. string.format("[[File:Item Icon Improvement Material.png|18px|Improvement Material|link=Improvement]] %d", ship.remodelscrew)
 
     end
 
     end
 +
  end
 +
  -- Construction & Remodel
 +
  local row11 = ""
 +
  if constrheader == "Build Time" then
 +
    row11 =
 +
      "<tr>" .. RscHeader .. constrheader .. "</th>" .. RscData .. constrdata .. '</td><td colspan="2">&nbsp;</td></tr>'
 +
  else
 +
    row11 =
 +
      "<tr>" ..
 +
      RscHeader ..
 +
        constrheader ..
 +
          "</th>" ..
 +
            RscData ..
 +
              constrdata .. "</td>" .. RscHeader .. "Remodel Req</th>" .. RscData .. remodelinfo .. "</td></tr>"
 +
  end
 +
  -- Consumption
 +
  local consfuel = "[[File:IcoFuel.png|18px|Fuel]] " .. ship["consumption"][1]
 +
  local consammo = "[[File:IcoAmmo.png|18px|Ammo]] " .. ship["consumption"][2]
 +
  local row12 = "<tr>" .. RscHeader .. "Consumption</th>" .. RscData .. consfuel .. " " .. consammo .. "</td>"
 +
  -- Scrap Info
 +
  local scrapfuel = "[[File:IcoFuel.png|18px|Fuel]] " .. ship["dismantle"][1]
 +
  local scrapammo = "[[File:IcoAmmo.png|18px|Ammo]] " .. ship["dismantle"][2]
 +
  local scrapsteel = "[[File:IcoSteel.png|18px|Steel]] " .. ship["dismantle"][3]
 +
  local scrapbauxite = "[[File:IcoBauxite.png|18px|Bauxite]] " .. ship["dismantle"][4]
 +
  local scrapinfo = scrapfuel .. " " .. scrapammo .. " " .. scrapsteel .. " " .. scrapbauxite
 +
  local row12 = row12 .. RscHeader .. "Dismantle</th>" .. RscData .. scrapinfo .. "</td></tr>"
 +
  -- Modernization
 +
  local modFP = "[[File:IcoAtkRemodel.png|25px|Firepower]] " .. ship["modernization"][1]
 +
  local modTorp = "[[File:IcoTorpedoRemodel.png|25px|Torpedo]] " .. ship["modernization"][2]
 +
  local modAA = "[[File:IcoAARemodel.png|25px|Anti-Air]] " .. ship["modernization"][3]
 +
  local modArmor = "[[File:IcoArmorRemodel.png|25px|Armor]] " .. ship["modernization"][4]
 +
  local modLuck = ""
 +
  if ship["modernization"][5] ~= nil and ship["modernization"][5] ~= "" then
 +
    modLuck = "[[File:IcoLuckRemodel.png|25px|Luck]] " .. ship["modernization"][5]
 +
  end
 +
  local modInfo = modFP .. " " .. modTorp .. " " .. modAA .. " " .. modArmor
 +
  if modLuck ~= "" then
 +
    modInfo = modInfo .. " " .. modLuck
 +
  end
 +
  local row13 = "<tr>" .. RscHeader .. "Modernization</th>" .. RscData2 .. modInfo .. "</td></tr>"
 +
  return row13 .. row11 .. row12
 +
end
  
     local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["consumption"][1]
+
local function renderArtists(ship)
     local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["consumption"][2]
+
  local RscHeader =
 +
     '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
 +
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
 +
  local illustrator =
 +
    ship["artist"] ~= "Unknown" and ship["artist"] ~= "" and
 +
    ("[[:Category:" .. ship["artist"] .. "|" .. ship["artist"] .. "]]") or
 +
    "Unknown"
 +
  local voiceactor =
 +
    ship["seiyuu"] ~= "Unknown" and ship["seiyuu"] ~= "" and
 +
     ("[[:Category:" .. ship["seiyuu"] .. "|" .. ship["seiyuu"] .. "]]") or
 +
    "Unknown"
 +
  return RscHeader ..
 +
    "Illustrator</th>" .. RscData .. illustrator .. "</td>" .. RscHeader .. "Seiyuu</th>" .. RscData .. voiceactor .. "</td>"
 +
end
  
    local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>'
+
local function renderCategories(ship)
 +
  local categories = "[[Category:Ships]][[Category:" .. ship["class"] .. "]][[Category:" .. ship["type"] .. "s]]"
 +
  if ship["artist"] ~= "Unknown" and ship["artist"] ~= "" then
 +
    categories = categories .. "[[Category:" .. ship["artist"] .. "]]"
 +
  end
 +
  if ship["seiyuu"] ~= "Unknown" and ship["seiyuu"] ~= "" then
 +
    categories = categories .. "[[Category:" .. ship["seiyuu"] .. "]]"
 +
  end
 +
  return categories
 +
end
  
    local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["dismantle"][1]
+
local function renderReversion(ship) --Copy paste mess by Chocolatecravinghobo. Shows information/cost for models that remodel/revert to a previous remodel
     local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["dismantle"][2]
+
  --- Souya hardcode fix
    local scrapsteel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipmodule.data[shipNum]["dismantle"][3]
+
  if ship["reversionto"] == "Souya " then
     local scrapbauxite = '[[File:IcoBauxite.png|18px|Bauxite]] ' .. shipmodule.data[shipNum]["dismantle"][4]
+
ship.reversionto = ship.reversionto .. "(AGS)"
     local scrapinfo = scrapfuel .. ' ' .. scrapammo .. ' ' .. scrapsteel .. ' ' .. scrapbauxite
+
  end
    local row12 = row12 .. RscHeader .. 'Dismantle</th>' .. RscData .. scrapinfo .. '</td></tr>'
+
 
 
+
  local reversionHeader = ""
    local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipmodule.data[shipNum]["modernization"][1]
+
  local reversionStyle = ""
    local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipmodule.data[shipNum]["modernization"][2]
+
  local reversionHeader =
     local modAA = '[[File:IcoAARemodel.png|25px|Anti-Air]] ' .. shipmodule.data[shipNum]["modernization"][3]
+
      '<th colspan="4" style="width: 75%; white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #3baef5; color: #ffffff; vertical-align: baseline;"> Reversible to ' .. ship.reversionto .. "</th>"
    local modArmor = '[[File:IcoArmorRemodel.png|25px|Armor]] ' .. shipmodule.data[shipNum]["modernization"][4]
+
  local reversionStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
     local modLuck = ''
+
  local RscHeader =
     if shipmodule.data[shipNum]["modernization"][5] ~= nil and shipmodule.data[shipNum]["modernization"][5] ~= "" then
+
    '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
        -- modLuck = '[[File:IcoLuck|18px|Luck]] ' .. shipmodule.data[shipNum]["modernization"][5]
+
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
        modLuck = '[[File:IcoLuckRemodel.png|25px|Luck]] ' .. shipmodule.data[shipNum]["modernization"][5] -- Just a placeholder
+
  -- Construction info
 +
  local reversionlvheader = ""
 +
  local reversionlvdata = ""
 +
  if ship["reversionlv"] ~= nil and ship["reversionlv"] ~= "" then
 +
    reversionlvheader = "Reversion Level"
 +
    reversionlvdata = ship["reversionlv"]
 +
  end
 +
  local reversioninfo = ""
 +
  if ship.reversionreq and ship.reversionreq ~= "" then
 +
     reversioninfo =
 +
      string.format(
 +
      "[[File:IcoAmmo.png|18px|Ammo]] %d [[File:IcoSteel.png|18px|Steel]] %d",
 +
      ship.reversionreq[2],
 +
      ship.reversionreq[1]
 +
     )
 +
    if ship.reversionbp then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format("[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d", ship.reversionbp)
 +
    end
 +
     if ship.reversioncatapult then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult|link=Prototype Flight Deck Catapult]] %d",
 +
            ship.reversioncatapult
 +
          )
 +
    end
 +
    if ship.reversionar then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.reversionar)
 +
    end
 +
    if ship.reversiondevmat or ship.reversionconmat or ship.reversiongunmat or ship.reversionairmat or ship.reversionarmmat or ship.reversionboiler or ship.reversionscrew then
 +
      reversioninfo = reversioninfo .. "<br>"
 +
     end
 +
    if ship.reversiondevmat then
 +
      reversioninfo =
 +
        reversioninfo .. " " .. string.format("[[File:IcoDevmat.png|18px|Development Material]] %d", ship.reversiondevmat)
 +
    end
 +
    if ship.reversionconmat then
 +
      reversioninfo =
 +
        reversioninfo .. " " .. string.format("[[File:IcoConmat.png|18px|Construction Material]] %d", ship.reversionconmat)
 +
     end
 +
     if ship.reversiongunmat then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material|link=New Model Gun Development Material]] %d",
 +
            ship.reversiongunmat
 +
          )
 +
    end
 +
    if ship.reversionairmat then
 +
      reversioninfo =
 +
        reversioninfo ..
 +
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material|link=New Model Aviation Development Material]] %d",
 +
            ship.reversionairmat
 +
          )
 
     end
 
     end
 
+
    if ship.reversionarmmat then
    local modInfo = modFP .. ' ' .. modTorp .. ' ' .. modAA .. ' ' .. modArmor
+
      reversioninfo =
    if modLuck ~= '' then
+
        reversioninfo ..
        modInfo = modInfo .. ' ' .. modLuck
+
        " " ..
 +
          string.format(
 +
            "[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material|link=New Model Armament Material]] %d",
 +
            ship.reversionarmmat
 +
          )
 
     end
 
     end
     local row13 = '<tr>' .. RscHeader .. 'Modernization</th>' .. RscData2 .. modInfo .. '</td></tr>'
+
     if ship.reversionboiler then
 
+
      reversioninfo =
    local illustrator = ''
+
        reversioninfo ..
    local voiceactor = ''
+
         " " ..
    local cat = '[[Category:Ships]]'
+
          string.format(
    if shipmodule.data[shipNum]["artist"] ~= "Unknown" and shipmodule.data[shipNum]["artist"] ~= "" then
+
            "[[File:Item Icon New Model High Temperature High Pressure Boiler.png|18px|New Model High Temperature High Pressure Boiler|link=New Model High Temperature High Pressure Boiler]] %d",
         illustrator = '[[:Category:' .. shipmodule.data[shipNum]["artist"] .. '|' .. shipmodule.data[shipNum]["artist"] .. ']]'
+
            ship.reversionboiler
        cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["artist"] .. ']]'
+
          )
    else
 
        illustrator = 'Unknown'
 
 
     end
 
     end
     if shipmodule.data[shipNum]["seiyuu"] ~= "Unknown" and shipmodule.data[shipNum]["seiyuu"] ~= "" then
+
     if ship.reversionscrew then
        voiceactor = '[[:Category:' .. shipmodule.data[shipNum]["seiyuu"] .. '|' .. shipmodule.data[shipNum]["seiyuu"] .. ']]'
+
      reversioninfo = reversioninfo .. " " .. string.format(
         cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["seiyuu"] .. ']]'
+
         "[[File:Item Icon Improvement Material.png|18px|Improvement Material|link=Improvement]] %d",
    else
+
        ship.reversionscrew
        voiceactor = 'Unknown'
+
      )
 
     end
 
     end
     local row14 = '<tr>' .. RscHeader .. 'Artist</th>' .. RscData .. illustrator .. '</td>' .. RscHeader .. 'Seiyuu</th>' .. RscData .. voiceactor .. '</td></tr>'
+
  end
 +
  -- Reversion
 +
  local row14 = ""
 +
  local row15 = ""
 +
  if ship.reversionlv ~= "" then
 +
     row14 = "<tr>" .. reversionHeader .. "</tr>"-- .. reversionStyle
 +
    row15 =
 +
    "<tr>" ..
 +
      RscHeader ..
 +
        reversionlvheader ..
 +
          "</th>" ..
 +
            RscData ..
 +
              reversionlvdata .. "</td>" .. RscHeader .. "Reversion Req</th>" .. RscData .. reversioninfo .. "</td></tr>"
 +
  end
 +
  return row14 .. row15
 +
end
 +
 
  
    local equipHeader = ''
+
-- Converting to legacy data format
    local planeStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: top;">'
 
    local equipStyle = ''
 
    if shipmodule.data[shipNum]["aircraft"] ~= "" then
 
        equipHeader1 = '<th style="white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #efe6d7; color: #a3965c;">Aircraft</th>'
 
        equipHeader2 = '<th colspan="3" style="white-space: nowrap; {{border-radius|4px 12px 12px 4px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
 
        equipHeader = equipHeader1 .. equipHeader2
 
        equipStyle = '<td colspan="3" style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
 
    else
 
        equipHeader = '<th colspan="4" style="white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
 
        equipStyle = '<td colspan="4" style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
 
    end
 
  
    local equip = {'<tr>', '<tr>', '<tr>', '<tr>'}
+
local ShipData = require("Module:Data/Ship")
    for i = 1, 4, 1 do
+
local shipsByNo = require("Module:Collection/ShipsByNo")
        if shipmodule.data[shipNum]["aircraft"] ~= "" then
+
local shipsById = require("Module:Collection/ShipsByApiId")
        if shipmodule.data[shipNum]["aircraft"][i] ~= nil then
+
local Ship = require("Module:Ship")
        equip[i] = equip[i] .. planeStyle .. shipmodule.data[shipNum]["aircraft"][i] .. '</td>' .. equipStyle
 
    else
 
    equip[i] = equip[i] .. planeStyle .. '</td>' .. equipStyle
 
    end
 
            if shipmodule.data[shipNum]["equip"] ~= "" then
 
                if shipmodule.data[shipNum]["equip"][i] == "" or shipmodule.data[shipNum]["equip"][i] == "Unequipped" then
 
                    equip[i] = equip[i] .. '-Unequipped-</td></tr>'
 
                elseif shipmodule.data[shipNum]["equip"][i] == nil then
 
                    equip[i] = equip[i] .. '\'\'-Locked-\'\'</td></tr>'
 
                else
 
                    equip[i] = equip[i] .. '[[' .. shipmodule.data[shipNum]["equip"][i] .. ']]</td></tr>'
 
                end
 
            else
 
                equip[i] = equip[i] .. '\'\'-Locked-\'\'</td></tr>'
 
            end
 
        else
 
            equip[i] = equip[i] .. equipStyle
 
            if shipmodule.data[shipNum]["equip"] ~= "" then
 
                if shipmodule.data[shipNum]["equip"][i] == "" or shipmodule.data[shipNum]["equip"][i] == "Unequipped" then
 
                    equip[i] = equip[i] .. '-Unequipped-</td></tr>'
 
                elseif shipmodule.data[shipNum]["equip"][i] == nil then
 
                    equip[i] = equip[i] .. '\'\'Locked\'\'</td></tr>'
 
                else
 
                    equip[i] = equip[i] .. '[[' .. shipmodule.data[shipNum]["equip"][i] .. ']]</td></tr>'
 
                end
 
            else
 
                equip[i] = equip[i] .. '\'\'Locked\'\'</td></tr>'
 
            end
 
        end
 
    end
 
    local DetailTable = '<table style="width: 100%">' .. equipHeader .. equip[1] .. equip[2] .. equip[3] .. equip[4] .. row13 .. row11 .. row12 .. row14 .. '</table>'
 
  
    cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["class"] .. ' Class]][[Category:' .. shipmodule.data[shipNum]["type"] .. 's]]'
+
local function minMaxStats(a, b)
   
+
  return a == nil and b == nil and {'??', '??'} or (a == false or a == 0) and (b == false or b == 0) and 0 or {a or '??', b or '??'}
    local shipInfoBox = '<div style="display: inline-block; vertical-align: top;"><table style="{{border-radius|10px 10px 10px 10px}} border: 1px solid #aaaaaa; min-width: 495px">'
+
end
    shipInfoBox = shipInfoBox .. '<tr><td>' .. StatTable .. '</td></tr>'
 
    shipInfoBox = shipInfoBox .. '<tr><td>' .. DetailTable .. '</td></tr></table></div>' .. cat
 
  
    return shipInfoBox
+
local function trueIsOne(x)
 +
  return x == true and 1 or x
 
end
 
end
  
function shipmodule.KanmusuList(frame)
+
local function loadShipData(key)
    local shipType = frame.args[1]
+
  local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[key] or key, "name") or {}).id] or key)
    local shipListTable = '<table class="wikitable filterable sortable" style="width: 100%; min-width: 800px;"><tr>'
+
  local data = {}
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable" data-sort-type="number">ID</th>'
+
  data.id = ship:id() or '???'
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable unsortable">Name</th>'
+
  data.no = ship:true_id()
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable unsortable">Class</th>'
+
  data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""}
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unsortable">Type</th>'
+
  local class = ship:class()
    shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: LightCoral;" class="unfilterable">[[File:IcoAtk.png|Firepower]]</th>'
+
  data.class = class and class:name() or "???"
     shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: LightSkyBlue;" class="unfilterable">[[File:IcoTorpedo.png|Torpedo]]</th>'
+
  data.display_class = ship._display_class
     shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: SandyBrown;" class="unfilterable">[[File:IcoAA.png|Anti-Air]]</th>'
+
  data.type = ship:formatted_type() or ""
    shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Seashell;" class="unfilterable">[[File:IcoASW.png|Anti-Submarine Warfare]]</th>'
+
  data.spd = ship:formatted_speed() or ""
     shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Aquamarine;" class="unfilterable">[[File:IcoLOS.png|Line of Sight]]</th>'
+
  data.range = ship:formatted_range() or ""
     shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: PaleGreen;" class="unfilterable">[[File:IcoLuck.png|Luck]]</th>'
+
  data.rarity = ship:rarity() or ""
     shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Pink;" class="unfilterable">[[File:IcoHP.png|HP]]</th>'
+
  data.hp = minMaxStats(ship:hp(), ship:hp_max())
     shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Yellow;" class="unfilterable">[[File:IcoArmor.png|Armor]]</th>'
+
  data.fp = minMaxStats(ship:firepower(), ship:firepower_max())
    shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Violet;" class="unfilterable">[[File:IcoEvasion.png|Evasion]]</th>'
+
  data.armor = minMaxStats(ship:armor(), ship:armor_max())
    shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Silver;" class="unfilterable">[[File:IcoAircraft.png|Aircraft]]</th>'
+
  data.torpedo = minMaxStats(ship:torpedo(), ship:torpedo_max())
    shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Aqua;" class="unsortable">[[File:IcoSpeed.png|Speed|link=]]</th>'
+
  data.aa = minMaxStats(ship:aa(), ship:aa_max())
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unsortable">[[File:IcoRange.png|Range|link=]]</th>'
+
  data.luck = minMaxStats(ship:luck(), ship:luck_max())
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable">[[File:IcoFuel.png|Fuel Consumption]]</th>'
+
  data.evasion = minMaxStats(ship:evasion(), ship:evasion_max())
    shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable">[[File:IcoAmmo.png|Ammo Consumption]]</th></tr>'
+
  data.asw = minMaxStats(ship:asw(), ship:asw_max())
    local IDList = shipdb.getSortedIDList()
+
  data.los = minMaxStats(ship:los(), ship:los_max())
    for num, id in pairs(IDList) do
+
  data.aircraft = {}
        if shipType ~= nil then
+
  data.equip = {}
            if shipType == shipmodule.data[id]["type"] then
+
  for _, v in ipairs(ship._equipment) do
                shipListTable = shipListTable .. shipmodule.KanmusuListEntry(id)
+
     table.insert(data.equip, (v.equipment == nil and '?' or v.equipment or '') .. (v.stars and string.format(' ★+%d', v.stars) or ''))
            end
+
     table.insert(data.aircraft, v.size or "")
        else
+
  end
            shipListTable = shipListTable .. shipmodule.KanmusuListEntry(id)
+
  data.artist = ship:artist() or ""
        end
+
  if data.artist == 'Shimada Humikane' then
    end
+
data.artist = 'Shimada Fumikane'
    shipListTable = shipListTable .. '</table>'
+
  end
    return shipListTable
+
  data.seiyuu = ship:voice_actor() or ""
 +
  data.buildtime = {
 +
    ship._build_time or "",
 +
    ship._buildable == true or false,
 +
     ship._buildable_lsc == true or false
 +
  }
 +
  data.remodellv = ship:remodel_level() or ""
 +
  data.consumption = {ship:fuel() or "", ship:ammo() or ""}
 +
  data.remodelreq = not ship._remodel_steel and not ship._remodel_ammo and '' or {ship._remodel_steel or 0, ship._remodel_ammo or 0}
 +
  data.dismantle = {
 +
     ship._scrap_fuel or 0,
 +
    ship._scrap_ammo or 0,
 +
    ship._scrap_steel or 0,
 +
     ship._scrap_baux or 0,
 +
  }
 +
  data.modernization = {
 +
    ship._firepower_mod or 0,
 +
    ship._torpedo_mod or 0,
 +
    ship._aa_mod or 0,
 +
     ship._armor_mod or 0,
 +
    ship._luck_mod or '',
 +
  }
 +
  data.remodelbp = trueIsOne(ship._remodel_blueprint)
 +
  data.remodelcatapult = trueIsOne(ship._remodel_catapult)
 +
  data.remodelar = trueIsOne(ship._remodel_report)
 +
  data.remodelgunmat = trueIsOne(ship._remodel_gunmat)
 +
  data.remodelairmat = trueIsOne(ship._remodel_airmat)
 +
  data.remodelarmmat = trueIsOne(ship._remodel_armament)
 +
  data.remodelboiler = trueIsOne(ship._remodel_boiler)
 +
  data.overseastech  = trueIsOne(ship._remodel_overseas)
 +
  data.remodeldevmat = trueIsOne(ship._remodel_development_material)
 +
  data.remodelconmat = trueIsOne(ship._remodel_construction_material)
 +
  data.remodelscrew = trueIsOne(ship._remodel_screw)
 +
 
 +
  data.reversible = trueIsOne(ship._reversible)
 +
  data.reversionto = ship:remodel_to() or ""
 +
  data.reversionto = data.reversionto:gsub("/", " ")
 +
  data.reversionbp = trueIsOne(ship._remodel_to_blueprint)
 +
  data.reversionlv = ship:remodel_to_level() or ""
 +
  data.reversionreq = not ship._remodel_to_steel and not ship._remodel_to_ammo and '' or {ship._remodel_to_steel or 0, ship._remodel_to_ammo or 0}
 +
  data.reversionbp = trueIsOne(ship._remodel_to_blueprint)
 +
  data.reversioncatapult = trueIsOne(ship._remodel_to_catapult)
 +
  data.reversionar = trueIsOne(ship._remodel_to_report)
 +
  data.reversiongunmat = trueIsOne(ship._remodel_to_gunmat)
 +
  data.reversionairmat = trueIsOne(ship._remodel_to_airmat)
 +
  data.reversionarmmat = trueIsOne(ship._remodel_to_armament)
 +
  data.reversionboiler = trueIsOne(ship._remodel_to_boiler)
 +
  data.reversiondevmat = trueIsOne(ship._remodel_to_development_material)
 +
  data.reversionconmat = trueIsOne(ship._remodel_to_construction_material)
 +
  data.reversionscrew = trueIsOne(ship._remodel_to_screw)
 +
  return data
 
end
 
end
  
function shipmodule.KanmusuListEntry(id) -- Kanmusu List Table
+
local function render(frame)
    local strings = '<tr>'
+
  local ship = loadShipData(frame.args[1])
     local aircraftTotal = 0
+
  return '<div style="display:inline-block;vertical-align:top"><table style="{{border-radius|10px 10px 10px 10px}} border:1px solid #aaaaaa;min-width:495px"><tr><td>' ..
    if shipmodule.data[id]["aircraft"] ~= "" then
+
     renderStats(ship) ..
    local aircraftslot = {0, 0, 0, 0}
+
      "</td></tr><tr><td>" ..
         for i = 1, 4, 1 do
+
         renderEquipment(ship) ..
            if shipmodule.data[id]["aircraft"][i] ~= nil then
+
          '<table style="width:100%">' ..
                aircraftslot[i] = shipmodule.data[id]["aircraft"][i]
+
             renderModernization(ship) ..
             else
+
              renderArtists(ship) ..
                aircraftslot[i] = 0
+
            renderReversion(ship) .. "</table></td></tr></table></div>" .. renderCategories(ship)
            end
+
end
        end
 
        aircraftTotal = aircraftslot[1] + aircraftslot[2] + aircraftslot[3] + aircraftslot[4]
 
    else
 
        aircraftTotal = 0
 
    end
 
  
    strings = strings .. '<td style="text-align: center;">' .. id .. '</td>'
+
local function test()
    strings = strings .. '<td style="text-align: center;">[[' .. shipmodule.data[id]["name"][3] .. ']]</td>'
+
  return render({args = {"Brooklyn"}})
    strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["class"] .. '</td>'
 
    strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["type"] .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #f0bbbb;">' .. shipmodule.data[id]["fp"][1] .. '</td>'
 
    if shipmodule.data[id]["torpedo"] == 0 then
 
        strings = strings .. '<td style="text-align: center; background-color: #99eefa;">' .. shipmodule.data[id]["torpedo"] .. '</td>'
 
    else
 
        strings = strings .. '<td style="text-align: center; background-color: #99eefa;">' .. shipmodule.data[id]["torpedo"][1] .. '</td>'
 
    end
 
    if shipmodule.data[id]["aa"] == 0 then
 
        strings = strings .. '<td style="text-align: center; background-color: #faccaa;">' .. shipmodule.data[id]["aa"] .. '</td>'
 
    else
 
        strings = strings .. '<td style="text-align: center; background-color: #faccaa;">' .. shipmodule.data[id]["aa"][1] .. '</td>'
 
    end
 
    if shipmodule.data[id]["asw"] == 0 then
 
        strings = strings .. '<td style="text-align: center; background-color: #fff5ee;">' .. shipmodule.data[id]["asw"] .. '</td>'
 
    else
 
        strings = strings .. '<td style="text-align: center; background-color: #fff5ee;">' .. shipmodule.data[id]["asw"][1] .. '</td>'
 
    end
 
    strings = strings .. '<td style="text-align: center; background-color: #afffee;">' .. shipmodule.data[id]["los"][1] .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #cbfbcb;">' .. shipmodule.data[id]["luck"][1] .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #ffe0eb;">' .. shipmodule.data[id]["hp"] .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #ffffaa;">' .. shipmodule.data[id]["armor"][1] .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #eeccee;">' .. shipmodule.data[id]["evasion"][1] .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #d9d9d9;">' .. aircraftTotal .. '</td>'
 
    strings = strings .. '<td style="text-align: center; background-color: #aaffff;">' .. shipmodule.data[id]["spd"] .. '</td>'
 
    strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["range"] .. '</td>'
 
    strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["consumption"][1] .. '</td>'
 
    strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["consumption"][2] .. '</td></tr>'
 
    return strings
 
 
end
 
end
  
return shipmodule
+
-- print(p.test())
 +
 
 +
return {KanmusuInfo = render, test = test}

Latest revision as of 22:35, 27 July 2024

Documentation for this module may be created at Module:KanmusuModule/doc

local U = require("Module:Core")

-- Some formatting

local function formatBuildtime(minutes)
  return U.format {"${hours}:${minutes:2}", hours = math.floor(minutes / 60), minutes = minutes % 60}
end

local function formatTooltip(content, title)
  return tostring(mw.html.create("span"):attr("title", title):addClass("explain"):wikitext(content))
end

-- Some calculations

local function getTotalAircraft(ship)
  local total = 0
  if ship.aircraft ~= "" then
    for i, _ in pairs(ship.aircraft) do
      if ship.aircraft[i] == nil or ship.aircraft[i] == "" then
        total = total + 0
      else
        total = total + ship.aircraft[i]
      end
    end
  end
  return total
end

local function getMarriedHp(hp, maxHp)
  return math.min(maxHp, hp + ({4, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1])
end

-- The ship infobox stuff, legacy

local function renderStats(ship)
  local shipName = ship.name[3]
  local CardImg = '<div class="top-image">[[File:Ship Card ' .. shipName .. ".png|218x300px|link=]]</div>"
  local CardDmgImg = '<div class="bottom-image">[[File:Ship Card ' .. shipName .. " Damaged.png|218x300px|link=]]</div>"
  local BannerImg = '<div class="top-image">[[File:Ship Banner ' .. shipName .. ".png|link=]]</div>"
  local BannerDmgImg = '<div class="bottom-image">[[File:Ship Banner ' .. shipName .. " Damaged.png|link=]]</div>"
  local Cards =
    '<td rowspan="10" class="double-image" style="width:218px;height:300px">' .. CardImg .. CardDmgImg .. "</td>"
  local Banners =
    '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>"
  local sortNoText = ship.no and (ship.no < 1000 and ship.no or formatTooltip(ship.id, ship.no)) or ship.id
  local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>"
  -- Formatting Japanese
  local kanji, form
  local formNum = mw.ustring.find(ship["name"][1], "[乙改甲航]")
  if formNum == nil then
    if mw.ustring.find(ship["name"][1], "%szwei") ~= nil then
      formNum = mw.ustring.find(ship["name"][1], "%szwei")
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
      form = "&#32;zwei"
    elseif mw.ustring.find(ship["name"][1], "%sdrei") ~= nil then
      formNum = mw.ustring.find(ship["name"][1], "%sdrei")
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
      form = "&#32;drei"
    elseif mw.ustring.find(ship["name"][1], "%sdue") ~= nil then
      formNum = mw.ustring.find(ship["name"][1], "%sdue")
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
      form = "&#32;due"
    elseif mw.ustring.find(ship["name"][1], "%sдва") ~= nil then
      formNum = mw.ustring.find(ship["name"][1], "%sдва")
      kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
      form = "&#32;два"
    elseif mw.ustring.find(ship["name"][1], "%sMk.II") ~= nil then
      if mw.ustring.find(ship["name"][1], "%sMk.II Mod.2") ~= nil then
        formNum = mw.ustring.find(ship["name"][1], "%sMk.II Mod.2")
        kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
        form = "&#32;Mk.II Mod.2"
      else
        formNum = mw.ustring.find(ship["name"][1], "%sMk.II")
        kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
        form = "&#32;Mk.II"
      end
    elseif mw.ustring.find(ship["name"][1], "%sреволюция") ~= nil then -- Gangut "Kai" exception
      kanji = mw.text.split(ship["name"][1], "%s")[1] .. "<br/>" .. mw.text.split(ship["name"][1], "%s")[2]
      form = ""
    else
      kanji = ship["name"][1]
      form = ""
    end
  else
    kanji = mw.ustring.sub(ship["name"][1], 1, formNum - 1)
    form = mw.ustring.sub(ship["name"][1], formNum, -1)
  end
  local JaName = ""
  if
    ship.name[3] == "Verniy" or ship.name[3] == "Gangut" or ship.name[3] == "Oktyabrskaya Revolyutsiya" or ship.name[3] == "Tashkent" or ship.name[3] == "Tashkent Kai" or ship.name[3] == "Gangut Dva"
   then -- Russian ship markup
    JaName =
      '<ruby lang="ru"><rb>' ..
      kanji ..
        '<span lang="ru">' ..
          form .. "</span>" .. '</rb><rp> (</rp><rt lang="ja">' .. ship["name"][2] .. "</rt><rp>) </rp></ruby>"
  else
    if ship.name[2] then
      JaName =
        '<ruby lang="ja"><rb>' ..
        kanji .. "<span>" .. form .. "</span>" .. "</rb><rp> (</rp><rt>" .. ship.name[2] .. "</rt><rp>) </rp></ruby>"
    else
      JaName = '<ruby lang="ja"><rb>' .. kanji .. "<span>" .. form .. "</span>" .. "</rb></ruby>"
    end
  end
  -- Summary of basic ship info
  local isCVE =
    ship.type == "Light Carrier" and type(ship.asw) == "table" and type(ship.asw[1]) == "number" and ship.asw[1] > 0
  local shipType =
    isCVE and string.format('<span class="explain" title="CVE">%s[[Category:Escort Carriers]]</span>', ship.type) or
    ship.type
  local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. ship.name[3] .. "</th></tr>"
  local class_string = ship.display_class and formatTooltip(ship.class, "Game library: " .. ship.display_class) or ship.class
  local row3 = '<tr><td colspan="4" style="text-align: center;">' .. class_string .. " " .. shipType .. "</td></tr>"
  local row4 =
    '<tr><td colspan="4"><hr style="border: 0; height: 1px; background-image: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.75), rgba(0,0,0,0));" /></td></tr>'
  -- Ship stats table
  local statLabel =
    '<th style="width: 65px; {{border-radius|12px 4px 4px 12px}} padding-left: 5px; padding-right: 5px; background-color: #eae1d1; color: #a3965c; text-align: right; vertical-align: baseline;">'
  local statBox =
    '<td style="{{border-radius|4px 12px 12px 4px}} padding-left: 5px; padding-right: 5px; border: 1px solid #a3965c; text-align: left; vertical-align: baseline;">'
  local hp = ship["hp"][1]
  local maxHp = ship["hp"][2]
  local HPinfo
  if maxHp then
    local marriedHp = getMarriedHp(hp, maxHp)
    local maxModHp = math.min(hp + 2, maxHp)
    local maxModMarriedHp = math.min(marriedHp + 2, maxHp)
    local hpSpan1 = hp == maxModHp and hp or formatTooltip(hp, string.format("%d with HP modernization", maxModHp))
    local hpSpan2 =
      formatTooltip(
      marriedHp,
      marriedHp == maxModMarriedHp and "Married" or string.format("Married, %d with HP modernization", maxModMarriedHp)
    )
    HPinfo = statLabel .. "HP [[File:IcoHP.png|HP]]</th>" .. statBox .. hpSpan1 .. "→" .. hpSpan2 .. "</td>"
  else
    HPinfo = statLabel .. "HP [[File:IcoHP.png|HP]]</th>" .. statBox .. hp .. "</td>"
  end
  local FPinfo =
    statLabel .. "FP [[File:IcoAtk.png|18px|Firepower]]</th>" .. statBox .. ship["fp"][1] .. "→" .. ship["fp"][2] .. "</td>"
  local row5 = "<tr>" .. HPinfo .. FPinfo .. "</tr>"
  -- Armor & Torpedo
  local Armorinfo =
    statLabel ..
    "ARM [[File:IcoArmor.png|Armor]]</th>" .. statBox .. ship["armor"][1] .. "→" .. ship["armor"][2] .. "</td>"
  local Torpedoinfo = statLabel .. "TORP[[File:IcoTorpedo.png|Torpedo]]</th>" .. statBox
  if ship["torpedo"] == 0 then
    Torpedoinfo = Torpedoinfo .. ship["torpedo"]
  else
    Torpedoinfo = Torpedoinfo .. ship["torpedo"][1] .. "→" .. ship["torpedo"][2]
  end
  local row6 = "<tr>" .. Armorinfo .. Torpedoinfo .. "</tr>"
  -- Evasion & AA
  local Evasioninfo =
    statLabel ..
    "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox .. ship["evasion"][1] .. "→" .. ship["evasion"][2] .. "</td>"
  local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox
  if ship["aa"] == 0 then
    AAinfo = AAinfo .. ship["aa"]
  else
    AAinfo = AAinfo .. ship["aa"][1] .. "→" .. ship["aa"][2]
  end
  local row7 = "<tr>" .. Evasioninfo .. AAinfo .. "</tr>"
  -- Planes & ASW
  local aircraftTotal = getTotalAircraft(ship)
  local Planeinfo = statLabel .. "PLA [[File:IcoAircraft.png|Aircraft]]</th>" .. statBox .. aircraftTotal .. "</td>"
  local ASWinfo = statLabel .. "ASW [[File:IcoASW.png|Anti-Submarine Warfare]]</th>" .. statBox
  if ship["asw"] == 0 then
    ASWinfo = ASWinfo .. ship["asw"]
  else
    ASWinfo = ASWinfo .. ship["asw"][1] .. "→" .. ship["asw"][2]
  end
  local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>"
  -- Speed & LOS
  local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>"
  local LOSinfo =
    statLabel ..
    "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox .. ship["los"][1] .. "→" .. ship["los"][2] .. "</td>"
  local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>"
  -- Range & Luck
  local Rangeinfo = statLabel .. "RGE [[File:IcoRange.png|Range]]</th>" .. statBox .. ship["range"] .. "</td>"
  local Luckinfo =
    statLabel .. "LUK [[File:IcoLuck.png|Luck]]</th>" .. statBox .. ship["luck"][1] .. "→" .. ship["luck"][2] .. "</td>"
  local row10 = "<tr>" .. Rangeinfo .. Luckinfo .. "</tr>"
  local StatTable =
    "<table>" .. row1 .. row2 .. row3 .. row4 .. row5 .. row6 .. row7 .. row8 .. row9 .. row10 .. "</table>"
  return StatTable
end

local function renderEquipment(ship)
  local equipHeader = ""
  local planeStyle = '<td style="width: 25%; white-space: nowrap; text-align: center; vertical-align: top;">'
  local equipStyle = ""
  if ship["aircraft"] ~= "" then
    local equipHeader1 =
      '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #efe6d7; color: #a3965c;">Aircraft</th>'
    local equipHeader2 =
      '<th style="width: 75%; white-space: nowrap; {{border-radius|4px 12px 12px 4px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
    equipHeader = equipHeader1 .. equipHeader2
    equipStyle = '<td style="width: 75%; max-width: 375px; text-align: center; vertical-align: baseline;">'
  else
    equipHeader =
      '<th style="white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
    equipStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
  end
  local numRows = math.max(4, U.isize(ship["equip"]))
  local equipTable = ""
  for i = 1, numRows, 1 do
    local equipRow = "<tr>"
    if ship["aircraft"] ~= "" then
      if ship["aircraft"][i] ~= nil then
        equipRow = equipRow .. planeStyle .. ship["aircraft"][i] .. "</td>" .. equipStyle
      else
        equipRow = equipRow .. planeStyle .. "</td>" .. equipStyle
      end
      if ship["equip"] ~= "" then
        if ship["equip"][i] == "" or ship["equip"][i] == "Unequipped" then
          equipRow = equipRow .. "-Unequipped-</td></tr>"
        elseif ship["equip"][i] == nil then
          equipRow = equipRow .. "''-Locked-''</td></tr>"
        else
          if string.find(ship["equip"][i], "%★") then
            local a, b = string.match(ship["equip"][i], "^(.+)★(.+)$")
            equipRow = equipRow .. "[[" .. a .. "|" .. a .. "★" .. b .. "]]</td></tr>"
          else
            equipRow = equipRow .. "[[" .. ship["equip"][i] .. "]]</td></tr>"
          end
        end
      else
        equipRow = equipRow .. "''-Locked-''</td></tr>"
      end
    else
      equipRow = equipRow .. equipStyle
      if ship["equip"] ~= "" then
        if ship["equip"][i] == "" or ship["equip"][i] == "Unequipped" then
          equipRow = equipRow .. "-Unequipped-</td></tr>"
        elseif ship["equip"][i] == nil then
          equipRow = equipRow .. "''Locked''</td></tr>"
        else
          if string.find(ship["equip"][i], "%★") then
            local a, b = string.match(ship["equip"][i], "^(.+)★(.+)$")
            equipRow = equipRow .. "[[" .. a .. "|" .. a .. "★" .. b .. "]]</td></tr>"
          else
            equipRow = equipRow .. "[[" .. ship["equip"][i] .. "]]</td></tr>"
          end
        end
      else
        equipRow = equipRow .. "''Locked''</td></tr>"
      end
    end
    equipTable = equipTable .. equipRow
  end
  return '<table style="width: 100%">' .. equipHeader .. equipTable .. "</table>"
end

local function renderModernization(ship)
  local RscHeader =
    '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
  local RscData2 = '<td colspan="3" style="width: 75%; white-space: nowrap; text-align: center;">'
  -- Construction info
  local constrheader = ""
  local constrdata = ""
  if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then
    constrheader = "Remodel Level"
    constrdata = ship["remodellv"]
  else
    constrheader = '<span class="explain-dash" title="h:mm">Build Time</span>'
    constrdata =
      type(ship.buildtime) ~= "table" and "??" or
      string.format(
        "%s (%s)",
        formatBuildtime(ship.buildtime[1]),
        ship.buildtime[2] and ship.buildtime[3] and "Normal, LSC" or ship.buildtime[2] and "Normal" or
          ship.buildtime[3] and "LSC" or
          "Unbuildable"
      )
  end
  local remodelinfo = ""
  if ship.remodelreq and ship.remodelreq ~= "" then
    remodelinfo =
      string.format(
      "[[File:IcoAmmo.png|18px|Ammo]] %d [[File:IcoSteel.png|18px|Steel]] %d",
      ship.remodelreq[2],
      ship.remodelreq[1]
    )
    if ship.remodelbp then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format("[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d", ship.remodelbp)
    end
    if ship.remodelcatapult then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format(
            "[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult|link=Prototype Flight Deck Catapult]] %d",
            ship.remodelcatapult
          )
    end
    if ship.remodelar then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.remodelar)
    end
    if ship.remodeldevmat or ship.remodelconmat or ship.remodelgunmat or ship.remodelairmat or ship.remodelarmmat or ship.remodelboiler or ship.overseastech or ship.remodelscrew then
      remodelinfo = remodelinfo .. "<br>"
    end
    if ship.remodeldevmat then
      remodelinfo =
        remodelinfo .. " " .. string.format("[[File:IcoDevmat.png|18px|Development Material]] %d", ship.remodeldevmat)
    end
    if ship.remodelconmat then
      remodelinfo =
        remodelinfo .. " " .. string.format("[[File:IcoConmat.png|18px|Construction Material]] %d", ship.remodelconmat)
    end
    if ship.remodelgunmat then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material|link=New Model Gun Development Material]] %d",
            ship.remodelgunmat
          )
    end
    if ship.remodelairmat then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material|link=New Model Aviation Development Material]] %d",
            ship.remodelairmat
          )
    end
    if ship.remodelarmmat then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material|link=New Model Armament Material]] %d",
            ship.remodelarmmat
          )
    end
    if ship.remodelboiler then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model High Temperature High Pressure Boiler.png|18px|New Model High Temperature High Pressure Boiler|link=New Model High Temperature High Pressure Boiler]] %d",
            ship.remodelboiler
          )
    end
    if ship.overseastech then
      remodelinfo =
        remodelinfo ..
        " " ..
          string.format(
            "[[File:Item Icon Latest Overseas Warship Technology.png|18px|Latest Overseas Warship Technology|link=Latest Overseas Warship Technology]] %d",
            ship.overseastech
          )
    end
    if ship.remodelscrew then
      remodelinfo =
        remodelinfo .. " " .. string.format("[[File:Item Icon Improvement Material.png|18px|Improvement Material|link=Improvement]] %d", ship.remodelscrew)
    end
  end
  -- Construction & Remodel
  local row11 = ""
  if constrheader == "Build Time" then
    row11 =
      "<tr>" .. RscHeader .. constrheader .. "</th>" .. RscData .. constrdata .. '</td><td colspan="2">&nbsp;</td></tr>'
  else
    row11 =
      "<tr>" ..
      RscHeader ..
        constrheader ..
          "</th>" ..
            RscData ..
              constrdata .. "</td>" .. RscHeader .. "Remodel Req</th>" .. RscData .. remodelinfo .. "</td></tr>"
  end
  -- Consumption
  local consfuel = "[[File:IcoFuel.png|18px|Fuel]] " .. ship["consumption"][1]
  local consammo = "[[File:IcoAmmo.png|18px|Ammo]] " .. ship["consumption"][2]
  local row12 = "<tr>" .. RscHeader .. "Consumption</th>" .. RscData .. consfuel .. " " .. consammo .. "</td>"
  -- Scrap Info
  local scrapfuel = "[[File:IcoFuel.png|18px|Fuel]] " .. ship["dismantle"][1]
  local scrapammo = "[[File:IcoAmmo.png|18px|Ammo]] " .. ship["dismantle"][2]
  local scrapsteel = "[[File:IcoSteel.png|18px|Steel]] " .. ship["dismantle"][3]
  local scrapbauxite = "[[File:IcoBauxite.png|18px|Bauxite]] " .. ship["dismantle"][4]
  local scrapinfo = scrapfuel .. " " .. scrapammo .. " " .. scrapsteel .. " " .. scrapbauxite
  local row12 = row12 .. RscHeader .. "Dismantle</th>" .. RscData .. scrapinfo .. "</td></tr>"
  -- Modernization
  local modFP = "[[File:IcoAtkRemodel.png|25px|Firepower]] " .. ship["modernization"][1]
  local modTorp = "[[File:IcoTorpedoRemodel.png|25px|Torpedo]] " .. ship["modernization"][2]
  local modAA = "[[File:IcoAARemodel.png|25px|Anti-Air]] " .. ship["modernization"][3]
  local modArmor = "[[File:IcoArmorRemodel.png|25px|Armor]] " .. ship["modernization"][4]
  local modLuck = ""
  if ship["modernization"][5] ~= nil and ship["modernization"][5] ~= "" then
    modLuck = "[[File:IcoLuckRemodel.png|25px|Luck]] " .. ship["modernization"][5]
  end
  local modInfo = modFP .. " " .. modTorp .. " " .. modAA .. " " .. modArmor
  if modLuck ~= "" then
    modInfo = modInfo .. " " .. modLuck
  end
  local row13 = "<tr>" .. RscHeader .. "Modernization</th>" .. RscData2 .. modInfo .. "</td></tr>"
  return row13 .. row11 .. row12
end

local function renderArtists(ship)
  local RscHeader =
    '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
  local illustrator =
    ship["artist"] ~= "Unknown" and ship["artist"] ~= "" and
    ("[[:Category:" .. ship["artist"] .. "|" .. ship["artist"] .. "]]") or
    "Unknown"
  local voiceactor =
    ship["seiyuu"] ~= "Unknown" and ship["seiyuu"] ~= "" and
    ("[[:Category:" .. ship["seiyuu"] .. "|" .. ship["seiyuu"] .. "]]") or
    "Unknown"
  return RscHeader ..
    "Illustrator</th>" .. RscData .. illustrator .. "</td>" .. RscHeader .. "Seiyuu</th>" .. RscData .. voiceactor .. "</td>"
end

local function renderCategories(ship)
  local categories = "[[Category:Ships]][[Category:" .. ship["class"] .. "]][[Category:" .. ship["type"] .. "s]]"
  if ship["artist"] ~= "Unknown" and ship["artist"] ~= "" then
    categories = categories .. "[[Category:" .. ship["artist"] .. "]]"
  end
  if ship["seiyuu"] ~= "Unknown" and ship["seiyuu"] ~= "" then
    categories = categories .. "[[Category:" .. ship["seiyuu"] .. "]]"
  end
  return categories
end

local function renderReversion(ship) --Copy paste mess by Chocolatecravinghobo. Shows information/cost for models that remodel/revert to a previous remodel
  --- Souya hardcode fix
  if ship["reversionto"] == "Souya " then
	ship.reversionto = ship.reversionto .. "(AGS)"
  end
  
  local reversionHeader = ""
  local reversionStyle = ""
  local reversionHeader =
      '<th colspan="4" style="width: 75%; white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #3baef5; color: #ffffff; vertical-align: baseline;"> Reversible to ' .. ship.reversionto .. "</th>"
  local reversionStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
  local RscHeader =
    '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">'
  local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">'
  -- Construction info
  local reversionlvheader = ""
  local reversionlvdata = ""
  if ship["reversionlv"] ~= nil and ship["reversionlv"] ~= "" then
    reversionlvheader = "Reversion Level"
    reversionlvdata = ship["reversionlv"]
  end
  local reversioninfo = ""
  if ship.reversionreq and ship.reversionreq ~= "" then
    reversioninfo =
      string.format(
      "[[File:IcoAmmo.png|18px|Ammo]] %d [[File:IcoSteel.png|18px|Steel]] %d",
      ship.reversionreq[2],
      ship.reversionreq[1]
    )
    if ship.reversionbp then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format("[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d", ship.reversionbp)
    end
    if ship.reversioncatapult then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format(
            "[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult|link=Prototype Flight Deck Catapult]] %d",
            ship.reversioncatapult
          )
    end
    if ship.reversionar then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.reversionar)
    end
    if ship.reversiondevmat or ship.reversionconmat or ship.reversiongunmat or ship.reversionairmat or ship.reversionarmmat or ship.reversionboiler or ship.reversionscrew then
      reversioninfo = reversioninfo .. "<br>"
    end
    if ship.reversiondevmat then
      reversioninfo =
        reversioninfo .. " " .. string.format("[[File:IcoDevmat.png|18px|Development Material]] %d", ship.reversiondevmat)
    end
    if ship.reversionconmat then
      reversioninfo =
        reversioninfo .. " " .. string.format("[[File:IcoConmat.png|18px|Construction Material]] %d", ship.reversionconmat)
    end
    if ship.reversiongunmat then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material|link=New Model Gun Development Material]] %d",
            ship.reversiongunmat
          )
    end
    if ship.reversionairmat then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material|link=New Model Aviation Development Material]] %d",
            ship.reversionairmat
          )
    end
    if ship.reversionarmmat then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material|link=New Model Armament Material]] %d",
            ship.reversionarmmat
          )
    end
    if ship.reversionboiler then
      reversioninfo =
        reversioninfo ..
        " " ..
          string.format(
            "[[File:Item Icon New Model High Temperature High Pressure Boiler.png|18px|New Model High Temperature High Pressure Boiler|link=New Model High Temperature High Pressure Boiler]] %d",
            ship.reversionboiler
          )
    end
    if ship.reversionscrew then
      reversioninfo = reversioninfo .. " " .. string.format(
        "[[File:Item Icon Improvement Material.png|18px|Improvement Material|link=Improvement]] %d",
        ship.reversionscrew
      )
    end
  end
  -- Reversion
  local row14 = ""
  local row15 = ""
  if ship.reversionlv ~= "" then
    row14 = "<tr>" .. reversionHeader .. "</tr>"-- .. reversionStyle
    row15 =
     "<tr>" ..
      RscHeader ..
        reversionlvheader ..
          "</th>" ..
            RscData ..
              reversionlvdata .. "</td>" .. RscHeader .. "Reversion Req</th>" .. RscData .. reversioninfo .. "</td></tr>"
  end
  return row14 .. row15
end


-- Converting to legacy data format

local ShipData = require("Module:Data/Ship")
local shipsByNo = require("Module:Collection/ShipsByNo")
local shipsById = require("Module:Collection/ShipsByApiId")
local Ship = require("Module:Ship")

local function minMaxStats(a, b)
  return a == nil and b == nil and {'??', '??'} or (a == false or a == 0) and (b == false or b == 0) and 0 or {a or '??', b or '??'}
end

local function trueIsOne(x)
  return x == true and 1 or x
end

local function loadShipData(key)
  local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[key] or key, "name") or {}).id] or key)
  local data = {}
  data.id = ship:id() or '???'
  data.no = ship:true_id()
  data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""}
  local class = ship:class()
  data.class = class and class:name() or "???"
  data.display_class = ship._display_class
  data.type = ship:formatted_type() or ""
  data.spd = ship:formatted_speed() or ""
  data.range = ship:formatted_range() or ""
  data.rarity = ship:rarity() or ""
  data.hp = minMaxStats(ship:hp(), ship:hp_max())
  data.fp = minMaxStats(ship:firepower(), ship:firepower_max())
  data.armor = minMaxStats(ship:armor(), ship:armor_max())
  data.torpedo = minMaxStats(ship:torpedo(), ship:torpedo_max())
  data.aa = minMaxStats(ship:aa(), ship:aa_max())
  data.luck = minMaxStats(ship:luck(), ship:luck_max())
  data.evasion = minMaxStats(ship:evasion(), ship:evasion_max())
  data.asw = minMaxStats(ship:asw(), ship:asw_max())
  data.los = minMaxStats(ship:los(), ship:los_max())
  data.aircraft = {}
  data.equip = {}
  for _, v in ipairs(ship._equipment) do
    table.insert(data.equip, (v.equipment == nil and '?' or v.equipment or '') .. (v.stars and string.format(' ★+%d', v.stars) or ''))
    table.insert(data.aircraft, v.size or "")
  end
  data.artist = ship:artist() or ""
  if data.artist == 'Shimada Humikane' then
	data.artist = 'Shimada Fumikane'
  end
  data.seiyuu = ship:voice_actor() or ""
  data.buildtime = {
    ship._build_time or "",
    ship._buildable == true or false,
    ship._buildable_lsc == true or false
  }
  data.remodellv = ship:remodel_level() or ""
  data.consumption = {ship:fuel() or "", ship:ammo() or ""}
  data.remodelreq = not ship._remodel_steel and not ship._remodel_ammo and '' or {ship._remodel_steel or 0, ship._remodel_ammo or 0}
  data.dismantle = {
    ship._scrap_fuel or 0,
    ship._scrap_ammo or 0,
    ship._scrap_steel or 0,
    ship._scrap_baux or 0,
  }
  data.modernization = {
    ship._firepower_mod or 0,
    ship._torpedo_mod or 0,
    ship._aa_mod or 0,
    ship._armor_mod or 0,
    ship._luck_mod or '',
  }
  data.remodelbp = trueIsOne(ship._remodel_blueprint)
  data.remodelcatapult = trueIsOne(ship._remodel_catapult)
  data.remodelar = trueIsOne(ship._remodel_report)
  data.remodelgunmat = trueIsOne(ship._remodel_gunmat)
  data.remodelairmat = trueIsOne(ship._remodel_airmat)
  data.remodelarmmat = trueIsOne(ship._remodel_armament)
  data.remodelboiler = trueIsOne(ship._remodel_boiler)
  data.overseastech  = trueIsOne(ship._remodel_overseas)
  data.remodeldevmat = trueIsOne(ship._remodel_development_material)
  data.remodelconmat = trueIsOne(ship._remodel_construction_material)
  data.remodelscrew = trueIsOne(ship._remodel_screw)
  
  data.reversible = trueIsOne(ship._reversible)
  data.reversionto = ship:remodel_to() or ""
  data.reversionto = data.reversionto:gsub("/", " ")
  data.reversionbp = trueIsOne(ship._remodel_to_blueprint)
  data.reversionlv = ship:remodel_to_level() or ""
  data.reversionreq = not ship._remodel_to_steel and not ship._remodel_to_ammo and '' or {ship._remodel_to_steel or 0, ship._remodel_to_ammo or 0}
  data.reversionbp = trueIsOne(ship._remodel_to_blueprint)
  data.reversioncatapult = trueIsOne(ship._remodel_to_catapult)
  data.reversionar = trueIsOne(ship._remodel_to_report)
  data.reversiongunmat = trueIsOne(ship._remodel_to_gunmat)
  data.reversionairmat = trueIsOne(ship._remodel_to_airmat)
  data.reversionarmmat = trueIsOne(ship._remodel_to_armament)
  data.reversionboiler = trueIsOne(ship._remodel_to_boiler)
  data.reversiondevmat = trueIsOne(ship._remodel_to_development_material)
  data.reversionconmat = trueIsOne(ship._remodel_to_construction_material)
  data.reversionscrew = trueIsOne(ship._remodel_to_screw)
  return data
end

local function render(frame)
  local ship = loadShipData(frame.args[1])
  return '<div style="display:inline-block;vertical-align:top"><table style="{{border-radius|10px 10px 10px 10px}} border:1px solid #aaaaaa;min-width:495px"><tr><td>' ..
    renderStats(ship) ..
      "</td></tr><tr><td>" ..
        renderEquipment(ship) ..
          '<table style="width:100%">' ..
            renderModernization(ship) ..
              renderArtists(ship) .. 
            	renderReversion(ship) .. "</table></td></tr></table></div>" .. renderCategories(ship)
end

local function test()
  return render({args = {"Brooklyn"}})
end

-- print(p.test())

return {KanmusuInfo = render, test = test}