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 |
| + | |
| + | 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 |
| + | |
| + | local function tooltip(content, title) |
| + | return tostring(mw.html.create('span'):attr('title', title):addClass('explain'):wikitext(content)) |
| + | end |
| | | |
| function shipmodule.getIDNum(frame) | | function shipmodule.getIDNum(frame) |
Line 14: |
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 31: |
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 CardImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'Card.png|218px|' .. shipmodule.data[shipNum]["name"][3] .. 'Card]]</div>'
| |
− | local CardDmgImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'CardDmg.png|218px|' .. shipmodule.data[shipNum]["name"][3] .. 'Damaged Card]]</div>'
| |
− | local BannerImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'Banner.png|168px|' .. shipmodule.data[shipNum]["name"][3] .. 'Banner|class=imageCenter]]</div>'
| |
− | local BannerDmgImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'BannerDmg.png|160px|' .. 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 shipName = shipInfo.name[3] |
− | local Banners = '<td colspan="3" style="text-align: center;">' .. frame:extensionTag('slideshow', BannerImg .. BannerDmgImg, {sequence = 'forward', transition = 'fade', refresh = '10000'}) .. '</td>' | + | 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:Ship Card ' .. shipName .. ' Damaged.png|218x300px|' .. shipName .. ' Damaged Card]]</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: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, { |
| + | sequence = 'forward', transition = 'fade', refresh = '10000', center = 'true' |
| + | }) .. '</td>' |
| + | local Banners = '<td colspan="3" style="text-align: center; width: 160px; height:40px;">' .. frame:extensionTag('slideshow', BannerImg .. BannerDmgImg, { |
| + | sequence = 'forward', transition = 'fade', refresh = '10000', center = 'true' |
| + | }) .. '</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 50: |
Line 135: |
| formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%szwei") | | formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%szwei") |
| kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) | | kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) |
− | form = " zwei" | + | form = " zwei" |
| elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdrei") ~= nil then | | elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdrei") ~= nil then |
| formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdrei") | | formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdrei") |
| kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) | | kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) |
− | form = " drei" | + | form = " drei" |
| elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdue") ~= nil then | | elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdue") ~= nil then |
| formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdue") | | formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sdue") |
| kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) | | kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) |
− | form = " due" | + | form = " due" |
| elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sдва") ~= nil then | | elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sдва") ~= nil then |
| formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sдва") | | formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sдва") |
| kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) | | kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) |
− | form = " два" | + | form = " два" |
| elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II") ~= nil then | | elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II") ~= nil then |
| if mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II Mod.2") ~= nil then | | if mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II Mod.2") ~= nil then |
| formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II Mod.2") | | formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II Mod.2") |
| kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) | | kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) |
− | form = " Mk.II Mod.2" | + | form = " Mk.II Mod.2" |
| else | | else |
| formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II") | | formNum = mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sMk.II") |
| kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) | | kanji = mw.ustring.sub(shipmodule.data[shipNum]["name"][1], 1, formNum - 1) |
− | form = " Mk.II" | + | form = " Mk.II" |
| end | | end |
| elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sреволюция") ~= nil then -- Gangut "Kai" exception | | elseif mw.ustring.find(shipmodule.data[shipNum]["name"][1], "%sреволюция") ~= nil then -- Gangut "Kai" exception |
Line 87: |
Line 172: |
| local JaName = "" | | local JaName = "" |
| if shipNum == "147" or shipNum == "311" or shipNum == "312" or shipNum == "313" or shipNum == "313a" or shipNum == "316" then --Russian ship markup | | if shipNum == "147" or shipNum == "311" or shipNum == "312" or shipNum == "313" or shipNum == "313a" or shipNum == "316" then --Russian ship markup |
− | JaName = '<ruby lang="ru" xml:lang="ru"><rb>' .. kanji .. '</rb><rp> (</rp><rt lang="ja">' .. shipmodule.data[shipNum]["name"][2] .. '</rt><rp>) </rp></ruby>' .. frame:expandTemplate{ title = 'lang', args = { ru , form } } | + | JaName = '<ruby lang="ru" xml:lang="ru"><rb>' .. kanji .. '</rb><rp> (</rp><rt lang="ja">' .. shipmodule.data[shipNum]["name"][2] .. '</rt><rp>) </rp></ruby>' .. frame:expandTemplate{ title = 'lang', args = { 'ru' , form } } |
| else | | else |
− | JaName = frame:expandTemplate{ title = 'ruby-ja', args = { kanji , shipmodule.data[shipNum]["name"][2] } } .. frame:expandTemplate{ title = 'lang', args = { ja , form } } | + | JaName = frame:expandTemplate{ title = 'ruby-ja', args = { kanji , shipmodule.data[shipNum]["name"][2] } } .. frame:expandTemplate{ title = 'lang', args = { 'ja' , form } } |
| end | | end |
| | | |
Line 100: |
Line 185: |
| 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"][1] .. '→' .. shipmodule.data[shipNum]["hp"][2] .. '</td>' | + | local hp = shipmodule.data[shipNum]["hp"][1] |
− | local FPinfo = statLabel .. 'ATK [[File:IcoAtk.png|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>' | + | local maxHp = shipmodule.data[shipNum]["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 = tooltip(hp, string.format('%d with DE modernization', maxModHp)) |
| + | local hpSpan2 = tooltip(marriedHp, string.format('Married, %d with DE 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|Firepower]]</th>' .. statBox .. shipmodule.data[shipNum]["fp"][1] .. '→' .. shipmodule.data[shipNum]["fp"][2] .. '</td>' |
| | | |
| local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>' | | local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>' |
| | | |
| -- Armor & Torpedo | | -- 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 .. 'ARM [[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 |
| if shipmodule.data[shipNum]["torpedo"] == 0 then | | if shipmodule.data[shipNum]["torpedo"] == 0 then |
Line 129: |
Line 227: |
| | | |
| -- Planes & ASW | | -- Planes & ASW |
− | local aircraftTotal = 0 | + | local aircraftTotal = shipdb.TotalAircraft(frame) |
− | if shipmodule.data[shipNum]["aircraft"] ~= "" then
| |
− | local aircraftslot = {0, 0, 0, 0}
| |
− | for i = 1, 4, 1 do
| |
− | if shipmodule.data[shipNum]["aircraft"][i] ~= nil then
| |
− | aircraftslot[i] = shipmodule.data[shipNum]["aircraft"][i]
| |
− | else
| |
− | aircraftslot[i] = 0
| |
− | end
| |
− | end
| |
− | aircraftTotal = aircraftslot[1] + aircraftslot[2] + aircraftslot[3] + aircraftslot[4]
| |
− | else
| |
− | aircraftTotal = 0
| |
− | end
| |
| local Planeinfo = statLabel .. 'PLA [[File:IcoAircraft.png|Aircraft]]</th>' .. statBox .. aircraftTotal .. '</td>' | | local Planeinfo = statLabel .. 'PLA [[File:IcoAircraft.png|Aircraft]]</th>' .. statBox .. aircraftTotal .. '</td>' |
| local ASWinfo = statLabel .. 'ASW [[File:IcoASW.png|Anti-Submarine Warfare]]</th>' .. statBox | | local ASWinfo = statLabel .. 'ASW [[File:IcoASW.png|Anti-Submarine Warfare]]</th>' .. statBox |
Line 181: |
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
| |
− | if shipNum == "346" or shipNum == "353" 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 245: |
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 256: |
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 |
| | | |
− | -- Remodel info
| |
− | local remodelsteel = '[[File:IcoSteel.png|18px|Steel]]'
| |
− | local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]'
| |
− | local remodelblueprint = shipmodule.data[shipNum]["remodelreq"][3]
| |
| local remodelinfo = '' | | local remodelinfo = '' |
− | if shipmodule.data[shipNum]["remodelreq"] ~= "" then | + | if shipInfo.remodelreq and shipInfo.remodelreq ~= '' then |
− | remodelsteel = remodelsteel .. ' ' .. 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]) |
− | remodelammo = remodelammo .. ' ' .. shipmodule.data[shipNum]["remodelreq"][2] | + | if shipInfo.remodelbp then |
− | remodelinfo = remodelsteel .. ' ' .. remodelammo | + | remodelinfo = remodelinfo .. ' ' .. string.format('[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d', shipInfo.remodelbp) |
− | if shipmodule.data[shipNum]["remodelreq"][3] ~= nil then | + | end |
− | remodelinfo = remodelinfo .. ' ' .. shipmodule.RemodelBlueprintChk(remodelblueprint)
| + | if shipInfo.remodelcatapult then |
| + | 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 291: |
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 320: |
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 342: |
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 365: |
Line 457: |
| end | | end |
| return cat | | return cat |
− | end
| |
− |
| |
− | function shipmodule.RemodelBlueprintChk(blueprint) -- Remodel value check
| |
− | --Hardcoded Musashi K2 requirements for sake of time.
| |
− | local blueprinttext = ''
| |
− | if blueprint == 1 then
| |
− | blueprinttext = '[[File:IcoBlueprint.png|25px|Blueprint|link=Blueprints]]'
| |
− | elseif blueprint == 2 then
| |
− | blueprinttext = '[[File:IcoBlueprint.png|25px|Blueprint|link=Blueprints]] [[File:IcoCatapult.png|25px|Prototype Flight Deck Catapult]]'
| |
− | elseif blueprint == 3 then
| |
− | blueprinttext = '[[File:IcoActionReport.png|25px|Action Report]]'
| |
− | elseif blueprint == 4 then
| |
− | blueprinttext = '[[File:IcoBlueprint.png|25px|Blueprint|link=Blueprints]] [[File:IcoActionReport.png|25px|Action Report]]'
| |
− | elseif blueprint == 11 then
| |
− | --Musashi K2
| |
− | blueprinttext = '[[File:IcoBlueprint.png|25px|Blueprint|link=Blueprints]]x3 [[File:New Type Artillery Armament Materials.png|25px|New Type Artillery Armament Materials]]x3 [[File:IcoActionReport.png|25px|Action Report]]'
| |
− | elseif blueprint == 12 then
| |
− | --Ise K2
| |
− | blueprinttext = '[[File:IcoBlueprint.png|25px|Blueprint|link=Blueprints]]x2 [[File:IcoCatapult.png|25px|Prototype Flight Deck Catapult]] [[File:IcoActionReport.png|25px|Action Report]]'
| |
− | end
| |
− | return blueprinttext
| |
| end | | end |
| | | |
Line 505: |
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 |