Line 1: |
Line 1: |
| + | local U = require('Module:Core') |
| + | |
| + | local ShipList = {} |
| + | |
| + | function ShipList.findID(frame) |
| + | for id, data in pairs(ShipList.KanmusuData) do |
| + | if ShipList.KanmusuData[id].name[3] == frame.args[1] then |
| + | return id |
| + | end |
| + | end |
| + | return "NotInDB" |
| + | end |
| + | |
| + | function ShipList.getSortedIDList() |
| + | local IDList = {} |
| + | for id, data in pairs(ShipList.KanmusuData) do |
| + | IDList[#IDList + 1] = id |
| + | local x = #IDList |
| + | while x > 1 and IDList[x] < IDList[x - 1] do |
| + | IDList[x - 1], IDList[x] = IDList[x], IDList[x - 1] |
| + | x = x - 1 |
| + | end |
| + | end |
| + | return IDList |
| + | end |
| + | |
| + | function ShipList.TotalAircraft(frame) |
| + | local shipID = frame.args[1] |
| + | -- if tonumber(shipID) == nil then |
| + | -- shipID = ShipList.findID(frame) |
| + | -- end |
| + | local ship = ShipList.KanmusuData[shipID] |
| + | local total = 0 |
| + | if ship.aircraft ~= "" then |
| + | for i, planes 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 |
| + | |
| + | function ShipList.getWikiPage(id) |
| + | --finding name of wiki page of ship |
| + | shipname = ShipList.KanmusuData[id]["name"][3] |
| + | pagename = shipname |
| + | if string.sub(id,1,-2) == "Mist" then -- fleet of fog check |
| + | if string.sub(id, -1) == '1' then |
| + | pagename = 'Iona_(fog)' |
| + | elseif string.sub(id, -1) == '2' then |
| + | pagename = 'Takao_(fog)' |
| + | elseif string.sub(id, -1) == '3' then |
| + | pagename = 'Haruna_(fog)' |
| + | else |
| + | pagename = 'Fleet of Fog' |
| + | end |
| + | else |
| + | shipbasename = mw.text.split(shipname, '%s')[1] |
| + | --Prinz/Graf/Teste check (for ship names that are 2 or more words) |
| + | if mw.text.split(shipname, '%s')[2] ~= nil and not (mw.text.split(shipname, '%s')[2] == "Kai" or |
| + | mw.text.split(shipname, '%s')[2] == "A" or mw.text.split(shipname, '%s')[2] == "Zwei" or |
| + | mw.text.split(shipname, '%s')[2] == "Drei" or mw.text.split(shipname, '%s')[2] == "Due") then |
| + | shipbasename = shipbasename .. ' ' .. mw.text.split(shipname, '%s')[2] |
| + | end |
| + | pagename = shipbasename |
| + | end |
| + | return pagename |
| + | end |
| + | |
| + | ShipList.KanmusuData = mw.loadData('Module:Data/Ship') |
| + | |
| + | local shipdb = ShipList |
| + | |
| local shipmodule = {} | | local shipmodule = {} |
− | local shipdb = require("Module:ShipDatabase")
| + | |
| shipmodule.data = shipdb.KanmusuData | | shipmodule.data = shipdb.KanmusuData |
| | | |
Line 22: |
Line 98: |
| function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template | | function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template |
| local shipNum = shipmodule.getIDNum(frame) | | local shipNum = shipmodule.getIDNum(frame) |
− |
| |
| local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") | | local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") |
− |
| |
| local upperTable = shipmodule.makeStatBox(frame) | | local upperTable = shipmodule.makeStatBox(frame) |
− | local DetailTable = shipmodule.EquipmentBox(frame) .. shipmodule.ModernizationBox(frame) .. shipmodule.getArtVoice(frame) | + | local DetailTable = shipmodule.EquipmentBox(frame) .. '<table style="width: 100%">' .. 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">' | | 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>' .. upperTable .. '</td></tr>' |
| shipInfoBox = shipInfoBox .. '<tr><td>' .. DetailTable .. '</td></tr></table></div>' .. shipmodule.createCategories(frame) | | shipInfoBox = shipInfoBox .. '<tr><td>' .. DetailTable .. '</td></tr></table></div>' .. shipmodule.createCategories(frame) |
− |
| |
| return shipInfoBox | | return shipInfoBox |
| end | | end |
Line 39: |
Line 111: |
| | | |
| local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") | | local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") |
− | -- Top half of infobox | + | |
− | -- Cards & Banners
| + | local shipName = shipInfo.name[3] |
− | local CardImg = '<div style="text-align: center; width: 218px; height:300px;">[[File:KanMusu' .. shipNum .. 'Card.png|218px|' .. shipmodule.data[shipNum]["name"][3] .. ' Card]]</div>' | + | local CardImg = '<div style="text-align: center; width: 218px; height:300px;">[[File:{{#setmainimage:Ship Card ' .. shipName .. '.png}}|218x300px|' .. shipName .. ' Card]]</div>' |
− | local CardDmgImg = '<div style="text-align: center; width: 218px; height:300px;">[[File:KanMusu' .. shipNum .. 'CardDmg.png|218px|' .. shipmodule.data[shipNum]["name"][3] .. ' Damaged Card]]</div>' | + | local CardDmgImg = '<div style="text-align: center; width: 218px; height:300px;">[[File:Ship Card ' .. shipName .. ' Damaged.png|218x300px|' .. shipName .. ' Damaged Card]]</div>' |
− | local BannerImg = '<div style="text-align: center; width: 160px; height:40px;">[[File:KanMusu' .. shipNum .. 'Banner.png|160px|' .. shipmodule.data[shipNum]["name"][3] .. ' Banner|class=imageCenter]]</div>' | + | local BannerImg = '<div style="text-align: center; width: 160px; height:40px;">[[File:Ship Banner ' .. shipName .. '.png|160px|' .. shipName .. ' Banner|class=imageCenter]]</div>' |
− | local BannerDmgImg = '<div style="text-align: center; width: 160px; height:40px;">[[File:KanMusu' .. shipNum .. 'BannerDmg.png|160px|' .. shipmodule.data[shipNum]["name"][3] .. ' Damaged Banner|class=imageCenter]]</div>' | + | local BannerDmgImg = '<div style="text-align: center; width: 160px; height:40px;">[[File:Ship Banner ' .. shipName .. ' Damaged.png|160px|' .. shipName .. ' Damaged Banner|class=imageCenter]]</div>' |
| | | |
| local Cards = '<td rowspan="10" style="text-align: center; width: 218px; height:300px;">' .. frame:extensionTag('slideshow', CardImg .. CardDmgImg, { | | local Cards = '<td rowspan="10" style="text-align: center; width: 218px; height:300px;">' .. frame:extensionTag('slideshow', CardImg .. CardDmgImg, { |
Line 53: |
Line 125: |
| }) .. '</td>' | | }) .. '</td>' |
| | | |
− | local row1 = '<tr>' .. Cards .. '<th style="text-align: center;">' .. shipNum .. '</th>' .. Banners .. '</tr>' | + | local sortNo = shipInfo.sortno or U.split(shipNum, '-')[1] or '?' |
| + | local row1 = '<tr>' .. Cards .. '<th style="text-align: center;">' .. sortNo .. '</th>' .. Banners .. '</tr>' |
| | | |
| -- Formatting Japanese | | -- Formatting Japanese |
Line 193: |
Line 266: |
| equipHeader2 = '<th style="width: 75%; white-space: nowrap; {{border-radius|4px 12px 12px 4px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>' | | 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 | | equipHeader = equipHeader1 .. equipHeader2 |
− | equipStyle = '<td style="width: 75%; white-space: nowrap; text-align: center; vertical-align: baseline;">' | + | equipStyle = '<td style="width: 75%; max-width: 375px; text-align: center; vertical-align: baseline;">' |
| else | | else |
| equipHeader = '<th style="white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>' | | 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;">' | | equipStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">' |
− | end
| |
− |
| |
− | local numRows = 4
| |
− | -- 346 Musashi Kai Ni
| |
− | -- 353 Ise Kai Ni
| |
− | -- 354 Hyuuga Kai Ni
| |
− | if shipNum == "346" or shipNum == "353" or shipNum == "354" or shipNum == "404" or shipNum == "409" then
| |
− | numRows = 5
| |
| end | | end |
| | | |
| + | local numRows = math.max(4, U.isize(shipmodule.data[shipNum]["equip"])) |
| local equipTable = '' | | local equipTable = '' |
| for i = 1, numRows, 1 do | | for i = 1, numRows, 1 do |
Line 258: |
Line 324: |
| function shipmodule.ModernizationBox(frame) | | function shipmodule.ModernizationBox(frame) |
| local shipNum = shipmodule.getIDNum(frame) | | local shipNum = shipmodule.getIDNum(frame) |
− |
| |
| local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") | | local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") |
| | | |
Line 269: |
Line 334: |
| local constrdata = '' | | local constrdata = '' |
| | | |
− | if shipmodule.data[shipNum]["remodellv"] ~= nil and shipmodule.data[shipNum]["remodellv"] ~= "" then | + | if shipInfo["remodellv"] ~= nil and shipInfo["remodellv"] ~= "" then |
| constrheader = 'Remodel Level' | | constrheader = 'Remodel Level' |
− | constrdata = shipmodule.data[shipNum]["remodellv"] | + | constrdata = shipInfo["remodellv"] |
| else | | else |
| constrheader = 'Build Time' | | constrheader = 'Build Time' |
− | if shipmodule.data[shipNum]["buildtime"] == nil or shipmodule.data[shipNum]["buildtime"] == "" then | + | if shipInfo["buildtime"] == nil or shipInfo["buildtime"] == "" then |
| constrdata = 'Not Buildable' | | constrdata = 'Not Buildable' |
| else | | else |
− | constrdata = shipmodule.data[shipNum]["buildtime"] | + | constrdata = shipInfo["buildtime"] |
| end | | end |
| end | | end |
| | | |
| local remodelinfo = '' | | local remodelinfo = '' |
− | if shipmodule.data[shipNum]["remodelreq"] ~= "" then | + | if shipInfo.remodelreq and shipInfo.remodelreq ~= '' then |
− | local steel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipmodule.data[shipNum]["remodelreq"][1] | + | remodelinfo = string.format('[[File:IcoSteel.png|18px|Steel]] %d [[File:IcoAmmo.png|18px|Ammo]] %d', shipInfo.remodelreq[1], shipInfo.remodelreq[2]) |
− | local ammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["remodelreq"][2] | + | if shipInfo.remodelbp then |
− | remodelinfo = steel .. ' ' .. ammo | + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d', shipInfo.remodelbp) |
− | local items = shipmodule.RemodelBlueprintChk(shipmodule.data[shipNum]["remodelreq"][3], shipNum) | + | end |
− | if items then | + | if shipInfo.remodelcatapult then |
− | remodelinfo = remodelinfo .. ' ' .. items
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult]] %d', shipInfo.remodelcatapult) |
| + | end |
| + | if shipInfo.remodelar then |
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon Action Report.png|25px|Action Report]] %d', shipInfo.remodelar) |
| + | end |
| + | if shipInfo.remodeldevmat or shipInfo.remodelconmat or shipInfo.remodelgunmat or shipInfo.remodelairmat then |
| + | remodelinfo = remodelinfo .. '<br>' |
| + | end |
| + | if shipInfo.remodeldevmat then |
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:IcoDevmat.png|18px|Development Material]] %d', shipInfo.remodeldevmat) |
| + | end |
| + | if shipInfo.remodelconmat then |
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:IcoConmat.png|18px|Construction Material]] %d', shipInfo.remodelconmat) |
| + | end |
| + | if shipInfo.remodelgunmat then |
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material]] %d', shipInfo.remodelgunmat) |
| + | end |
| + | if shipInfo.remodelairmat then |
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material]] %d', shipInfo.remodelairmat) |
| + | end |
| + | if shipInfo.remodelarmmat then |
| + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material]] %d', shipInfo.remodelarmmat) |
| end | | end |
| end | | end |
− | | + | |
| -- Construction & Remodel | | -- Construction & Remodel |
| local row11 = '' | | local row11 = '' |
Line 301: |
Line 387: |
| | | |
| -- Consumption | | -- Consumption |
− | local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["consumption"][1] | + | local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipInfo["consumption"][1] |
− | local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["consumption"][2] | + | local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipInfo["consumption"][2] |
| | | |
| local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>' | | local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>' |
| | | |
| -- Scrap Info | | -- Scrap Info |
− | local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["dismantle"][1] | + | local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipInfo["dismantle"][1] |
− | local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["dismantle"][2] | + | local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipInfo["dismantle"][2] |
− | local scrapsteel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipmodule.data[shipNum]["dismantle"][3] | + | local scrapsteel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipInfo["dismantle"][3] |
− | local scrapbauxite = '[[File:IcoBauxite.png|18px|Bauxite]] ' .. shipmodule.data[shipNum]["dismantle"][4] | + | local scrapbauxite = '[[File:IcoBauxite.png|18px|Bauxite]] ' .. shipInfo["dismantle"][4] |
| local scrapinfo = scrapfuel .. ' ' .. scrapammo .. ' ' .. scrapsteel .. ' ' .. scrapbauxite | | local scrapinfo = scrapfuel .. ' ' .. scrapammo .. ' ' .. scrapsteel .. ' ' .. scrapbauxite |
| local row12 = row12 .. RscHeader .. 'Dismantle</th>' .. RscData .. scrapinfo .. '</td></tr>' | | local row12 = row12 .. RscHeader .. 'Dismantle</th>' .. RscData .. scrapinfo .. '</td></tr>' |
| | | |
| -- Modernization | | -- Modernization |
− | local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipmodule.data[shipNum]["modernization"][1] | + | local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipInfo["modernization"][1] |
− | local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipmodule.data[shipNum]["modernization"][2] | + | local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipInfo["modernization"][2] |
− | local modAA = '[[File:IcoAARemodel.png|25px|Anti-Air]] ' .. shipmodule.data[shipNum]["modernization"][3] | + | local modAA = '[[File:IcoAARemodel.png|25px|Anti-Air]] ' .. shipInfo["modernization"][3] |
− | local modArmor = '[[File:IcoArmorRemodel.png|25px|Armor]] ' .. shipmodule.data[shipNum]["modernization"][4] | + | local modArmor = '[[File:IcoArmorRemodel.png|25px|Armor]] ' .. shipInfo["modernization"][4] |
| local modLuck = '' | | local modLuck = '' |
− | if shipmodule.data[shipNum]["modernization"][5] ~= nil and shipmodule.data[shipNum]["modernization"][5] ~= "" then | + | if shipInfo["modernization"][5] ~= nil and shipInfo["modernization"][5] ~= "" then |
− | -- modLuck = '[[File:IcoLuck|18px|Luck]] ' .. shipmodule.data[shipNum]["modernization"][5] | + | -- modLuck = '[[File:IcoLuck|18px|Luck]] ' .. shipInfo["modernization"][5] |
− | modLuck = '[[File:IcoLuckRemodel.png|25px|Luck]] ' .. shipmodule.data[shipNum]["modernization"][5] -- Just a placeholder | + | modLuck = '[[File:IcoLuckRemodel.png|25px|Luck]] ' .. shipInfo["modernization"][5] -- Just a placeholder |
| end | | end |
| | | |
Line 330: |
Line 416: |
| end | | end |
| local row13 = '<tr>' .. RscHeader .. 'Modernization</th>' .. RscData2 .. modInfo .. '</td></tr>' | | local row13 = '<tr>' .. RscHeader .. 'Modernization</th>' .. RscData2 .. modInfo .. '</td></tr>' |
− | return '<table style="width: 100%">' .. row13 .. row11 .. row12 .. '</table>' | + | -- return '<table style="width: 100%">' .. row13 .. row11 .. row12 .. '</table>' |
| + | return row13 .. row11 .. row12 |
| end | | end |
| | | |
| function shipmodule.getArtVoice(frame) | | function shipmodule.getArtVoice(frame) |
| local shipNum = shipmodule.getIDNum(frame) | | local shipNum = shipmodule.getIDNum(frame) |
− |
| |
| local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") | | local shipInfo = assert(shipmodule.data[shipNum], "KanMusu ID " .. shipNum .. " doesn't have a database entry") |
− | -- Artist & Voice Info
| |
| 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 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 RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">' |
− |
| |
| local illustrator = '' | | local illustrator = '' |
| local voiceactor = '' | | local voiceactor = '' |
| 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"] .. ']]' |
− | --cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["artist"] .. ']]'
| |
| else | | else |
| illustrator = 'Unknown' | | illustrator = 'Unknown' |
Line 352: |
Line 435: |
| if shipmodule.data[shipNum]["seiyuu"] ~= "Unknown" and shipmodule.data[shipNum]["seiyuu"] ~= "" then | | if shipmodule.data[shipNum]["seiyuu"] ~= "Unknown" and shipmodule.data[shipNum]["seiyuu"] ~= "" then |
| voiceactor = '[[:Category:' .. shipmodule.data[shipNum]["seiyuu"] .. '|' .. shipmodule.data[shipNum]["seiyuu"] .. ']]' | | voiceactor = '[[:Category:' .. shipmodule.data[shipNum]["seiyuu"] .. '|' .. shipmodule.data[shipNum]["seiyuu"] .. ']]' |
− | --cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["seiyuu"] .. ']]'
| |
| else | | else |
| voiceactor = 'Unknown' | | voiceactor = 'Unknown' |
| end | | end |
| voice = RscHeader .. 'Seiyuu</th>' .. RscData .. voiceactor .. '</td>' | | voice = RscHeader .. 'Seiyuu</th>' .. RscData .. voiceactor .. '</td>' |
− | local row14 = '<table style="width: 100%">' .. art .. voice .. '</table>' | + | --local row14 = '<table style="width: 100%">' .. art .. voice .. '</table>' |
− | return row14 | + | return art .. voice |
| end | | end |
| | | |
Line 375: |
Line 457: |
| end | | end |
| return cat | | return cat |
− | end
| |
− |
| |
− | local remodelItems = mw.loadData('Module:KanmusuModule/RemodelHardcode')
| |
− |
| |
− | function shipmodule.RemodelBlueprintChk(blueprint, shipNum)
| |
− | return remodelItems[tonumber(shipNum)] or remodelItems[tonumber(blueprint)]
| |
| end | | end |
| | | |
Line 500: |
Line 576: |
| strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["consumption"][2] .. '</td></tr>' | | strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["consumption"][2] .. '</td></tr>' |
| return strings | | return strings |
| + | end |
| + | |
| + | local function numToID(num) |
| + | return num < 10 and "00" .. num or num < 100 and "0" .. num or tostring(num) |
| + | end |
| + | |
| + | function shipmodule.CardList() |
| + | firstID = 1 |
| + | maxID = -1 |
| + | for KanMusuID, KanMusuData in pairs(shipmodule.data) do |
| + | if tonumber(KanMusuID) ~= nil and tonumber(KanMusuID) > maxID then |
| + | maxID = tonumber(KanMusuID) |
| + | end |
| + | end |
| + | IDRange = math.ceil(maxID / 10) * 10 |
| + | wikipage = "" |
| + | while firstID < IDRange do |
| + | wikipage = wikipage .. "<h2>No. " .. tostring(firstID) .. "-" .. tostring(firstID+9) .. "</h2>" |
| + | for i = 0, 9 do |
| + | x = firstID + i |
| + | shipID = numToID(x) |
| + | if not shipmodule.data[shipID] then |
| + | wikipage = wikipage .. "[[File:blank.png|150px]]" |
| + | else |
| + | local shipName = shipmodule.data[shipID].name[3] |
| + | wikipage = wikipage .. "[[File:Ship Card " .. shipName .. ".png|150px|link=" .. shipdb.getWikiPage(shipID) .. "]]" |
| + | end |
| + | if x % 5 == 0 then |
| + | wikipage = wikipage .. "<br>" |
| + | end |
| + | end |
| + | wikipage = wikipage .. "<br>" |
| + | firstID = firstID + 10 |
| + | end |
| + | return wikipage |
| end | | end |
| | | |
| return shipmodule | | return shipmodule |