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 21: |
Line 21: |
| _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}", | + | _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 61: |
Line 62: |
| _slot_template = [[|- align=center style="background-color: whitesmoke; line-height: 1.1;" | | _slot_template = [[|- align=center style="background-color: whitesmoke; line-height: 1.1;" |
| | style="width: 36px; height: 36px; background-color: ${color};${extra_style}" | ${icon} | | | style="width: 36px; height: 36px; background-color: ${color};${extra_style}" | ${icon} |
− | | colspan="4" style="width: 190px;" | ${equipment} | + | | colspan="4" style="width: 190px;" | ${equipment}${stars} |
| | style="width: 50px;" | ${slot_size} | | | style="width: 50px;" | ${slot_size} |
| ]], | | ]], |
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 138: |
Line 139: |
| ]], | | ]], |
| _gun_fit_properties_template = format{[[<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;"><b>${subtitle}</b></div> | | _gun_fit_properties_template = format{[[<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;"><b>${subtitle}</b></div> |
− | ${gun_fit_groups}]], subtitle = Formatting:tooltip("Large Caliber Fit Gun Properties", "Based on experimental findings")}, | + | ${gun_fit_groups}]], subtitle = "[[Overweight_Penalty_and_Fit_Gun_Bonus#Battleships|Large Caliber Fit Gun Properties]]"}, |
| _gun_fit_group_template = [[<div style="text-align: left; display: flex; margin: 2px 0px;"> | | _gun_fit_group_template = [[<div style="text-align: left; display: flex; margin: 2px 0px;"> |
| <div style="margin-right: 1px; flex-shrink: 0; flex-basis: 140px; background-color: whitesmoke; display: flex; align-items: center;"><span>${fit_group}</span></div> | | <div style="margin-right: 1px; flex-shrink: 0; flex-basis: 140px; background-color: whitesmoke; display: flex; align-items: center;"><span>${fit_group}</span></div> |
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 |
| | | |
− | --HP without considering marriage; used directly in EnemyShipInfoKai
| |
| function ShipInfoKai:base_hp() | | function ShipInfoKai:base_hp() |
− | self._vars.hp = Formatting:format_stat(self._ship:hp()) | + | local hp = self._ship:hp() |
| + | local hp_mod = self._ship:hp_mod() |
| + | self._vars.hp = hp_mod and hp_mod > 0 and Formatting:format_stat_with_max(hp, hp + hp_mod) or Formatting:format_stat(hp) |
| end | | end |
| | | |
| function ShipInfoKai:hp() | | function ShipInfoKai:hp() |
| self:base_hp() | | self:base_hp() |
− | local hp_married = self._ship:hp_married() | + | local hp = self._ship:hp_married() |
− | if hp_married then | + | if hp then |
− | self._vars.hp = Formatting:tooltip(self._vars.hp, format{self._kekkon_template, value = Formatting:format_stat(hp_married)}) | + | local hp_mod = self._ship:hp_mod_married() |
| + | self._vars.hp = Formatting:tooltip(self._vars.hp, format{ |
| + | self._kekkon_template, |
| + | value = hp_mod and hp_mod > 0 and Formatting:format_stat_with_max(hp, hp + hp_mod) or Formatting:format_stat(hp), |
| + | max = Formatting:format_stat(self._ship:hp_max()) |
| + | }) |
| end | | end |
| end | | end |
Line 274: |
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(155))}) | + | 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 313: |
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(155))}) | + | 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 348: |
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(155))}) | + | 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 372: |
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._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 393: |
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()), |
− | level_items = Formatting:format_remodel_level_and_item_cost(self._ship:remodel_to_level(), self._ship:remodel_to_blueprint(), self._ship:remodel_to_catapult()), | + | level_items = Formatting:format_remodel_level_and_item_cost(self._ship:remodel_to_level(), self._ship:remodel_to_blueprint(), self._ship:remodel_to_catapult(), self._ship:remodel_to_report(), self._ship:remodel_to_gunmat(), self._ship:remodel_to_airmat()), |
| resources = Formatting:format_resources(self._ship:remodel_to_cost()) | | resources = Formatting:format_resources(self._ship:remodel_to_cost()) |
| } | | } |
Line 416: |
Line 432: |
| end | | end |
| for i = 1, slots_to_show do | | for i = 1, slots_to_show do |
− | local disabled, equipment, size, estimation, icon, color, equipment_type = num_of_enabled_slots and i > num_of_enabled_slots | + | local disabled, equipment, stars, size, estimation, icon, color, equipment_type = num_of_enabled_slots and i > num_of_enabled_slots |
| if num_of_slots and i > num_of_slots then | | if num_of_slots and i > num_of_slots then |
| equipment, size, estimation, icon, color, equipment_type = "- Locked -", false, false, "", 0, false | | equipment, size, estimation, icon, color, equipment_type = "- Locked -", false, false, "", 0, false |
| else | | else |
− | equipment, size, estimation = self._ship:slot(i) | + | equipment, size, estimation, eqStars = self._ship:slot(i) |
| if equipment then | | if equipment then |
| icon = equipment:icon() | | icon = equipment:icon() |
| 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 |
| + | stars = " " .. Formatting:format_slot_stars(eqStars) |
| + | end |
| else | | else |
| icon = disabled and "" or false | | icon = disabled and "" or false |
Line 438: |
Line 457: |
| table.insert(slots, format{self._slot_template, | | table.insert(slots, format{self._slot_template, |
| icon = icon, | | icon = icon, |
− | equipment = equipment, | + | equipment = equipment, |
| + | stars = stars or "", |
| slot_size = Formatting:format_slot_size(size, estimation), | | slot_size = Formatting:format_slot_size(size, estimation), |
| color = "whitesmoke", --Formatting:format_equipment_back(color), | | color = "whitesmoke", --Formatting:format_equipment_back(color), |
Line 463: |
Line 483: |
| if ship_type == 8 or ship_type == 9 or ship_type == 10 then | | if ship_type == 8 or ship_type == 9 or ship_type == 10 then |
| local rows = {} | | local rows = {} |
− | for _, fit_group in ipairs(require('Module:LargeCaliberMainGunFit').fit_groups) do | + | for _, fit_group in ipairs(require('Module:GunFitGroups').large_caliber) do |
| table.insert(rows, format{self._gun_fit_group_template, fit_group = fit_group, fit = Formatting:format_fit_bonus(self._ship:gun_fit_properties(fit_group))}) | | table.insert(rows, format{self._gun_fit_group_template, fit_group = fit_group, fit = Formatting:format_fit_bonus(self._ship:gun_fit_properties(fit_group))}) |
| end | | end |
Line 512: |
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 |