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:Utils').format | + | local EquipmentLink = require('Module:EquipmentLink') |
− | | + | local format = require('Module:Core').format |
− | local t = require('Module:I18N').t | |
− | local hh = require('Module:View/Flat')
| |
| | | |
| local ShipInfoKai = BaseData{ | | local ShipInfoKai = BaseData{ |
− | _unbuildable = hh.i(t('Unbuildable')), | + | _unbuildable = "''Unbuildable''", |
− | _remodel_level = hh.b(t('Remodel Level')), | + | _remodel_level = "'''Remodel Level'''", |
− | _build_time = hh.b(t('Build Time')), | + | _build_time = "'''Build Time'''", |
| _default_slot_num = 4, | | _default_slot_num = 4, |
− | _normal_construction = t('Normal'), | + | _normal_construction = "Normal", |
| _normal_construction_category = ":Category:Ships buildable in Normal Construction", | | _normal_construction_category = ":Category:Ships buildable in Normal Construction", |
| _large_ship_construction = "LSC", | | _large_ship_construction = "LSC", |
| _large_ship_construction_category = ":Category:Ships buildable in Large Ship Construction", | | _large_ship_construction_category = ":Category:Ships buildable in Large Ship Construction", |
| _ship_data_documentation = "Template:ShipDataDocumentation/EditIntro", | | _ship_data_documentation = "Template:ShipDataDocumentation/EditIntro", |
− | _edit_link_text = t('Edit'), | + | _edit_link_text = "Edit", |
| _localized_name_template = "<br />''${localized_name}''", | | _localized_name_template = "<br />''${localized_name}''", |
| _kekkon_max_template = "Maximum after marriage: ${value}", | | _kekkon_max_template = "Maximum after marriage: ${value}", |
| _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 73: |
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;" | + | |- style="background-color:whitesmoke;" |
| | colspan="2" style="width:88px;white-space:nowrap" | ${icons.hp} ${labels.hp} | | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.hp} ${labels.hp} |
− | | style="width: 66px;" | '''${hp}''' | + | | style="width: 66px;white-space:nowrap" | '''${hp}''' |
| | style="width:88px;white-space:nowrap" | ${icons.firepower} ${labels.firepower} | | | style="width:88px;white-space:nowrap" | ${icons.firepower} ${labels.firepower} |
− | | colspan="2" style="width: 60px;" | '''${firepower}''' | + | | colspan="2" style="width:60px;white-space:nowrap" | '''${firepower}''' |
− | |- style="background-color: whitesmoke;" | + | |- style="background-color:whitesmoke;" |
| | colspan="2" style="width:88px;white-space:nowrap" | ${icons.armor} ${labels.armor} | | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.armor} ${labels.armor} |
− | | style="width: 66px;" | '''${armor}''' | + | | style="width: 66px;white-space:nowrap" | '''${armor}''' |
| | style="width:88px;white-space:nowrap" | ${icons.torpedo} ${labels.torpedo} | | | style="width:88px;white-space:nowrap" | ${icons.torpedo} ${labels.torpedo} |
− | | colspan="2" style="width: 66px;" | '''${torpedo}''' | + | | colspan="2" style="width:66px;white-space:nowrap" | '''${torpedo}''' |
− | |- style="background-color: whitesmoke;" | + | |- style="background-color:whitesmoke;" |
| | colspan="2" style="width:88px;white-space:nowrap" | ${icons.evasion} ${labels.evasion} | | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.evasion} ${labels.evasion} |
− | | style="width: 66px;" | '''${evasion}''' | + | | style="width: 66px;white-space:nowrap" | '''${evasion}''' |
| | style="width:88px;white-space:nowrap" | ${icons.aa} ${labels.aa} | | | style="width:88px;white-space:nowrap" | ${icons.aa} ${labels.aa} |
− | | colspan="2" style="width: 66px;" | '''${aa}''' | + | | colspan="2" style="width:66px;white-space:nowrap" | '''${aa}''' |
− | |- style="background-color: whitesmoke;" | + | |- style="background-color:whitesmoke;" |
| | colspan="2" style="width:88px;white-space:nowrap" | ${icons.aircraft} ${labels.aircraft} | | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.aircraft} ${labels.aircraft} |
− | | style="width: 66px;" | '''${aircraft}''' | + | | style="width: 66px;white-space:nowrap" | '''${aircraft}''' |
| | style="width:88px;white-space:nowrap" | ${icons.asw} ${labels.asw} | | | style="width:88px;white-space:nowrap" | ${icons.asw} ${labels.asw} |
− | | colspan="2" style="width: 66px;" | '''${asw}''' | + | | colspan="2" style="width:66px;white-space:nowrap" | '''${asw}''' |
− | |- style="background-color: whitesmoke;" | + | |- style="background-color:whitesmoke;" |
| | colspan="2" style="width:88px;white-space:nowrap" | ${icons.speed} ${labels.speed} | | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.speed} ${labels.speed} |
− | | style="width: 66px;" | '''${speed}''' | + | | style="width:66px;white-space:nowrap" | '''${speed}''' |
| | style="width:88px;white-space:nowrap" | ${icons.los} ${labels.los} | | | style="width:88px;white-space:nowrap" | ${icons.los} ${labels.los} |
− | | colspan="2" style="width: 66px;" | '''${los}''' | + | | colspan="2" style="width:66px;white-space:nowrap" | '''${los}''' |
| |- style="background-color: whitesmoke;" | | |- style="background-color: whitesmoke;" |
| | colspan="2" style="width:88px;white-space:nowrap" | ${icons.range} ${labels.range} | | | colspan="2" style="width:88px;white-space:nowrap" | ${icons.range} ${labels.range} |
− | | style="width: 66px;" | '''${range}''' | + | | style="width:66px;white-space:nowrap" | '''${range}''' |
| | style="width:88px;white-space:nowrap" | ${icons.luck} ${labels.luck} | | | style="width:88px;white-space:nowrap" | ${icons.luck} ${labels.luck} |
− | | colspan="2" style="width: 66px;" | '''${luck}''' | + | | colspan="2" style="width:66px;white-space:nowrap" | '''${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;white-space:nowrap" | ${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;white-space:nowrap" | ${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 193: |
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 282: |
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(175))}) | + | 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 321: |
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(175))}) | + | 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 356: |
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(175))}) | + | 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 380: |
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 401: |
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 433: |
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 524: |
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 |