- 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"
Jump to navigation
Jump to search
m (Fix) |
m (Fix variable name) |
||
Line 1: | Line 1: | ||
local shipmodule = {} | local shipmodule = {} | ||
local shipdb = require("Module:ShipDatabase") | local shipdb = require("Module:ShipDatabase") | ||
− | shipmodule = shipdb.KanmusuData | + | shipmodule.data = shipdb.KanmusuData |
function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template | function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template | ||
local shipNum = frame.args[1] | local shipNum = frame.args[1] | ||
− | local shipInfo = assert(shipmodule[shipNum], "This KanMusu ID doesn't contains any data") | + | 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[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[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>' |
− | local BannerImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'Banner.png|' .. shipmodule[shipNum]["name"][3] .. 'Banner|class=imageCenter]]</div>' | + | local BannerImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'Banner.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Banner|class=imageCenter]]</div>' |
− | local BannerDmgImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'BannerDmg.png|' .. shipmodule[shipNum]["name"][3] .. 'Damaged Banner|class=imageCenter]]</div>' | + | 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 = '5000'}) .. '</td>' | local Cards = '<td rowspan="10" style="text-align: center;">' .. frame:extensionTag('slideshow', CardImg .. CardDmgImg, {sequence = 'forward', transition = 'fade', refresh = '5000'}) .. '</td>' | ||
Line 16: | Line 16: | ||
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>' | ||
− | local JaName = '<ruby lang="ja" xml:lang="ja"><rb>' .. shipmodule[shipNum]["name"][1] .. '</rb><rp> (</rp><rt>' .. shipmodule[shipNum]["name"][2] .. '</rt><rp>) </rp></ruby>' | + | local JaName = '<ruby lang="ja" xml:lang="ja"><rb>' .. shipmodule.data[shipNum]["name"][1] .. '</rb><rp> (</rp><rt>' .. shipmodule.data[shipNum]["name"][2] .. '</rt><rp>) </rp></ruby>' |
− | local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. shipmodule[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[shipNum]["class"] .. ' Class ' .. shipmodule[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>' | ||
Line 25: | Line 25: | ||
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;">' | ||
− | local HPinfo = statLabel .. 'HP [[File:IcoHP.png|HP]]</th>' .. statBox .. shipmodule[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[shipNum]["fp"][1] .. '→' .. shipmodule[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>' |
local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>' | local row5 = '<tr>' .. HPinfo .. FPinfo .. '</tr>' | ||
− | local Armorinfo = statLabel .. 'DEF [[File:IcoArmor.png|Armor]]</th>' .. statBox .. shipmodule[shipNum]["armor"][1] .. '→' .. shipmodule[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 | ||
− | if shipmodule[shipNum]["torpedo"] == 0 then | + | if shipmodule.data[shipNum]["torpedo"] == 0 then |
− | Torpedoinfo = Torpedoinfo .. shipmodule[shipNum]["torpedo"] | + | Torpedoinfo = Torpedoinfo .. shipmodule.data[shipNum]["torpedo"] |
else | else | ||
− | Torpedoinfo = Torpedoinfo .. shipmodule[shipNum]["torpedo"][1] .. '→' .. shipmodule[shipNum]["torpedo"][2] | + | Torpedoinfo = Torpedoinfo .. shipmodule.data[shipNum]["torpedo"][1] .. '→' .. shipmodule.data[shipNum]["torpedo"][2] |
end | end | ||
local row6 = '<tr>' .. Armorinfo .. Torpedoinfo .. '</tr>' | local row6 = '<tr>' .. Armorinfo .. Torpedoinfo .. '</tr>' | ||
− | local Evasioninfo = statLabel .. 'EVA [[File:IcoEvasion.png|Evasion]]</th>' .. statBox .. shipmodule[shipNum]["evasion"][1] .. '→' .. shipmodule[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 | ||
− | if shipmodule[shipNum]["aa"] == 0 then | + | if shipmodule.data[shipNum]["aa"] == 0 then |
− | AAinfo = AAinfo .. shipmodule[shipNum]["aa"] | + | AAinfo = AAinfo .. shipmodule.data[shipNum]["aa"] |
else | else | ||
− | AAinfo = AAinfo .. shipmodule[shipNum]["aa"][1] .. '→' .. shipmodule[shipNum]["aa"][2] | + | AAinfo = AAinfo .. shipmodule.data[shipNum]["aa"][1] .. '→' .. shipmodule.data[shipNum]["aa"][2] |
end | end | ||
Line 51: | Line 51: | ||
local aircraftTotal = 0 | local aircraftTotal = 0 | ||
− | if shipmodule[shipNum]["aircraft"] ~= "" then | + | if shipmodule.data[shipNum]["aircraft"] ~= "" then |
local aircraftslot = {0, 0, 0, 0} | local aircraftslot = {0, 0, 0, 0} | ||
for i = 1, 4, 1 do | for i = 1, 4, 1 do | ||
− | if shipmodule[shipNum]["aircraft"][i] ~= nil then | + | if shipmodule.data[shipNum]["aircraft"][i] ~= nil then |
− | aircraftslot[i] = shipmodule[shipNum]["aircraft"][i] | + | aircraftslot[i] = shipmodule.data[shipNum]["aircraft"][i] |
else | else | ||
aircraftslot[i] = 0 | aircraftslot[i] = 0 | ||
Line 66: | Line 66: | ||
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 | ||
− | if shipmodule[shipNum]["asw"] == 0 then | + | if shipmodule.data[shipNum]["asw"] == 0 then |
− | ASWinfo = ASWinfo .. shipmodule[shipNum]["asw"] | + | ASWinfo = ASWinfo .. shipmodule.data[shipNum]["asw"] |
else | else | ||
− | ASWinfo = ASWinfo .. shipmodule[shipNum]["asw"][1] .. '→' .. shipmodule[shipNum]["asw"][2] | + | ASWinfo = ASWinfo .. shipmodule.data[shipNum]["asw"][1] .. '→' .. shipmodule.data[shipNum]["asw"][2] |
end | end | ||
local row8 = '<tr>' .. Planeinfo .. ASWinfo .. '</tr>' | local row8 = '<tr>' .. Planeinfo .. ASWinfo .. '</tr>' | ||
− | local Speedinfo = statLabel .. 'SPD [[File:IcoSpeed.png|Speed]]</th>' .. statBox .. shipmodule[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[shipNum]["los"][1] .. '→' .. shipmodule[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>' |
local row9 = '<tr>' .. Speedinfo .. LOSinfo .. '</tr>' | local row9 = '<tr>' .. Speedinfo .. LOSinfo .. '</tr>' | ||
− | local Rangeinfo = statLabel .. 'RGE [[File:IcoRange.png|Range]]</th>' .. statBox .. shipmodule[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[shipNum]["luck"][1] .. '→' .. shipmodule[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>' |
local row10 = '<tr>' .. Rangeinfo .. Luckinfo .. '</tr>' | local row10 = '<tr>' .. Rangeinfo .. Luckinfo .. '</tr>' | ||
Line 94: | Line 94: | ||
local constrdata = '' | local constrdata = '' | ||
− | if shipmodule[shipNum]["remodellv"] ~= nil and shipmodule[shipNum]["remodellv"] ~= "" then | + | if shipmodule.data[shipNum]["remodellv"] ~= nil and shipmodule.data[shipNum]["remodellv"] ~= "" then |
constrheader = 'Remodel Level' | constrheader = 'Remodel Level' | ||
− | constrdata = shipmodule[shipNum]["remodellv"] | + | constrdata = shipmodule.data[shipNum]["remodellv"] |
else | else | ||
constrheader = 'Build Time' | constrheader = 'Build Time' | ||
− | if shipmodule[shipNum]["buildtime"] == nil or shipmodule[shipNum]["buildtime"] == "" then | + | if shipmodule.data[shipNum]["buildtime"] == nil or shipmodule.data[shipNum]["buildtime"] == "" then |
constrdata = 'Not Buildable' | constrdata = 'Not Buildable' | ||
else | else | ||
− | constrdata = shipmodule[shipNum]["buildtime"] | + | constrdata = shipmodule.data[shipNum]["buildtime"] |
end | end | ||
end | end | ||
Line 109: | Line 109: | ||
local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]' | local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]' | ||
local remodelinfo = '' | local remodelinfo = '' | ||
− | if shipmodule[shipNum]["remodelreq"] ~= "" then | + | if shipmodule.data[shipNum]["remodelreq"] ~= "" then |
− | remodelsteel = remodelsteel .. ' ' .. shipmodule[shipNum]["remodelreq"][1] | + | remodelsteel = remodelsteel .. ' ' .. shipmodule.data[shipNum]["remodelreq"][1] |
− | remodelammo = remodelammo .. ' ' .. shipmodule[shipNum]["remodelreq"][2] | + | remodelammo = remodelammo .. ' ' .. shipmodule.data[shipNum]["remodelreq"][2] |
remodelinfo = remodelsteel .. ' ' .. remodelammo | remodelinfo = remodelsteel .. ' ' .. remodelammo | ||
end | end | ||
Line 122: | Line 122: | ||
end | end | ||
− | local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule[shipNum]["consumption"][1] | + | local consfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["consumption"][1] |
− | local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule[shipNum]["consumption"][2] | + | local consammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["consumption"][2] |
local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>' | local row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>' | ||
− | local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule[shipNum]["dismantle"][1] | + | local scrapfuel = '[[File:IcoFuel.png|18px|Fuel]] ' .. shipmodule.data[shipNum]["dismantle"][1] |
− | local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule[shipNum]["dismantle"][2] | + | local scrapammo = '[[File:IcoAmmo.png|18px|Ammo]] ' .. shipmodule.data[shipNum]["dismantle"][2] |
− | local scrapsteel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipmodule[shipNum]["dismantle"][3] | + | local scrapsteel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipmodule.data[shipNum]["dismantle"][3] |
− | local scrapbauxite = '[[File:IcoBauxite.png|18px|Bauxite]] ' .. shipmodule[shipNum]["dismantle"][4] | + | local scrapbauxite = '[[File:IcoBauxite.png|18px|Bauxite]] ' .. shipmodule.data[shipNum]["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>' | ||
− | local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipmodule[shipNum]["modernization"][1] | + | local modFP = '[[File:IcoAtkRemodel.png|25px|Firepower]] ' .. shipmodule.data[shipNum]["modernization"][1] |
− | local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipmodule[shipNum]["modernization"][2] | + | local modTorp = '[[File:IcoTorpedoRemodel.png|25px|Torpedo]] ' .. shipmodule.data[shipNum]["modernization"][2] |
− | local modAA = '[[File:IcoAARemodel.png|25px|Anti-Air]] ' .. shipmodule[shipNum]["modernization"][3] | + | local modAA = '[[File:IcoAARemodel.png|25px|Anti-Air]] ' .. shipmodule.data[shipNum]["modernization"][3] |
− | local modArmor = '[[File:IcoArmorRemodel.png|25px|Armor]] ' .. shipmodule[shipNum]["modernization"][4] | + | local modArmor = '[[File:IcoArmorRemodel.png|25px|Armor]] ' .. shipmodule.data[shipNum]["modernization"][4] |
local modLuck = '' | local modLuck = '' | ||
− | if shipmodule[shipNum]["modernization"][5] ~= nil and shipmodule[shipNum]["modernization"][5] ~= "" then | + | if shipmodule.data[shipNum]["modernization"][5] ~= nil and shipmodule.data[shipNum]["modernization"][5] ~= "" then |
− | modLuck = '[[File:IcoLuck|18px|Luck]] ' .. shipmodule[shipNum]["modernization"][5] | + | modLuck = '[[File:IcoLuck|18px|Luck]] ' .. shipmodule.data[shipNum]["modernization"][5] |
end | end | ||
Line 152: | Line 152: | ||
local voiceactor = '' | local voiceactor = '' | ||
local cat = '[[Category:Ships]]' | local cat = '[[Category:Ships]]' | ||
− | if shipmodule[shipNum]["artist"] ~= "Unknown" and shipmodule[shipNum]["artist"] ~= "" then | + | if shipmodule.data[shipNum]["artist"] ~= "Unknown" and shipmodule.data[shipNum]["artist"] ~= "" then |
− | illustrator = '[[:Category:' .. shipmodule[shipNum]["artist"] .. '|' .. shipmodule[shipNum]["artist"] .. ']]' | + | illustrator = '[[:Category:' .. shipmodule.data[shipNum]["artist"] .. '|' .. shipmodule.data[shipNum]["artist"] .. ']]' |
− | cat = cat .. '[[Category:' .. shipmodule[shipNum]["artist"] .. ']]' | + | cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["artist"] .. ']]' |
else | else | ||
illustrator = 'Unknown' | illustrator = 'Unknown' | ||
end | end | ||
− | if shipmodule[shipNum]["seiyuu"] ~= "Unknown" and shipmodule[shipNum]["seiyuu"] ~= "" then | + | if shipmodule.data[shipNum]["seiyuu"] ~= "Unknown" and shipmodule.data[shipNum]["seiyuu"] ~= "" then |
− | voiceactor = '[[:Category:' .. shipmodule[shipNum]["seiyuu"] .. '|' .. shipmodule[shipNum]["seiyuu"] .. ']]' | + | voiceactor = '[[:Category:' .. shipmodule.data[shipNum]["seiyuu"] .. '|' .. shipmodule.data[shipNum]["seiyuu"] .. ']]' |
− | cat = cat .. '[[Category:' .. shipmodule[shipNum]["seiyuu"] .. ']]' | + | cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["seiyuu"] .. ']]' |
else | else | ||
voiceactor = 'Unknown' | voiceactor = 'Unknown' | ||
Line 169: | Line 169: | ||
local planeStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: top;">' | local planeStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: top;">' | ||
local equipStyle = '' | local equipStyle = '' | ||
− | if shipmodule[shipNum]["aircraft"] ~= "" then | + | 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>' | 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>' | equipHeader2 = '<th colspan="3" style="white-space: nowrap; {{border-radius|4px 12px 12px 4px}} background-color: #efe6d7; color: #a3965c; vertical-align: baseline;">Equipment</th>' | ||
Line 181: | Line 181: | ||
local equip = {'<tr>', '<tr>', '<tr>', '<tr>'} | local equip = {'<tr>', '<tr>', '<tr>', '<tr>'} | ||
for i = 1, 4, 1 do | for i = 1, 4, 1 do | ||
− | if shipmodule[shipNum]["aircraft"] ~= "" then | + | if shipmodule.data[shipNum]["aircraft"] ~= "" then |
− | if shipmodule[shipNum]["aircraft"][i] ~= nil then | + | if shipmodule.data[shipNum]["aircraft"][i] ~= nil then |
− | equip[i] = equip[i] .. planeStyle .. shipmodule[shipNum]["aircraft"][i] .. '</td>' .. equipStyle | + | equip[i] = equip[i] .. planeStyle .. shipmodule.data[shipNum]["aircraft"][i] .. '</td>' .. equipStyle |
else | else | ||
equip[i] = equip[i] .. planeStyle .. '</td>' .. equipStyle | equip[i] = equip[i] .. planeStyle .. '</td>' .. equipStyle | ||
end | end | ||
− | if shipmodule[shipNum]["equip"] ~= "" then | + | if shipmodule.data[shipNum]["equip"] ~= "" then |
− | if shipmodule[shipNum]["equip"][i] == "" or shipmodule[shipNum]["equip"][i] == "Unequipped" then | + | if shipmodule.data[shipNum]["equip"][i] == "" or shipmodule.data[shipNum]["equip"][i] == "Unequipped" then |
equip[i] = equip[i] .. '-Unequipped-</td></tr>' | equip[i] = equip[i] .. '-Unequipped-</td></tr>' | ||
− | elseif shipmodule[shipNum]["equip"][i] == nil then | + | elseif shipmodule.data[shipNum]["equip"][i] == nil then |
equip[i] = equip[i] .. '\'\'-Locked-\'\'</td></tr>' | equip[i] = equip[i] .. '\'\'-Locked-\'\'</td></tr>' | ||
else | else | ||
− | equip[i] = equip[i] .. '[[' .. shipmodule[shipNum]["equip"][i] .. ']]</td></tr>' | + | equip[i] = equip[i] .. '[[' .. shipmodule.data[shipNum]["equip"][i] .. ']]</td></tr>' |
end | end | ||
else | else | ||
Line 200: | Line 200: | ||
else | else | ||
equip[i] = equip[i] .. equipStyle | equip[i] = equip[i] .. equipStyle | ||
− | if shipmodule[shipNum]["equip"] ~= "" then | + | if shipmodule.data[shipNum]["equip"] ~= "" then |
− | if shipmodule[shipNum]["equip"][i] == "" or shipmodule[shipNum]["equip"][i] == "Unequipped" then | + | if shipmodule.data[shipNum]["equip"][i] == "" or shipmodule.data[shipNum]["equip"][i] == "Unequipped" then |
equip[i] = equip[i] .. '-Unequipped-</td></tr>' | equip[i] = equip[i] .. '-Unequipped-</td></tr>' | ||
− | elseif shipmodule[shipNum]["equip"][i] == nil then | + | elseif shipmodule.data[shipNum]["equip"][i] == nil then |
equip[i] = equip[i] .. '\'\'Locked\'\'</td></tr>' | equip[i] = equip[i] .. '\'\'Locked\'\'</td></tr>' | ||
else | else | ||
− | equip[i] = equip[i] .. '[[' .. shipmodule[shipNum]["equip"][i] .. ']]</td></tr>' | + | equip[i] = equip[i] .. '[[' .. shipmodule.data[shipNum]["equip"][i] .. ']]</td></tr>' |
end | end | ||
else | else | ||
Line 215: | Line 215: | ||
local DetailTable = '<table style="width: 100%">' .. equipHeader .. equip[1] .. equip[2] .. equip[3] .. equip[4] .. row11 .. row12 .. row13 .. row14 .. '</table>' | local DetailTable = '<table style="width: 100%">' .. equipHeader .. equip[1] .. equip[2] .. equip[3] .. equip[4] .. row11 .. row12 .. row13 .. row14 .. '</table>' | ||
− | cat = cat .. '[[Category:' .. shipmodule[shipNum]["class"] .. ']][[Category:' .. shipmodule[shipNum]["type"] .. ']]' | + | cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["class"] .. ']][[Category:' .. shipmodule.data[shipNum]["type"] .. ']]' |
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">' | ||
Line 248: | Line 248: | ||
for num, id in pairs(IDList) do | for num, id in pairs(IDList) do | ||
if shipType ~= nil then | if shipType ~= nil then | ||
− | if shipType == shipmodule[id]["type"] then | + | if shipType == shipmodule.data[id]["type"] then |
shipListTable = shipListTable .. shipmodule.KanmusuListEntry(id) | shipListTable = shipListTable .. shipmodule.KanmusuListEntry(id) | ||
end | end | ||
Line 262: | Line 262: | ||
local strings = '<tr>' | local strings = '<tr>' | ||
local aircraftTotal = 0 | local aircraftTotal = 0 | ||
− | if shipmodule[id]["aircraft"] ~= "" then | + | if shipmodule.data[id]["aircraft"] ~= "" then |
local aircraftslot = {0, 0, 0, 0} | local aircraftslot = {0, 0, 0, 0} | ||
for i = 1, 4, 1 do | for i = 1, 4, 1 do | ||
− | if shipmodule[id]["aircraft"][i] ~= nil then | + | if shipmodule.data[id]["aircraft"][i] ~= nil then |
− | aircraftslot[i] = shipmodule[id]["aircraft"][i] | + | aircraftslot[i] = shipmodule.data[id]["aircraft"][i] |
else | else | ||
aircraftslot[i] = 0 | aircraftslot[i] = 0 | ||
Line 277: | Line 277: | ||
strings = strings .. '<td style="text-align: center;">' .. id .. '</td>' | strings = strings .. '<td style="text-align: center;">' .. id .. '</td>' | ||
− | strings = strings .. '<td style="text-align: center;">[[' .. shipmodule[id]["name"][3] .. ']]</td>' | + | strings = strings .. '<td style="text-align: center;">[[' .. shipmodule.data[id]["name"][3] .. ']]</td>' |
− | strings = strings .. '<td style="text-align: center;">' .. shipmodule[id]["class"] .. '</td>' | + | strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["class"] .. '</td>' |
− | strings = strings .. '<td style="text-align: center;">' .. shipmodule[id]["type"] .. '</td>' | + | strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["type"] .. '</td>' |
− | strings = strings .. '<td style="text-align: center; background-color: #f0bbbb;">' .. shipmodule[id]["fp"][1] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #f0bbbb;">' .. shipmodule.data[id]["fp"][1] .. '</td>' |
− | if shipmodule[id]["torpedo"] == 0 then | + | if shipmodule.data[id]["torpedo"] == 0 then |
− | strings = strings .. '<td style="text-align: center; background-color: #99eefa;">' .. shipmodule[id]["torpedo"] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #99eefa;">' .. shipmodule.data[id]["torpedo"] .. '</td>' |
else | else | ||
− | strings = strings .. '<td style="text-align: center; background-color: #99eefa;">' .. shipmodule[id]["torpedo"][1] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #99eefa;">' .. shipmodule.data[id]["torpedo"][1] .. '</td>' |
end | end | ||
− | if shipmodule[id]["aa"] == 0 then | + | if shipmodule.data[id]["aa"] == 0 then |
− | strings = strings .. '<td style="text-align: center; background-color: #faccaa;">' .. shipmodule[id]["aa"] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #faccaa;">' .. shipmodule.data[id]["aa"] .. '</td>' |
else | else | ||
− | strings = strings .. '<td style="text-align: center; background-color: #faccaa;">' .. shipmodule[id]["aa"][1] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #faccaa;">' .. shipmodule.data[id]["aa"][1] .. '</td>' |
end | end | ||
− | if shipmodule[id]["asw"] == 0 then | + | if shipmodule.data[id]["asw"] == 0 then |
− | strings = strings .. '<td style="text-align: center; background-color: #fff5ee;">' .. shipmodule[id]["asw"] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #fff5ee;">' .. shipmodule.data[id]["asw"] .. '</td>' |
else | else | ||
− | strings = strings .. '<td style="text-align: center; background-color: #fff5ee;">' .. shipmodule[id]["asw"][1] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #fff5ee;">' .. shipmodule.data[id]["asw"][1] .. '</td>' |
end | end | ||
− | strings = strings .. '<td style="text-align: center; background-color: #afffee;">' .. shipmodule[id]["los"][1] .. '</td>' | + | 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[id]["luck"][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[id]["hp"] .. '</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[id]["armor"][1] .. '</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[id]["evasion"][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: #d9d9d9;">' .. aircraftTotal .. '</td>' | ||
− | strings = strings .. '<td style="text-align: center; background-color: #aaffff;">' .. shipmodule[id]["spd"] .. '</td>' | + | strings = strings .. '<td style="text-align: center; background-color: #aaffff;">' .. shipmodule.data[id]["spd"] .. '</td>' |
− | strings = strings .. '<td style="text-align: center;">' .. shipmodule[id]["range"] .. '</td>' | + | strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["range"] .. '</td>' |
− | strings = strings .. '<td style="text-align: center;">' .. shipmodule[id]["consumption"][1] .. '</td>' | + | strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["consumption"][1] .. '</td>' |
− | strings = strings .. '<td style="text-align: center;">' .. shipmodule[id]["consumption"][2] .. '</td></tr>' | + | strings = strings .. '<td style="text-align: center;">' .. shipmodule.data[id]["consumption"][2] .. '</td></tr>' |
return strings | return strings | ||
end | end | ||
return shipmodule | return shipmodule |
Revision as of 16:05, 10 January 2017
Documentation for this module may be created at Module:KanmusuModule/doc
local shipmodule = {}
local shipdb = require("Module:ShipDatabase")
shipmodule.data = shipdb.KanmusuData
function shipmodule.KanmusuInfo(frame) -- Kanmusu Info Template
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 CardDmgImg = '<div style="text-align: center;">[[File:KanMusu' .. shipNum .. 'CardDmg.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Damaged Card]]</div>'
local BannerImg = '<div style="text-align: center; width: 100%;">[[File:KanMusu' .. shipNum .. 'Banner.png|' .. shipmodule.data[shipNum]["name"][3] .. 'Banner|class=imageCenter]]</div>'
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 = '5000'}) .. '</td>'
local Banners = '<td colspan="3" style="text-align: center;">' .. frame:extensionTag('slideshow', BannerImg .. BannerDmgImg, {sequence = 'forward', transition = 'fade', refresh = '5000'}) .. '</td>'
local row1 = '<tr>' .. Cards .. '<th style="text-align: center;">' .. shipNum .. '</th>' .. Banners .. '</tr>'
local JaName = '<ruby lang="ja" xml:lang="ja"><rb>' .. shipmodule.data[shipNum]["name"][1] .. '</rb><rp> (</rp><rt>' .. shipmodule.data[shipNum]["name"][2] .. '</rt><rp>) </rp></ruby>'
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 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 statLabel = '<th style="width: 65px; {{border-radius|12px 4px 4px 12px}} padding-left: 5px; padding-right: 5px; background-color: #efe6d7; 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>'
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 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
if shipmodule.data[shipNum]["torpedo"] == 0 then
Torpedoinfo = Torpedoinfo .. shipmodule.data[shipNum]["torpedo"]
else
Torpedoinfo = Torpedoinfo .. shipmodule.data[shipNum]["torpedo"][1] .. '→' .. shipmodule.data[shipNum]["torpedo"][2]
end
local row6 = '<tr>' .. Armorinfo .. Torpedoinfo .. '</tr>'
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
if shipmodule.data[shipNum]["aa"] == 0 then
AAinfo = AAinfo .. shipmodule.data[shipNum]["aa"]
else
AAinfo = AAinfo .. shipmodule.data[shipNum]["aa"][1] .. '→' .. shipmodule.data[shipNum]["aa"][2]
end
local row7 = '<tr>' .. Evasioninfo .. AAinfo .. '</tr>'
local aircraftTotal = 0
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 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
constrheader = 'Build Time'
if shipmodule.data[shipNum]["buildtime"] == nil or shipmodule.data[shipNum]["buildtime"] == "" then
constrdata = 'Not Buildable'
else
constrdata = shipmodule.data[shipNum]["buildtime"]
end
end
local remodelsteel = '[[File:IcoSteel.png|18px|Steel]]'
local remodelammo = '[[File:IcoAmmo.png|18px|Ammo]]'
local remodelinfo = ''
if shipmodule.data[shipNum]["remodelreq"] ~= "" then
remodelsteel = remodelsteel .. ' ' .. shipmodule.data[shipNum]["remodelreq"][1]
remodelammo = remodelammo .. ' ' .. shipmodule.data[shipNum]["remodelreq"][2]
remodelinfo = remodelsteel .. ' ' .. remodelammo
end
local row11 = ''
if constrheader == 'Build Time' then
row11 = '<tr>' .. RscHeader .. constrheader .. '</th>' .. RscData .. constrdata .. '</td><td colspan="2"> </td></tr>'
else
row11 = '<tr>' .. RscHeader .. constrheader .. '</th>' .. RscData .. constrdata .. '</td>' .. RscHeader .. 'Remodel Req</th>' .. RscData .. remodelinfo .. '</td></tr>'
end
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 row12 = '<tr>' .. RscHeader .. 'Consumption</th>' .. RscData .. consfuel .. ' ' .. consammo .. '</td>'
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 scrapsteel = '[[File:IcoSteel.png|18px|Steel]] ' .. shipmodule.data[shipNum]["dismantle"][3]
local scrapbauxite = '[[File:IcoBauxite.png|18px|Bauxite]] ' .. shipmodule.data[shipNum]["dismantle"][4]
local scrapinfo = scrapfuel .. ' ' .. scrapammo .. ' ' .. scrapsteel .. ' ' .. scrapbauxite
local row12 = row12 .. RscHeader .. 'Dismantle</th>' .. RscData .. scrapinfo .. '</td></tr>'
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 modAA = '[[File:IcoAARemodel.png|25px|Anti-Air]] ' .. shipmodule.data[shipNum]["modernization"][3]
local modArmor = '[[File:IcoArmorRemodel.png|25px|Armor]] ' .. shipmodule.data[shipNum]["modernization"][4]
local modLuck = ''
if shipmodule.data[shipNum]["modernization"][5] ~= nil and shipmodule.data[shipNum]["modernization"][5] ~= "" then
modLuck = '[[File:IcoLuck|18px|Luck]] ' .. shipmodule.data[shipNum]["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>'
local illustrator = ''
local voiceactor = ''
local cat = '[[Category:Ships]]'
if shipmodule.data[shipNum]["artist"] ~= "Unknown" and shipmodule.data[shipNum]["artist"] ~= "" then
illustrator = '[[:Category:' .. shipmodule.data[shipNum]["artist"] .. '|' .. shipmodule.data[shipNum]["artist"] .. ']]'
cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["artist"] .. ']]'
else
illustrator = 'Unknown'
end
if shipmodule.data[shipNum]["seiyuu"] ~= "Unknown" and shipmodule.data[shipNum]["seiyuu"] ~= "" then
voiceactor = '[[:Category:' .. shipmodule.data[shipNum]["seiyuu"] .. '|' .. shipmodule.data[shipNum]["seiyuu"] .. ']]'
cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["seiyuu"] .. ']]'
else
voiceactor = 'Unknown'
end
local row14 = '<tr>' .. RscHeader .. 'Artist</th>' .. RscData .. illustrator .. '</td>' .. RscHeader .. 'Seiyuu</th>' .. RscData .. voiceactor .. '</td></tr>'
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
local DetailTable = '<table style="width: 100%">' .. equipHeader .. equip[1] .. equip[2] .. equip[3] .. equip[4] .. row11 .. row12 .. row13 .. row14 .. '</table>'
cat = cat .. '[[Category:' .. shipmodule.data[shipNum]["class"] .. ']][[Category:' .. shipmodule.data[shipNum]["type"] .. ']]'
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
function shipmodule.KanmusuList(frame)
local shipType = frame.args[1]
local shipListTable = '<table class="wikitable filterable sortable" style="width: 100%; min-width: 800px;"><tr>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable" data-sort-type="number">ID</th>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable unsortable">Name</th>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unsortable">Class</th>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unsortable">Type</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: LightCoral;" class="unfilterable">[[File:IcoAtk.png|Firepower]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: LightSkyBlue;" class="unfilterable">[[File:IcoTorpedo.png|Torpedo]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: SandyBrown;" class="unfilterable">[[File:IcoAA.png|Anti-Air]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Seashell;" class="unfilterable">[[File:IcoASW.png|Anti-Submarine Warfare]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Aquamarine;" class="unfilterable">[[File:IcoLOS.png|Line of Sight]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: PaleGreen;" class="unfilterable">[[File:IcoLuck.png|Luck]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Pink;" class="unfilterable">[[File:IcoHP.png|HP]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Yellow;" class="unfilterable">[[File:IcoArmor.png|Armor]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Violet;" class="unfilterable">[[File:IcoEvasion.png|Evasion]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Silver;" class="unfilterable">[[File:IcoAircraft.png|Aircraft]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; vertical-align: middle; background-color: Aqua;" class="unfilterable">[[File:IcoSpeed.png|Speed]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable">[[File:IcoRange.png|Range]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable">[[File:IcoFuel.png|Fuel Consumption]]</th>'
shipListTable = shipListTable .. '<th style="text-align: center; background-color: SpringGreen;" class="unfilterable">[[File:IcoAmmo.png|Ammo Consumption]]</th></tr>'
local IDList = shipdb.getSortedIDList()
for num, id in pairs(IDList) do
if shipType ~= nil then
if shipType == shipmodule.data[id]["type"] then
shipListTable = shipListTable .. shipmodule.KanmusuListEntry(id)
end
else
shipListTable = shipListTable .. shipmodule.KanmusuListEntry(id)
end
end
shipListTable = shipListTable .. '</table>'
return shipListTable
end
function shipmodule.KanmusuListEntry(id) -- Kanmusu List Table
local strings = '<tr>'
local aircraftTotal = 0
if shipmodule.data[id]["aircraft"] ~= "" then
local aircraftslot = {0, 0, 0, 0}
for i = 1, 4, 1 do
if shipmodule.data[id]["aircraft"][i] ~= nil then
aircraftslot[i] = shipmodule.data[id]["aircraft"][i]
else
aircraftslot[i] = 0
end
end
aircraftTotal = aircraftslot[1] + aircraftslot[2] + aircraftslot[3] + aircraftslot[4]
else
aircraftTotal = 0
end
strings = strings .. '<td style="text-align: center;">' .. id .. '</td>'
strings = strings .. '<td style="text-align: center;">[[' .. shipmodule.data[id]["name"][3] .. ']]</td>'
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
return shipmodule