Line 2: |
Line 2: |
| local Ship = require('Module:Ship') | | local Ship = require('Module:Ship') |
| local ShipCardKai = require('Module:ShipCardKai') | | local ShipCardKai = require('Module:ShipCardKai') |
− | local ResourceIcons = require('Module:ResourceIcons') | + | local ResourceIcons = require('Module:Data/Asset') |
− | local StatIcons = require('Module:StatIcons') | + | local StatIcons = require('Module:Data/Asset') |
| local Formatting = require('Module:Formatting') | | local Formatting = require('Module:Formatting') |
− | local format = require('Module:StringInterpolation').format | + | local EquipmentLink = require('Module:EquipmentLink') |
| + | local format = require('Module:Core').format |
| | | |
| local ShipInfoKai = BaseData{ | | local ShipInfoKai = BaseData{ |
− | _catbomb = "Catbomb.png|300px",
| |
| _unbuildable = "''Unbuildable''", | | _unbuildable = "''Unbuildable''", |
| _remodel_level = "'''Remodel Level'''", | | _remodel_level = "'''Remodel Level'''", |
Line 23: |
Line 23: |
| _kekkon_template = "After marriage: ${value}; Upper bound: ${max}", | | _kekkon_template = "After marriage: ${value}; Upper bound: ${max}", |
| _remodel_level_stat_value_template = "At remodel level: ${value}", | | _remodel_level_stat_value_template = "At remodel level: ${value}", |
| + | _simple_nick_template = " (''${nick}'')", |
| _nick_template = " (''${nick} ${japanese_nick}'')", | | _nick_template = " (''${nick} ${japanese_nick}'')", |
| _overridden_category_template = "[[Category:Pages that override data modules]]", | | _overridden_category_template = "[[Category:Pages that override data modules]]", |
Line 71: |
Line 72: |
| <p>'''${class} ${type}'''</p> | | <p>'''${class} ${type}'''</p> |
| |- style="background-color: whitesmoke;" | | |- style="background-color: whitesmoke;" |
− | | align=center colspan="6" | ${image} | + | | align=center colspan="6" | <div class="infobox-ship-card">${image}</div> |
| |- | | |- |
| | colspan="6" class="infobox-kai-header-major" style="text-align: center;"|'''Statistics''' | | | colspan="6" class="infobox-kai-header-major" style="text-align: center;"|'''Statistics''' |
| + | |- style="background-color:whitesmoke;" |
| + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.hp} ${labels.hp} |
| + | | style="width: 66px;white-space:nowrap" | '''${hp}''' |
| + | | style="width:88px;white-space:nowrap" | ${icons.firepower} ${labels.firepower} |
| + | | colspan="2" style="width:60px;white-space:nowrap" | '''${firepower}''' |
| + | |- style="background-color:whitesmoke;" |
| + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.armor} ${labels.armor} |
| + | | style="width: 66px;white-space:nowrap" | '''${armor}''' |
| + | | style="width:88px;white-space:nowrap" | ${icons.torpedo} ${labels.torpedo} |
| + | | colspan="2" style="width:66px;white-space:nowrap" | '''${torpedo}''' |
| + | |- style="background-color:whitesmoke;" |
| + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.evasion} ${labels.evasion} |
| + | | style="width: 66px;white-space:nowrap" | '''${evasion}''' |
| + | | style="width:88px;white-space:nowrap" | ${icons.aa} ${labels.aa} |
| + | | colspan="2" style="width:66px;white-space:nowrap" | '''${aa}''' |
| + | |- style="background-color:whitesmoke;" |
| + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.aircraft} ${labels.aircraft} |
| + | | style="width: 66px;white-space:nowrap" | '''${aircraft}''' |
| + | | style="width:88px;white-space:nowrap" | ${icons.asw} ${labels.asw} |
| + | | colspan="2" style="width:66px;white-space:nowrap" | '''${asw}''' |
| + | |- style="background-color:whitesmoke;" |
| + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.speed} ${labels.speed} |
| + | | style="width:66px;white-space:nowrap" | '''${speed}''' |
| + | | style="width:88px;white-space:nowrap" | ${icons.los} ${labels.los} |
| + | | colspan="2" style="width:66px;white-space:nowrap" | '''${los}''' |
| |- style="background-color: whitesmoke;" | | |- style="background-color: whitesmoke;" |
− | | colspan="2" style="width: 88px;" | ${icons.hp} ${labels.hp} | + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.range} ${labels.range} |
− | | style="width: 66px;" | '''${hp}'''
| + | | style="width:66px;white-space:nowrap" | '''${range}''' |
− | | style="width: 88px;" | ${icons.firepower} ${labels.firepower}
| + | | style="width:88px;white-space:nowrap" | ${icons.luck} ${labels.luck} |
− | | colspan="2" style="width: 60px;" | '''${firepower}'''
| + | | colspan="2" style="width:66px;white-space:nowrap" | '''${luck}''' |
− | |- style="background-color: whitesmoke;"
| |
− | | colspan="2" style="width: 88px;" | ${icons.armor} ${labels.armor}
| |
− | | style="width: 66px;" | '''${armor}'''
| |
− | | style="width: 88px;" | ${icons.torpedo} ${labels.torpedo}
| |
− | | colspan="2" style="width: 66px;" | '''${torpedo}''' | |
− | |- style="background-color: whitesmoke;"
| |
− | | colspan="2" style="width: 88px;" | ${icons.evasion} ${labels.evasion}
| |
− | | style="width: 66px;" | '''${evasion}'''
| |
− | | style="width: 88px;" | ${icons.aa} ${labels.aa} | |
− | | colspan="2" style="width: 66px;" | '''${aa}'''
| |
− | |- style="background-color: whitesmoke;"
| |
− | | colspan="2" style="width: 88px;" | ${icons.aircraft} ${labels.aircraft}
| |
− | | style="width: 66px;" | '''${aircraft}'''
| |
− | | style="width: 88px;" | ${icons.asw} ${labels.asw}
| |
− | | colspan="2" style="width: 66px;" | '''${asw}''' | |
− | |- style="background-color: whitesmoke;"
| |
− | | colspan="2" style="width: 88px;" | ${icons.speed} ${labels.speed}
| |
− | | style="width: 66px;" | '''${speed}'''
| |
− | | style="width: 88px;" | ${icons.los} ${labels.los}
| |
− | | colspan="2" style="width: 66px;" | '''${los}'''
| |
− | |- style="background-color: whitesmoke;"
| |
− | | colspan="2" style="width: 88px;" | ${icons.range} ${labels.range}
| |
− | | style="width: 66px;" | '''${range}'''
| |
− | | style="width: 88px;" | ${icons.luck} ${labels.luck}
| |
− | | colspan="2" style="width: 66px;" | '''${luck}'''
| |
| |- | | |- |
| | colspan="6" style="text-align: center; background-color: lightgrey;"|'''Resource Consumption''' | | | colspan="6" style="text-align: center; background-color: lightgrey;"|'''Resource Consumption''' |
| |- style="background-color: whitesmoke;" | | |- style="background-color: whitesmoke;" |
− | | colspan="2" style="width: 88px;" | ${icons.fuel} Fuel | + | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.fuel} Fuel |
− | | style="width: 66px;" | '''${fuel}''' | + | | style="width:66px;white-space:nowrap" | '''${fuel}''' |
− | | style="width: 88px;" | ${icons.ammo} Ammo | + | | style="width:88px;white-space:nowrap" | ${icons.ammo} Ammo |
− | | colspan="2" style="width: 66px;" | '''${ammo}''' | + | | colspan="2" style="width:66px;white-space:nowrap" | '''${ammo}''' |
| |- | | |- |
| | colspan="5" class="infobox-kai-header-major" style="text-align: center;"|${build_remodel_header} | | | colspan="5" class="infobox-kai-header-major" style="text-align: center;"|${build_remodel_header} |
Line 191: |
Line 192: |
| local japanese_nick = self._ship:japanese_nick() | | local japanese_nick = self._ship:japanese_nick() |
| local reading_nick = self._ship:reading_nick() | | local reading_nick = self._ship:reading_nick() |
− | if reading_nick then | + | if japanese_nick and reading_nick then |
| japanese_nick = tostring(Formatting:japanese_text(Formatting:format_stat(japanese_nick), Formatting:format_stat(reading_nick))) | | japanese_nick = tostring(Formatting:japanese_text(Formatting:format_stat(japanese_nick), Formatting:format_stat(reading_nick))) |
| end | | end |
− | self._vars.nick = format{self._nick_template, nick = nick, japanese_nick = japanese_nick} | + | if japanese_nick then |
| + | self._vars.nick = format{self._nick_template, nick = nick, japanese_nick = japanese_nick} |
| + | else |
| + | self._vars.nick = format{self._simple_nick_template, nick = nick} |
| + | end |
| else | | else |
| self._vars.nick = "" | | self._vars.nick = "" |
Line 224: |
Line 229: |
| | | |
| function ShipInfoKai:image() | | function ShipInfoKai:image() |
− | self._vars.image = ShipCardKai:get{ship = self._ship} | + | self._vars.image = ShipCardKai:get{ship = self._ship, hd = true} |
| end | | end |
| | | |
Line 280: |
Line 285: |
| evasion = Formatting:tooltip(evasion, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:evasion_leveled(remodel_level))}) | | evasion = Formatting:tooltip(evasion, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:evasion_leveled(remodel_level))}) |
| end | | end |
− | evasion_max = Formatting:tooltip(evasion_max, format{self._kekkon_max_template, value = Formatting:format_stat(self._ship:evasion_leveled(165))}) | + | evasion_max = Formatting:tooltip(evasion_max, format{self._kekkon_max_template, value = Formatting:format_stat(self._ship:evasion_leveled(180))}) |
| end | | end |
| local result = Formatting:format_stat_with_max(evasion, evasion_max) | | local result = Formatting:format_stat_with_max(evasion, evasion_max) |
Line 319: |
Line 324: |
| asw = Formatting:tooltip(asw, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:asw_leveled(remodel_level))}) | | asw = Formatting:tooltip(asw, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:asw_leveled(remodel_level))}) |
| end | | end |
− | asw_max = Formatting:tooltip(asw_max, format{self._kekkon_max_template, value = Formatting:format_stat(self._ship:asw_leveled(165))}) | + | asw_max = Formatting:tooltip(asw_max, format{self._kekkon_max_template, value = Formatting:format_stat(self._ship:asw_leveled(180))}) |
| end | | end |
| local result = Formatting:format_stat_with_max(asw, asw_max) | | local result = Formatting:format_stat_with_max(asw, asw_max) |
Line 354: |
Line 359: |
| los = Formatting:tooltip(los, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:los_leveled(remodel_level))}) | | los = Formatting:tooltip(los, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:los_leveled(remodel_level))}) |
| end | | end |
− | los_max = Formatting:tooltip(los_max, format{self._kekkon_max_template, value = Formatting:format_stat(self._ship:los_leveled(165))}) | + | los_max = Formatting:tooltip(los_max, format{self._kekkon_max_template, value = Formatting:format_stat(self._ship:los_leveled(180))}) |
| end | | end |
| local result = Formatting:format_stat_with_max(los, los_max) | | local result = Formatting:format_stat_with_max(los, los_max) |
Line 378: |
Line 383: |
| local remodel_from = self._ship:remodel_from() | | local remodel_from = self._ship:remodel_from() |
| if remodel_from then | | if remodel_from then |
− | self._vars.build_remodel_info = Formatting:format_remodel_level_and_item_cost(self._ship:remodel_level(), self._ship:remodel_blueprint(), self._ship:remodel_catapult(), self._ship:remodel_report(), self._ship:remodel_gunmat(), self._ship:remodel_airmat()) | + | self._vars.build_remodel_info = Formatting:format_remodel_level_and_item_cost( |
| + | self._ship:remodel_level(), |
| + | self._ship:remodel_blueprint(), self._ship:remodel_catapult(), self._ship:remodel_report(), |
| + | self._ship:remodel_gunmat(), self._ship:remodel_airmat(), self._ship:remodel_armament() |
| + | ) |
| self._vars.remodel_cost = format{self._remodel_cost_template, remodel_cost = Formatting:format_resources(self._ship:remodel_cost())} | | self._vars.remodel_cost = format{self._remodel_cost_template, remodel_cost = Formatting:format_resources(self._ship:remodel_cost())} |
| else | | else |
Line 399: |
Line 408: |
| end | | end |
| | | |
− | if remodel_from ~= false and remodel_from == self._ship:remodel_to() then | + | -- [[Category:Todo]]: _reversible is a hack |
| + | if remodel_from ~= false and remodel_from == self._ship:remodel_to() or self._ship._reversible then |
| self._vars.reversion_cost = format{self._reversion_cost_template, | | self._vars.reversion_cost = format{self._reversion_cost_template, |
| suffix = Formatting:format_stat(Ship(self._ship:remodel_to()):display_suffix()), | | suffix = Formatting:format_stat(Ship(self._ship:remodel_to()):display_suffix()), |
Line 431: |
Line 441: |
| color = equipment:back() | | color = equipment:back() |
| equipment_type = equipment:type() | | equipment_type = equipment:type() |
− | equipment = Formatting:format_link(equipment:link()) | + | equipment = EquipmentLink.format(nil, { equipment:name() }) |
| if eqStars then | | if eqStars then |
| stars = " " .. Formatting:format_slot_stars(eqStars) | | stars = " " .. Formatting:format_slot_stars(eqStars) |
Line 522: |
Line 532: |
| local labels = {} | | local labels = {} |
| for k,v in pairs(icons) do | | for k,v in pairs(icons) do |
− | icons[k] = Formatting:format_image{v} | + | icons[k] = Formatting:format_image{v, size = "18px"} |
| labels[k] = Formatting:format_stat_name(k) | | labels[k] = Formatting:format_stat_name(k) |
| end | | end |