| Line 1: |
Line 1: |
| | local U = require("Module:Core") | | local U = require("Module:Core") |
| | + | local DataCaps = require("Module:Data/Caps") |
| | | | |
| | -- Some formatting | | -- Some formatting |
| Line 28: |
Line 29: |
| | | | |
| | local function getMarriedHp(hp, maxHp) | | 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]) | + | return math.min(maxHp, hp + ({3, 4, 4, 5, 6, 7, 7, 8, 8, 9})[math.floor(hp / 10) + 1]) |
| | + | end |
| | + | local function getScaledStat(baseStat, maxStat, level) |
| | + | return math.floor((maxStat-baseStat) /99 * level + baseStat) |
| | + | end |
| | + | local function notNil(value) |
| | + | return value ~= nil and value ~= "" and value ~= "??" |
| | end | | end |
| | | | |
| Line 43: |
Line 50: |
| | local Banners = | | local Banners = |
| | '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>" | | '<td colspan="3" class="double-image" style="width:240px;height:60px">' .. BannerImg .. BannerDmgImg .. "</td>" |
| − | local sortNo = ship.sortno or U.split(ship.no, "-")[1] or "?" | + | local sortNoText = ship.no and (ship.no < 1000 and ship.no or formatTooltip(ship.id, ship.no)) or ship.id |
| − | local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNo .. "</th>" .. Banners .. "</tr>" | + | local MarriedMaxTemplate = "Maximum after marriage: ${value}" |
| | + | local ASWModMaxTemplate = "${value} with ASW modernization" |
| | + | local ASWMarriedMaxTemplate = "Maximum after marriage: ${value} (${valueM})" |
| | + | local RemodelLevelStatValueText = "At remodel level: ${value}" |
| | + | local row1 = "<tr>" .. Cards .. '<th style="text-align: center;">' .. sortNoText .. "</th>" .. Banners .. "</tr>" |
| | -- Formatting Japanese | | -- Formatting Japanese |
| | local kanji, form | | local kanji, form |
| Line 88: |
Line 99: |
| | local JaName = "" | | local JaName = "" |
| | if | | if |
| − | ship.no == "147" or ship.no == "311" or ship.no == "312" or ship.no == "313" or ship.no == "313a" or | + | ship.name[3] == "Verniy" or ship.name[3] == "Gangut" or ship.name[3] == "Oktyabrskaya Revolyutsiya" or ship.name[3] == "Tashkent" or ship.name[3] == "Tashkent Kai" or ship.name[3] == "Gangut Dva" |
| − | ship.no == "316"
| + | then -- Russian ship markup |
| − | then --Russian ship markup | |
| | JaName = | | JaName = |
| | '<ruby lang="ru"><rb>' .. | | '<ruby lang="ru"><rb>' .. |
| Line 112: |
Line 122: |
| | ship.type | | ship.type |
| | local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. ship.name[3] .. "</th></tr>" | | local row2 = '<tr><th colspan="2">' .. JaName .. '</th><th colspan="2">' .. ship.name[3] .. "</th></tr>" |
| − | local row3 = '<tr><td colspan="4" style="text-align: center;">' .. ship.class .. " " .. shipType .. "</td></tr>" | + | local class_string = ship.display_class and formatTooltip(ship.class, "Game library: " .. ship.display_class) or ship.class |
| | + | local row3 = '<tr><td colspan="4" style="text-align: center;">' .. class_string .. " " .. shipType .. "</td></tr>" |
| | local row4 = | | 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>' | | '<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 123: |
Line 134: |
| | local maxHp = ship["hp"][2] | | local maxHp = ship["hp"][2] |
| | local HPinfo | | local HPinfo |
| − | if maxHp then | + | if maxHp and maxHp ~= '??' then |
| | local marriedHp = getMarriedHp(hp, maxHp) | | local marriedHp = getMarriedHp(hp, maxHp) |
| | local maxModHp = math.min(hp + 2, maxHp) | | local maxModHp = math.min(hp + 2, maxHp) |
| Line 138: |
Line 149: |
| | end | | end |
| | local FPinfo = | | local FPinfo = |
| − | statLabel .. "FP [[File:IcoAtk.png|Firepower]]</th>" .. statBox .. ship["fp"][1] .. "→" .. ship["fp"][2] .. "</td>" | + | statLabel .. "FP [[File:IcoAtk.png|18px|Firepower]]</th>" .. statBox .. ship["fp"][1] .. "→" .. ship["fp"][2] .. "</td>" |
| | local row5 = "<tr>" .. HPinfo .. FPinfo .. "</tr>" | | local row5 = "<tr>" .. HPinfo .. FPinfo .. "</tr>" |
| | -- Armor & Torpedo | | -- Armor & Torpedo |
| Line 144: |
Line 155: |
| | statLabel .. | | statLabel .. |
| | "ARM [[File:IcoArmor.png|Armor]]</th>" .. statBox .. ship["armor"][1] .. "→" .. ship["armor"][2] .. "</td>" | | "ARM [[File:IcoArmor.png|Armor]]</th>" .. statBox .. ship["armor"][1] .. "→" .. ship["armor"][2] .. "</td>" |
| − | local Torpedoinfo = statLabel .. "TORP [[File:IcoTorpedo.png|Torpedo]]</th>" .. statBox | + | local Torpedoinfo = statLabel .. "TORP[[File:IcoTorpedo.png|Torpedo]]</th>" .. statBox |
| | if ship["torpedo"] == 0 then | | if ship["torpedo"] == 0 then |
| | Torpedoinfo = Torpedoinfo .. ship["torpedo"] | | Torpedoinfo = Torpedoinfo .. ship["torpedo"] |
| Line 152: |
Line 163: |
| | local row6 = "<tr>" .. Armorinfo .. Torpedoinfo .. "</tr>" | | local row6 = "<tr>" .. Armorinfo .. Torpedoinfo .. "</tr>" |
| | -- Evasion & AA | | -- Evasion & AA |
| − | local Evasioninfo = | + | local Evasioninfo = statLabel .. "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox |
| − | statLabel ..
| + | if notNil(ship["evasion"][1]) and notNil(ship["evasion"][2]) then |
| − | "EVA [[File:IcoEvasion.png|Evasion]]</th>" .. statBox .. ship["evasion"][1] .. "→" .. ship["evasion"][2] .. "</td>"
| + | if notNil(ship["remodellv"]) then |
| | + | Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], ship["remodellv"])}) .. "→" |
| | + | else |
| | + | Evasioninfo = Evasioninfo .. ship["evasion"][1] .. "→" |
| | + | end |
| | + | Evasioninfo = Evasioninfo .. formatTooltip(ship["evasion"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["evasion"][1], ship["evasion"][2], DataCaps.ship_level)}) .. "</td>" |
| | + | else |
| | + | Evasioninfo = Evasioninfo .. ship["evasion"][1] .. "→" .. ship["evasion"][2] |
| | + | end |
| | local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox | | local AAinfo = statLabel .. "AA [[File:IcoAA.png|Anti-Air]]</th>" .. statBox |
| | if ship["aa"] == 0 then | | if ship["aa"] == 0 then |
| Line 168: |
Line 187: |
| | if ship["asw"] == 0 then | | if ship["asw"] == 0 then |
| | ASWinfo = ASWinfo .. ship["asw"] | | ASWinfo = ASWinfo .. ship["asw"] |
| | + | elseif notNil(ship["asw"][1]) and notNil(ship["asw"][2]) then |
| | + | if notNil(ship["remodellv"]) then |
| | + | ASWinfo = ASWinfo .. formatTooltip(ship["asw"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["asw"][1], ship["asw"][2], ship["remodellv"])}) .. "→" |
| | + | else |
| | + | ASWinfo = ASWinfo .. ship["asw"][1] .. "→" |
| | + | end |
| | + | local marriedASW = getScaledStat(ship["asw"][1], ship["asw"][2], DataCaps.ship_level) |
| | + | ASWinfo = ASWinfo .. formatTooltip(ship["asw"][2], U.format{ASWModMaxTemplate, value = ship["asw"][2]+9} .. ". " .. U.format{ASWMarriedMaxTemplate, value = marriedASW, valueM = marriedASW+9} ) |
| | else | | else |
| − | ASWinfo = ASWinfo .. ship["asw"][1] .. "→" .. ship["asw"][2]
| + | ASWinfo = ASWinfo .. ship["asw"][1] .. "→" .. ship["asw"][2] |
| | end | | end |
| | local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>" | | local row8 = "<tr>" .. Planeinfo .. ASWinfo .. "</tr>" |
| | -- Speed & LOS | | -- Speed & LOS |
| | local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>" | | local Speedinfo = statLabel .. "SPD [[File:IcoSpeed.png|Speed]]</th>" .. statBox .. ship["spd"] .. "</td>" |
| − | local LOSinfo = | + | local LOSinfo = statLabel .. "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox |
| − | statLabel ..
| + | if notNil(ship["los"][1]) and notNil(ship["los"][2]) then |
| − | "LOS [[File:IcoLOS.png|Line of Sight]]</th>" .. statBox .. ship["los"][1] .. "→" .. ship["los"][2] .. "</td>"
| + | if notNil(ship["remodellv"]) then |
| | + | LOSinfo = LOSinfo .. formatTooltip(ship["los"][1], U.format{RemodelLevelStatValueText, value = getScaledStat(ship["los"][1], ship["los"][2], ship["remodellv"])}) .. "→" |
| | + | else |
| | + | LOSinfo = LOSinfo .. ship["los"][1] .. "→" |
| | + | end |
| | + | LOSinfo = LOSinfo .. formatTooltip(ship["los"][2], U.format{MarriedMaxTemplate, value = getScaledStat(ship["los"][1], ship["los"][2], DataCaps.ship_level)}) .. "</td>" |
| | + | else |
| | + | LOSinfo = LOSinfo .. ship["los"][1] .. "→" .. ship["los"][2] |
| | + | end |
| | local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>" | | local row9 = "<tr>" .. Speedinfo .. LOSinfo .. "</tr>" |
| | -- Range & Luck | | -- Range & Luck |
| Line 262: |
Line 297: |
| | local constrheader = "" | | local constrheader = "" |
| | local constrdata = "" | | local constrdata = "" |
| − | if ship["remodellv"] ~= nil and ship["remodellv"] ~= "" then | + | if notNil(ship["remodellv"]) then |
| | constrheader = "Remodel Level" | | constrheader = "Remodel Level" |
| | constrdata = ship["remodellv"] | | constrdata = ship["remodellv"] |
| Line 271: |
Line 306: |
| | string.format( | | string.format( |
| | "%s (%s)", | | "%s (%s)", |
| − | formatBuildtime(ship.buildtime[1]), | + | type(ship.buildtime[1]) == "number" and formatBuildtime(ship.buildtime[1]) or "??", |
| | ship.buildtime[2] and ship.buildtime[3] and "Normal, LSC" or ship.buildtime[2] and "Normal" or | | ship.buildtime[2] and ship.buildtime[3] and "Normal, LSC" or ship.buildtime[2] and "Normal" or |
| − | ship.buildtime[3] and "LSC" or | + | ship.buildtime[3] and "LSC" or "Unbuildable" |
| − | "Unbuildable"
| |
| | ) | | ) |
| | end | | end |
| Line 281: |
Line 315: |
| | remodelinfo = | | remodelinfo = |
| | string.format( | | string.format( |
| − | "[[File:IcoSteel.png|18px|Steel]] %d [[File:IcoAmmo.png|18px|Ammo]] %d", | + | "[[File:IcoAmmo.png|18px|Ammo]] %d [[File:IcoSteel.png|18px|Steel]] %d", |
| − | ship.remodelreq[1], | + | ship.remodelreq[2], |
| − | ship.remodelreq[2] | + | ship.remodelreq[1] |
| | ) | | ) |
| | if ship.remodelbp then | | if ship.remodelbp then |
| Line 306: |
Line 340: |
| | string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.remodelar) | | string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.remodelar) |
| | end | | end |
| − | if ship.remodeldevmat or ship.remodelconmat or ship.remodelgunmat or ship.remodelairmat then | + | if ship.remodeldevmat or ship.remodelconmat or ship.remodelgunmat or ship.remodelairmat or ship.remodelarmmat or ship.remodelboiler or ship.overseastech or ship.remodelscrew then |
| | remodelinfo = remodelinfo .. "<br>" | | remodelinfo = remodelinfo .. "<br>" |
| | end | | end |
| Line 352: |
Line 386: |
| | ship.remodelboiler | | ship.remodelboiler |
| | ) | | ) |
| | + | end |
| | + | if ship.overseastech then |
| | + | remodelinfo = |
| | + | remodelinfo .. |
| | + | " " .. |
| | + | string.format( |
| | + | "[[File:Item Icon Latest Overseas Warship Technology.png|18px|Latest Overseas Warship Technology|link=Latest Overseas Warship Technology]] %d", |
| | + | ship.overseastech |
| | + | ) |
| | + | end |
| | + | if ship.remodelscrew then |
| | + | remodelinfo = |
| | + | remodelinfo .. " " .. string.format("[[File:Item Icon Improvement Material.png|18px|Improvement Material|link=Improvement]] %d", ship.remodelscrew) |
| | end | | end |
| | end | | end |
| Line 409: |
Line 456: |
| | "Unknown" | | "Unknown" |
| | return RscHeader .. | | return RscHeader .. |
| − | "Artist</th>" .. RscData .. illustrator .. "</td>" .. RscHeader .. "Seiyuu</th>" .. RscData .. voiceactor .. "</td>" | + | "Illustrator</th>" .. RscData .. illustrator .. "</td>" .. RscHeader .. "Seiyuu</th>" .. RscData .. voiceactor .. "</td>" |
| | end | | end |
| | | | |
| | local function renderCategories(ship) | | local function renderCategories(ship) |
| − | local categories = "[[Category:Ships]][[Category:" .. ship["class"] .. "]][[Category:" .. ship["type"] .. "s]]" | + | local categories = "[[Category:Ships]]" |
| | + | if notNil(ship["class"]) then |
| | + | categories = categories .. "[[Category:" .. ship["class"] .. "]]" |
| | + | end |
| | + | if notNil(ship["type"]) then |
| | + | categories = categories .. "[[Category:" .. ship["type"] .. "s]]" |
| | + | end |
| | if ship["artist"] ~= "Unknown" and ship["artist"] ~= "" then | | if ship["artist"] ~= "Unknown" and ship["artist"] ~= "" then |
| | categories = categories .. "[[Category:" .. ship["artist"] .. "]]" | | categories = categories .. "[[Category:" .. ship["artist"] .. "]]" |
| Line 422: |
Line 475: |
| | return categories | | return categories |
| | end | | end |
| | + | |
| | + | local function renderReversion(ship) --Copy paste mess by Chocolatecravinghobo. Shows information/cost for models that remodel/revert to a previous remodel |
| | + | --- Souya hardcode fix |
| | + | if ship["reversionto"] == "Souya " then |
| | + | ship.reversionto = ship.reversionto .. "(AGS)" |
| | + | end |
| | + | |
| | + | local reversionHeader = "" |
| | + | local reversionStyle = "" |
| | + | local reversionHeader = |
| | + | '<th colspan="4" style="width: 75%; white-space: nowrap; {{border-radius|12px 12px 12px 12px}} background-color: #3baef5; color: #ffffff; vertical-align: baseline;"> Reversible to ' .. ship.reversionto .. "</th>" |
| | + | local reversionStyle = '<td style="white-space: nowrap; text-align: center; vertical-align: baseline;">' |
| | + | local RscHeader = |
| | + | '<th style="width: 25%; white-space: nowrap; {{border-radius|12px 4px 4px 12px}} background-color: #3baef5; color: #ffffff; padding-left: 5px; padding-right: 5px; text-align: right;">' |
| | + | local RscData = '<td style="width: 25%; white-space: nowrap; text-align: center;">' |
| | + | -- Construction info |
| | + | local reversionlvheader = "" |
| | + | local reversionlvdata = "" |
| | + | if notNil(ship["reversionlv"]) then |
| | + | reversionlvheader = "Reversion Level" |
| | + | reversionlvdata = ship["reversionlv"] |
| | + | end |
| | + | local reversioninfo = "" |
| | + | if ship.reversionreq and ship.reversionreq ~= "" then |
| | + | reversioninfo = |
| | + | string.format( |
| | + | "[[File:IcoAmmo.png|18px|Ammo]] %d [[File:IcoSteel.png|18px|Steel]] %d", |
| | + | ship.reversionreq[2], |
| | + | ship.reversionreq[1] |
| | + | ) |
| | + | if ship.reversionbp then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format("[[File:Item Icon Remodel Blueprint.png|25px|Blueprint|link=Blueprints]] %d", ship.reversionbp) |
| | + | end |
| | + | if ship.reversioncatapult then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format( |
| | + | "[[File:Item Icon Prototype Flight Deck Catapult.png|25px|Prototype Flight Deck Catapult|link=Prototype Flight Deck Catapult]] %d", |
| | + | ship.reversioncatapult |
| | + | ) |
| | + | end |
| | + | if ship.reversionar then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format("[[File:Item Icon Action Report.png|25px|Action Report|link=Action Report]] %d", ship.reversionar) |
| | + | end |
| | + | if ship.reversiondevmat or ship.reversionconmat or ship.reversiongunmat or ship.reversionairmat or ship.reversionarmmat or ship.reversionboiler or ship.reversionscrew then |
| | + | reversioninfo = reversioninfo .. "<br>" |
| | + | end |
| | + | if ship.reversiondevmat then |
| | + | reversioninfo = |
| | + | reversioninfo .. " " .. string.format("[[File:IcoDevmat.png|18px|Development Material]] %d", ship.reversiondevmat) |
| | + | end |
| | + | if ship.reversionconmat then |
| | + | reversioninfo = |
| | + | reversioninfo .. " " .. string.format("[[File:IcoConmat.png|18px|Construction Material]] %d", ship.reversionconmat) |
| | + | end |
| | + | if ship.reversiongunmat then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format( |
| | + | "[[File:Item Icon New Model Gun Mount Improvement Material.png|18px|New Model Gun Mount Improvement Material|link=New Model Gun Development Material]] %d", |
| | + | ship.reversiongunmat |
| | + | ) |
| | + | end |
| | + | if ship.reversionairmat then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format( |
| | + | "[[File:Item Icon New Model Aerial Armament Material.png|18px|New Model Aerial Armament Material|link=New Model Aviation Development Material]] %d", |
| | + | ship.reversionairmat |
| | + | ) |
| | + | end |
| | + | if ship.reversionarmmat then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format( |
| | + | "[[File:Item Icon New Model Armament Material.png|18px|New Model Armament Material|link=New Model Armament Material]] %d", |
| | + | ship.reversionarmmat |
| | + | ) |
| | + | end |
| | + | if ship.reversionboiler then |
| | + | reversioninfo = |
| | + | reversioninfo .. |
| | + | " " .. |
| | + | string.format( |
| | + | "[[File:Item Icon New Model High Temperature High Pressure Boiler.png|18px|New Model High Temperature High Pressure Boiler|link=New Model High Temperature High Pressure Boiler]] %d", |
| | + | ship.reversionboiler |
| | + | ) |
| | + | end |
| | + | if ship.reversionscrew then |
| | + | reversioninfo = reversioninfo .. " " .. string.format( |
| | + | "[[File:Item Icon Improvement Material.png|18px|Improvement Material|link=Improvement]] %d", |
| | + | ship.reversionscrew |
| | + | ) |
| | + | end |
| | + | end |
| | + | -- Reversion |
| | + | local row14 = "" |
| | + | local row15 = "" |
| | + | if ship.reversionlv ~= "" then |
| | + | row14 = "<tr>" .. reversionHeader .. "</tr>"-- .. reversionStyle |
| | + | row15 = |
| | + | "<tr>" .. |
| | + | RscHeader .. |
| | + | reversionlvheader .. |
| | + | "</th>" .. |
| | + | RscData .. |
| | + | reversionlvdata .. "</td>" .. RscHeader .. "Reversion Req</th>" .. RscData .. reversioninfo .. "</td></tr>" |
| | + | end |
| | + | return row14 .. row15 |
| | + | end |
| | + | |
| | | | |
| | -- Converting to legacy data format | | -- Converting to legacy data format |
| Line 431: |
Line 605: |
| | | | |
| | local function minMaxStats(a, b) | | local function minMaxStats(a, b) |
| − | return (not a or a == 0) and (not b or b == 0) and 0 or {a or '', b or ''} | + | return a == nil and b == nil and {'??', '??'} or (a == false or a == 0) and (b == false or b == 0) and 0 or {a or '??', b or '??'} |
| | end | | end |
| | | | |
| Line 438: |
Line 612: |
| | end | | end |
| | | | |
| − | local function loadShipData(no) | + | local function loadShipData(key) |
| − | local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[no] or no, "name") or {}).id]) | + | local ship = Ship(shipsById[(U.find(shipsByNo, ShipData[key] or key, "name") or {}).id] or key) |
| | local data = {} | | local data = {} |
| − | data.no = no | + | data.id = ship:id() or "??" |
| | + | data.no = ship:true_id() |
| | data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""} | | data.name = {ship:japanese_name() or "", ship:reading() or "", ship:name() or ""} |
| | local class = ship:class() | | local class = ship:class() |
| − | data.class = class and ship:class():name() or "???" | + | data.class = class and class:name() or "??" |
| | + | data.display_class = ship._display_class |
| | data.type = ship:formatted_type() or "" | | data.type = ship:formatted_type() or "" |
| | data.spd = ship:formatted_speed() or "" | | data.spd = ship:formatted_speed() or "" |
| Line 455: |
Line 631: |
| | data.aa = minMaxStats(ship:aa(), ship:aa_max()) | | data.aa = minMaxStats(ship:aa(), ship:aa_max()) |
| | data.luck = minMaxStats(ship:luck(), ship:luck_max()) | | data.luck = minMaxStats(ship:luck(), ship:luck_max()) |
| − | data.evasion = {ship:evasion() or '', ship:evasion_max() or ''} | + | data.evasion = minMaxStats(ship:evasion(), ship:evasion_max()) |
| − | data.asw = {ship:asw() or '', ship:asw_max() or ''} | + | data.asw = minMaxStats(ship:asw(), ship:asw_max()) |
| − | data.los = {ship:los() or '', ship:los_max() or ''} | + | data.los = minMaxStats(ship:los(), ship:los_max()) |
| | data.aircraft = {} | | data.aircraft = {} |
| | data.equip = {} | | data.equip = {} |
| − | for _, v in ipairs(ship._equipment) do | + | for _, v in ipairs(ship._equipment or {}) do |
| − | table.insert(data.equip, v.equipment == nil and '?' or v.equipment or '') | + | table.insert(data.equip, (v.equipment == nil and '?' or v.equipment or '') .. (v.stars and string.format(' ★+%d', v.stars) or '')) |
| | table.insert(data.aircraft, v.size or "") | | table.insert(data.aircraft, v.size or "") |
| | end | | end |
| Line 495: |
Line 671: |
| | data.remodelgunmat = trueIsOne(ship._remodel_gunmat) | | data.remodelgunmat = trueIsOne(ship._remodel_gunmat) |
| | data.remodelairmat = trueIsOne(ship._remodel_airmat) | | data.remodelairmat = trueIsOne(ship._remodel_airmat) |
| | + | data.remodelarmmat = trueIsOne(ship._remodel_armament) |
| | + | data.remodelboiler = trueIsOne(ship._remodel_boiler) |
| | + | data.overseastech = trueIsOne(ship._remodel_overseas) |
| | data.remodeldevmat = trueIsOne(ship._remodel_development_material) | | data.remodeldevmat = trueIsOne(ship._remodel_development_material) |
| | data.remodelconmat = trueIsOne(ship._remodel_construction_material) | | data.remodelconmat = trueIsOne(ship._remodel_construction_material) |
| | + | data.remodelscrew = trueIsOne(ship._remodel_screw) |
| | + | |
| | + | data.reversible = trueIsOne(ship._reversible) |
| | + | data.reversionto = ship:remodel_to() or "" |
| | + | data.reversionto = data.reversionto:gsub("/", " ") |
| | + | data.reversionbp = trueIsOne(ship._remodel_to_blueprint) |
| | + | data.reversionlv = ship:remodel_to_level() or "" |
| | + | data.reversionreq = not ship._remodel_to_steel and not ship._remodel_to_ammo and '' or {ship._remodel_to_steel or 0, ship._remodel_to_ammo or 0} |
| | + | data.reversionbp = trueIsOne(ship._remodel_to_blueprint) |
| | + | data.reversioncatapult = trueIsOne(ship._remodel_to_catapult) |
| | + | data.reversionar = trueIsOne(ship._remodel_to_report) |
| | + | data.reversiongunmat = trueIsOne(ship._remodel_to_gunmat) |
| | + | data.reversionairmat = trueIsOne(ship._remodel_to_airmat) |
| | + | data.reversionarmmat = trueIsOne(ship._remodel_to_armament) |
| | + | data.reversionboiler = trueIsOne(ship._remodel_to_boiler) |
| | + | data.reversiondevmat = trueIsOne(ship._remodel_to_development_material) |
| | + | data.reversionconmat = trueIsOne(ship._remodel_to_construction_material) |
| | + | data.reversionscrew = trueIsOne(ship._remodel_to_screw) |
| | return data | | return data |
| | end | | end |
| Line 508: |
Line 705: |
| | '<table style="width:100%">' .. | | '<table style="width:100%">' .. |
| | renderModernization(ship) .. | | renderModernization(ship) .. |
| − | renderArtists(ship) .. "</table></td></tr></table></div>" .. renderCategories(ship) | + | renderArtists(ship) .. |
| | + | renderReversion(ship) .. "</table></td></tr></table></div>" .. renderCategories(ship) |
| | end | | end |
| | | | |