Changes

kanmusubox split into subroutines
Line 5: Line 5:  
function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template
 
function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template
 
     local shipNum = frame.args[1]
 
     local shipNum = frame.args[1]
 +
    -- Getting ship ID, number, & info
 
     if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
 
     if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
 
     shipNum = shipdb.findID(frame)
 
     shipNum = shipdb.findID(frame)
Line 10: Line 11:     
     local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
 
     local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
 +
   
 +
    local upperTable = shipmodule.makeStatBox(frame)
 +
    local DetailTable = '<table style="width: 100%">' .. shipmodule.EquipmentBox(frame) .. shipmodule.ModernizationBox(frame) .. shipmodule.getArtVoice(frame) .. '</table>'
 +
 +
    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">'
 +
    shipInfoBox = shipInfoBox .. '<tr><td>' .. upperTable .. '</td></tr>'
 +
    shipInfoBox = shipInfoBox .. '<tr><td>' .. DetailTable .. '</td></tr></table></div>' .. shipmodule.createCategories(frame)
 +
 +
    return shipInfoBox
 +
end
 +
 +
function shipmodule.makeStatBox(frame)
 +
local shipNum = frame.args[1]
 +
    -- Getting ship ID, number, & info
 +
    if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
 +
    shipNum = shipdb.findID(frame)
 +
end
    +
    local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
 +
-- Top half of infobox
 +
    -- Cards & Banners
 
     local CardImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'Card.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Card]]</div>'
 
     local CardImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'Card.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Card]]</div>'
 
     local CardDmgImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'CardDmg.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Damaged Card]]</div>'
 
     local CardDmgImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'CardDmg.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Damaged Card]]</div>'
Line 21: Line 42:  
     local row1 = '<tr>' .. Cards .. '<th style="text-align: center;">' .. shipNum .. '</th>' .. Banners .. '</tr>'
 
     local row1 = '<tr>' .. Cards .. '<th style="text-align: center;">' .. shipNum .. '</th>' .. Banners .. '</tr>'
    +
    -- Formatting Japanese
 
     local kanji, form
 
     local kanji, form
 
local formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "[改甲航]")
 
local formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "[改甲航]")
Line 59: Line 81:  
end
 
end
    +
    -- Summary of basic ship info
 
     local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. shipmodule.data[shipNum]["name"][3] .. '</th></tr>'
 
     local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. shipmodule.data[shipNum]["name"][3] .. '</th></tr>'
 
     local row3 = '<tr><td colspan="4" style="text-align: center;">' .. shipmodule.data[shipNum]["class"] .. ' Class ' .. shipmodule.data[shipNum]["type"] .. '</td></tr>'
 
     local row3 = '<tr><td colspan="4" style="text-align: center;">' .. shipmodule.data[shipNum]["class"] .. ' Class ' .. shipmodule.data[shipNum]["type"] .. '</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>'
 
     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 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 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;">'
 
+
    -- HP & FP
 
     local HPinfo = statLabel .. 'HP [[File:IcoHP.png|HP]]</th>' .. statBox .. shipmodule.data[shipNum]["hp"] .. '</td>'
 
     local HPinfo = statLabel .. 'HP [[File:IcoHP.png|HP]]</th>' .. statBox .. shipmodule.data[shipNum]["hp"] .. '</td>'
 
     local FPinfo = statLabel .. 'ATK [[File:IcoAtk.png|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>'
 
     local FPinfo = statLabel .. 'ATK [[File:IcoAtk.png|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>'
Line 71: Line 95:  
     local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>'
 
     local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>'
    +
    -- Armor & Torpedo
 
     local Armorinfo = statLabel .. 'DEF [[File:IcoArmor.png|Armor]]</th>' .. statBox .. shipmodule.data[shipNum]["armor"][1] .. '→' .. shipmodule.data[shipNum]["armor"][2] .. '</td>'
 
     local Armorinfo = statLabel .. 'DEF [[File:IcoArmor.png|Armor]]</th>' .. statBox .. shipmodule.data[shipNum]["armor"][1] .. '→' .. shipmodule.data[shipNum]["armor"][2] .. '</td>'
 
     local Torpedoinfo = statLabel .. 'TORP [[File:IcoTorpedo.png|Torpedo]]</th>' .. statBox
 
     local Torpedoinfo = statLabel .. 'TORP [[File:IcoTorpedo.png|Torpedo]]</th>' .. statBox
Line 81: Line 106:  
     local row6 = '<tr>' .. Armorinfo .. Torpedoinfo .. '</tr>'
 
     local row6 = '<tr>' .. Armorinfo .. Torpedoinfo .. '</tr>'
    +
    -- Evasion & AA
 
     local Evasioninfo = statLabel .. 'EVA [[File:IcoEvasion.png|Evasion]]</th>' .. statBox .. shipmodule.data[shipNum]["evasion"][1] .. '→' .. shipmodule.data[shipNum]["evasion"][2] .. '</td>'
 
     local Evasioninfo = statLabel .. 'EVA [[File:IcoEvasion.png|Evasion]]</th>' .. statBox .. shipmodule.data[shipNum]["evasion"][1] .. '→' .. shipmodule.data[shipNum]["evasion"][2] .. '</td>'
 
     local AAinfo = statLabel .. 'AA [[File:IcoAA.png|Anti-Air]]</th>' .. statBox
 
     local AAinfo = statLabel .. 'AA [[File:IcoAA.png|Anti-Air]]</th>' .. statBox
Line 91: Line 117:  
     local row7 = '<tr>' .. Evasioninfo .. AAinfo .. '</tr>'
 
     local row7 = '<tr>' .. Evasioninfo .. AAinfo .. '</tr>'
    +
    -- Planes & ASW
 
     local aircraftTotal = 0
 
     local aircraftTotal = 0
 
     if shipmodule.data[shipNum]["aircraft"] ~= "" then
 
     if shipmodule.data[shipNum]["aircraft"] ~= "" then
Line 115: Line 142:  
     local row8 = '<tr>' .. Planeinfo .. ASWinfo .. '</tr>'
 
     local row8 = '<tr>' .. Planeinfo .. ASWinfo .. '</tr>'
    +
    -- Speed & LOS
 
     local Speedinfo = statLabel .. 'SPD [[File:IcoSpeed.png|Speed]]</th>' .. statBox .. shipmodule.data[shipNum]["spd"] .. '</td>'
 
     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 LOSinfo = statLabel .. 'LOS [[File:IcoLOS.png|Line of Sight]]</th>' .. statBox .. shipmodule.data[shipNum]["los"][1] .. '→' .. shipmodule.data[shipNum]["los"][2] .. '</td>'
Line 120: Line 148:  
     local row9 = '<tr>' .. Speedinfo .. LOSinfo .. '</tr>'
 
     local row9 = '<tr>' .. Speedinfo .. LOSinfo .. '</tr>'
    +
    -- Range & Luck
 
     local Rangeinfo = statLabel .. 'RGE [[File:IcoRange.png|Range]]</th>' .. statBox .. shipmodule.data[shipNum]["range"] .. '</td>'
 
     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 Luckinfo = statLabel .. 'LUK [[File:IcoLuck.png|Luck]]</th>' .. statBox .. shipmodule.data[shipNum]["luck"][1] .. '→' .. shipmodule.data[shipNum]["luck"][2] .. '</td>'
Line 125: Line 154:  
     local row10 = '<tr>' .. Rangeinfo .. Luckinfo .. '</tr>'
 
     local row10 = '<tr>' .. Rangeinfo .. Luckinfo .. '</tr>'
 
     local StatTable = '<table>' .. row1 .. row2 .. row3 .. row4 .. row5 .. row6 .. row7 .. row8 .. row9 .. row10 .. '</table>'
 
     local StatTable = '<table>' .. row1 .. row2 .. row3 .. row4 .. row5 .. row6 .. row7 .. row8 .. row9 .. row10 .. '</table>'
 +
    return StatTable
 +
end
 +
 +
function shipmodule.EquipmentBox(frame)
 +
    local shipNum = frame.args[1]
 +
    -- Getting ship ID, number, & info
 +
    if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
 +
    shipNum = shipdb.findID(frame)
 +
end
 +
 +
    local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
 +
 +
    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;">'
 +
 +
    -- Equipment table
 +
    local equipHeader = ''
 +
    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>'}
 +
    for i = 1, 4, 1 do
 +
        if shipmodule.data[shipNum]["aircraft"] ~= "" then
 +
        if shipmodule.data[shipNum]["aircraft"][i] ~= nil then
 +
        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
 +
    return equipHeader .. equip[1] .. equip[2] .. equip[3] .. equip[4]
 +
end
 +
 +
function shipmodule.ModernizationBox(frame)
 +
    local shipNum = frame.args[1]
 +
    -- Getting ship ID, number, & info
 +
    if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
 +
    shipNum = shipdb.findID(frame)
 +
end
   −
     -- Upper part complete
+
     local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
    
     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 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;">'
Line 132: Line 234:  
     local RscData2 = '<td colspan="3" style="white-space: nowrap; text-align: center;">'
 
     local RscData2 = '<td colspan="3" style="white-space: nowrap; text-align: center;">'
    +
    -- Construction info
 
     local constrheader = ''
 
     local constrheader = ''
 
     local constrdata = ''
 
     local constrdata = ''
Line 147: Line 250:  
     end
 
     end
    +
    -- Remodel info
 
     local remodelsteel = '[[File:IcoSteel.png|18px|Steel]]'
 
     local remodelsteel = '[[File:IcoSteel.png|18px|Steel]]'
 
     local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]'
 
     local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]'
Line 160: Line 264:  
     end
 
     end
    +
    -- Construction & Remodel
 
     local row11 = ''
 
     local row11 = ''
 
     if constrheader == 'Build Time' then
 
     if constrheader == 'Build Time' then
Line 167: Line 272:  
     end
 
     end
    +
    -- Consumption
 
     local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["consumption"][1]
 
     local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["consumption"][1]
 
     local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["consumption"][2]
 
     local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["consumption"][2]
Line 172: Line 278:  
     local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>'
 
     local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>'
    +
    -- Scrap Info
 
     local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["dismantle"][1]
 
     local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["dismantle"][1]
 
     local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["dismantle"][2]
 
     local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["dismantle"][2]
Line 179: Line 286:  
     local row12 = row12 .. RscHeader .. 'Dismantle</th>' .. RscData .. scrapinfo .. '</td></tr>'
 
     local row12 = row12 .. RscHeader .. 'Dismantle</th>' .. RscData .. scrapinfo .. '</td></tr>'
    +
    -- Modernization
 
     local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipmodule.data[shipNum]["modernization"][1]
 
     local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipmodule.data[shipNum]["modernization"][1]
 
     local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipmodule.data[shipNum]["modernization"][2]
 
     local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipmodule.data[shipNum]["modernization"][2]
Line 194: Line 302:  
     end
 
     end
 
     local row13 = '<tr>' .. RscHeader .. 'Modernization</th>' .. RscData2 .. modInfo .. '</td></tr>'
 
     local row13 = '<tr>' .. RscHeader .. 'Modernization</th>' .. RscData2 .. modInfo .. '</td></tr>'
 +
    return row13 .. row11 .. row12
 +
end
    +
function shipmodule.getArtVoice(frame)
 +
local shipNum = frame.args[1]
 +
    -- Getting ship ID, number, & info
 +
    if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
 +
    shipNum = shipdb.findID(frame)
 +
end
 +
 +
    local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
 +
    -- Artist & Voice Info
 +
    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 illustrator = ''
 
     local illustrator = ''
 
     local voiceactor = ''
 
     local voiceactor = ''
    local cat = '[[Category:Ships]]'
   
     if shipmodule.data[shipNum]["artist"] ~= "Unknown" and shipmodule.data[shipNum]["artist"] ~= "" then
 
     if shipmodule.data[shipNum]["artist"] ~= "Unknown" and shipmodule.data[shipNum]["artist"] ~= "" then
 
         illustrator = '[[:Category:' .. shipmodule.data[shipNum]["artist"] .. '|' .. shipmodule.data[shipNum]["artist"] .. ']]'
 
         illustrator = '[[:Category:' .. shipmodule.data[shipNum]["artist"] .. '|' .. shipmodule.data[shipNum]["artist"] .. ']]'
Line 211: Line 332:  
     end
 
     end
 
     local row14 = '<tr>' .. RscHeader .. 'Artist</th>' .. RscData .. illustrator .. '</td>' .. RscHeader .. 'Seiyuu</th>' .. RscData .. voiceactor .. '</td></tr>'
 
     local row14 = '<tr>' .. RscHeader .. 'Artist</th>' .. RscData .. illustrator .. '</td>' .. RscHeader .. 'Seiyuu</th>' .. RscData .. voiceactor .. '</td></tr>'
 +
    return row14
 +
end
   −
    local equipHeader = ''
+
function shipmodule.createCategories(frame)
     local planeStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: top;">'
+
local shipNum = frame.args[1]
     local equipStyle = ''
+
    -- Getting ship ID, number, & info
    if shipmodule.data[shipNum]["aircraft"] ~= "" then
+
     if (tonumber(string.sub(shipNum, 1, 3)) == nil and string.sub(shipNum, 1, 4) ~= "Mist" ) then -- if given a name instead of ID, this searches the db for the ship's corresponding ID
        equipHeader1 = '<th style="white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #efe6d7; color: #a3965c;">Aircraft</th>'
+
    shipNum = shipdb.findID(frame)
        equipHeader2 = '<th colspan="3" style="white-space: nowrap; {{border-radius|4px 12px 12px 4px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>'
+
end
        equipHeader = equipHeader1 .. equipHeader2
+
 
        equipStyle = '<td colspan="3" style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
+
     local shipInfo = assert(shipmodule.data[shipNum], "This KanMusu ID doesn't contains any data")
    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>'
+
local cat = '[[Category:Ships]]'
        equipStyle = '<td colspan="4" style="white-space: nowrap; text-align: center; vertical-align: baseline;">'
+
cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["class"] .. ' Class]][[Category:' .. shipmodule.data[shipNum]["type"] .. 's]]'
 +
if shipmodule.data[shipNum]["artist"] ~= "Unknown" and shipmodule.data[shipNum]["artist"] ~= "" then
 +
      cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["artist"] .. ']]'
 
     end
 
     end
 
+
     if shipmodule.data[shipNum]["seiyuu"] ~= "Unknown" and shipmodule.data[shipNum]["seiyuu"] ~= "" then
     local equip = {'<tr>', '<tr>', '<tr>', '<tr>'}
+
         cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["seiyuu"] .. ']]'
    for i = 1, 4, 1 do
  −
        if shipmodule.data[shipNum]["aircraft"] ~= "" then
  −
        if shipmodule.data[shipNum]["aircraft"][i] ~= nil then
  −
        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
 
     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 shipInfoBox = '<div style="display: inline-block; vertical-align: top;"><table style="{{border-radius|10px 10px 10px 10px}} border: 1px solid #aaaaaa; min-width: 495px">'
  −
    shipInfoBox = shipInfoBox .. '<tr><td>' .. StatTable .. '</td></tr>'
  −
    shipInfoBox = shipInfoBox .. '<tr><td>' .. DetailTable .. '</td></tr></table></div>' .. cat
  −
  −
    return shipInfoBox
   
end
 
end
  
5,421

edits