• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Changes

Jump to navigation Jump to search
ship level cap 175 -> 180
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}; Upper bound: ${max}",
 +
_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 52: Line 55:  
"build_remodel_header",
 
"build_remodel_header",
 
"build_remodel_info",
 
"build_remodel_info",
"remodel_cost",
   
"slots",
 
"slots",
 
"slot_details",
 
"slot_details",
 +
"gun_fit_properties",
 +
"improvement",
 
},
 
},
 
_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}
 
]],
 
]],
_template = [[{|class="${table_class}" id="${table_id}" style="border: 1px solid darkgray; width: 320px; background-color: #fafafa; float: ${float};"
+
_template = [[{|class="${table_class}" id="${table_id}" style="width: 320px; float: ${float};"
 
|-
 
|-
| colspan="6" style="position: relative; text-align: center; background-color: ${top_bg_color};${top_extra_style}" title="${rarity}" | <div style="position: absolute; right: 5px;">${edit_link}</div>
+
| colspan="6" class="infobox-kai-header-major" style="position: relative; text-align: center; background-color: ${top_bg_color};${top_extra_style}" title="${rarity}" | <div style="position: absolute; right: 5px;">${edit_link}</div>
 
<p><span style="font-size:20px">'''${name}'''</span>${localized_name}</p>
 
<p><span style="font-size:20px">'''${name}'''</span>${localized_name}</p>
 
<div style="font-size:15px">'''No.${id} ${japanese_name}${nick}'''</div>
 
<div style="font-size:15px">'''No.${id} ${japanese_name}${nick}'''</div>
 
<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" style="text-align: center; background-color: LightSkyBlue;"|'''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" style="text-align: center; background-color: LightSkyBlue;"|${build_remodel_header}
+
| colspan="5" class="infobox-kai-header-major" style="text-align: center;"|${build_remodel_header}
| style="text-align: center; background-color: LightSkyBlue; width: 50px;" | '''Slots'''
+
| class="infobox-kai-header-major" style="text-align: center; width: 50px;" | '''Slots'''
 
|-  style="background-color: whitesmoke;"
 
|-  style="background-color: whitesmoke;"
 
| colspan="5" style="text-align: center;"|${build_remodel_info}
 
| colspan="5" style="text-align: center;"|${build_remodel_info}
 
| align=center style="width: 50px;" |${slots}
 
| align=center style="width: 50px;" |${slots}
 
|-
 
|-
| colspan="5" style="text-align: center; background-color: LightSkyBlue;"|'''Stock Equipment'''
+
| colspan="5" class="infobox-kai-header-major" style="text-align: center;"|'''Stock Equipment'''
| style="text-align: center; background-color: LightSkyBlue; width: 50px;" | '''Space'''
+
| class="infobox-kai-header-major" style="text-align: center; width: 50px;" | '''Space'''
 
${slot_details}|-
 
${slot_details}|-
| colspan="6" style="text-align: center; padding: 0px;" | <div class="mw-collapsible mw-collapsed">
+
| colspan="6" style="text-align: center; padding: 0px;" | <div class="mw-collapsible mw-collapsed infobox-kai-expandable-cells">
<div style="background-color: lightskyblue; text-align: center; margin: 0px;">'''Extra Statistics'''</div>
+
<div class="infobox-kai-header-major" style="text-align: center; margin: 0px;">'''Extra Statistics'''</div>
<div class="mw-collapsible-content">${remodel_cost}
+
<div class="mw-collapsible-content">
<div style="text-align: center; background-color: lightgrey; margin:2px 0px 2px;">'''Modernization Bonus'''</div>
+
${remodel_cost}${reversion_cost}<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;">'''Modernization Bonus'''</div>
<div style="text-align: center; background-color: whitesmoke; margin:2px 0px 2px;">${modernization}</div>
+
<div style="text-align: center; margin:2px 0px 2px;">${modernization}</div>
<div style="text-align: center; background-color: lightgrey; margin:2px 0px 2px;">'''Scrap Value'''</div>
+
<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;">'''Scrap Value'''</div>
<div style="text-align: center; background-color: whitesmoke; margin:2px 0px 0px;">${scrap}</div>
+
<div style="text-align: center; margin:2px 0px 0px;">${scrap}</div>
 +
${gun_fit_properties}${improvement}</div>
 
</div>
 
</div>
 +
|}]],
 +
_remodel_cost_template = [[<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;">'''Remodel Cost'''</div>
 +
<div style="text-align: center; margin:2px 0px 2px;">${remodel_cost}</div>
 +
]],
 +
_reversion_cost_template = [[<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;">'''Reversion to ${suffix}'''</div>
 +
<div style="text-align: center; margin:2px 0px 2px;">${level_items}<br />${resources}</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 = "[[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;">
 +
<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-left: 1px; flex-grow: 1; background-color: whitesmoke; display: flex; align-items: center;"><b>${fit}</b></div>
 
</div>
 
</div>
|}]],
+
]],
_remodel_cost_template = [[<div style="text-align: center; background-color: lightgrey; margin:2px 0px 2px;">'''Remodel Cost'''</div>
+
    _improvement_template = [[<div class="infobox-kai-header-minor" style="text-align: center; margin:2px 0px 2px;">'''Improvement'''</div>
<div style="text-align: center; background-color: whitesmoke; margin:2px 0px 2px;">${remodel_cost}</div>]],
+
<div style="text-align: center; background-color: whitesmoke; margin:2px 0px 2px;">${category_tree}</div>
 +
]],
 +
    _improvement_category_template = "Equipment that can be improved with ${ship_name} as helper ship",
 
}
 
}
   Line 144: Line 163:  
function ShipInfoKai:bg_color()
 
function ShipInfoKai:bg_color()
 
local back = self._ship:back()
 
local back = self._ship:back()
self._vars.top_bg_color, self._vars.top_extra_style = Formatting:format_ship_back(back), Formatting:extra_style_background_image(back and back > 7, back and back > 6) or ""
+
self._vars.top_bg_color, self._vars.top_extra_style = Formatting:format_ship_back(back), Formatting:extra_style_background_image(back and back > 7, back and back > 6, self._ship:overlay()) or ""
 
end
 
end
   Line 152: Line 171:     
function ShipInfoKai:name()
 
function ShipInfoKai:name()
self._vars.name = Formatting:format_link(self._ship:link())
+
self._vars.name = Formatting:format_link(self._ship:base_link())
 
end
 
end
   Line 173: 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{japanese_nick, reading_nick})
+
japanese_nick = tostring(Formatting:japanese_text(Formatting:format_stat(japanese_nick), Formatting:format_stat(reading_nick)))
 +
end
 +
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
 
end
self._vars.nick = format{self._nick_template, nick = nick, japanese_nick = japanese_nick}
   
else
 
else
 
self._vars.nick = ""
 
self._vars.nick = ""
Line 206: 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
 +
 
 +
function ShipInfoKai:base_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()
local hp = Formatting:format_stat(self._ship:hp())
+
self:base_hp()
local hp_max = self._ship:hp_max()
+
local hp = self._ship:hp_married()
if hp_max then
+
if hp then
self._vars.hp = Formatting:tooltip(hp, format{self._kekkon_max_template, value = Formatting:format_stat(hp_max)})
+
    local hp_mod = self._ship:hp_mod_married()
else
+
self._vars.hp = Formatting:tooltip(self._vars.hp, format{
self._vars.hp = hp
+
    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 247: Line 279:  
else
 
else
 
evasion_max = self._ship:evasion_max()
 
evasion_max = self._ship:evasion_max()
 +
end
 +
if not overridden and evasion and evasion_max then
 +
    local remodel_level = self._ship:remodel_level()
 +
    if self._ship:remodel_level() then
 +
        evasion = Formatting:tooltip(evasion, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:evasion_leveled(remodel_level))})
 +
    end
 +
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 279: Line 318:  
else
 
else
 
asw_max = self._ship:asw_max()
 
asw_max = self._ship:asw_max()
 +
end
 +
if not overridden and asw and asw_max then
 +
    local remodel_level = self._ship:remodel_level()
 +
    if self._ship:remodel_level() then
 +
    asw = Formatting:tooltip(asw, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:asw_leveled(remodel_level))})
 +
        end
 +
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 307: Line 353:  
else
 
else
 
los_max = self._ship:los_max()
 
los_max = self._ship:los_max()
 +
end
 +
if not overridden and los and los_max then
 +
    local remodel_level = self._ship:remodel_level()
 +
    if self._ship:remodel_level() then
 +
    los = Formatting:tooltip(los, format{self._remodel_level_stat_value_template, value = Formatting:format_stat(self._ship:los_leveled(remodel_level))})
 +
        end
 +
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 324: Line 377:     
function ShipInfoKai:build_remodel_header()
 
function ShipInfoKai:build_remodel_header()
self._vars.build_remodel_header = self._ship:remodel_level() and self._remodel_level or self._build_time
+
self._vars.build_remodel_header = self._ship:remodel_from() and self._remodel_level or self._build_time
 
end
 
end
    
function ShipInfoKai:build_remodel_info()
 
function ShipInfoKai:build_remodel_info()
local remodel_level = self._ship:remodel_level()
+
local remodel_from = self._ship:remodel_from()
if remodel_level or self._ship:remodel_from() then
+
if remodel_from then
self._vars.build_remodel_info = Formatting:format_remodel_level_and_item_cost(remodel_level, self._ship:remodel_cost(), 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())}
 
else
 
else
 
local buildable = self._ship:buildable()
 
local buildable = self._ship:buildable()
Line 342: Line 400:  
table.insert(buildable_methods, Formatting:format_link(self._large_ship_construction_category, self._large_ship_construction))
 
table.insert(buildable_methods, Formatting:format_link(self._large_ship_construction_category, self._large_ship_construction))
 
end
 
end
self._vars.build_remodel_info = Formatting:format_stat_with_max(Formatting:seconds_to_hms(self._ship:build_time() * 60), table.concat(buildable_methods, ", "))
+
self._vars.build_remodel_info = Formatting:format_stat_with_max(Formatting:seconds_to_hms(self._ship:build_time() * 60), table.concat(buildable_methods, ", "))
 
else
 
else
 
local build_time = self._ship:build_time()
 
local build_time = self._ship:build_time()
self._vars.build_remodel_info = build_time and Formatting:tooltip(self._unbuildable, Formatting:seconds_to_hms(build_time * 60)) or self._unbuildable
+
self._vars.build_remodel_info = build_time and Formatting:tooltip(self._unbuildable, Formatting:seconds_to_hms(build_time * 60)) or self._unbuildable
 
end
 
end
 +
self._vars.remodel_cost = ""
 
end
 
end
end
     −
function ShipInfoKai:remodel_cost()
+
    -- [[Category:Todo]]: _reversible is a hack
local remodel_cost = self._ship:remodel_cost()
+
if remodel_from ~= false and remodel_from == self._ship:remodel_to() or self._ship._reversible then
if remodel_cost then
+
self._vars.reversion_cost = format{self._reversion_cost_template,  
self._vars.remodel_cost = format{self._remodel_cost_template, remodel_cost = Formatting:format_resources(remodel_cost)}
+
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(), self._ship:remodel_to_report(), self._ship:remodel_to_gunmat(), self._ship:remodel_to_airmat()),
 +
resources = Formatting:format_resources(self._ship:remodel_to_cost())
 +
}
 
else
 
else
self._vars.remodel_cost = ""
+
self._vars.reversion_cost = ""
 
end
 
end
 
end
 
end
Line 364: Line 425:     
function ShipInfoKai:slot_details()
 
function ShipInfoKai:slot_details()
local slots = {}
+
local slots, num_of_slots, num_of_enabled_slots, slots_to_show = {}, self._ship:slots_length(), self._ship:slots()
local num_of_slots = self._ship:slots_length()
  −
local slots_to_show
   
if num_of_slots then
 
if num_of_slots then
 
slots_to_show = math.max(self._default_slot_num, num_of_slots)
 
slots_to_show = math.max(self._default_slot_num, num_of_slots)
Line 373: Line 432:  
end
 
end
 
for i = 1, slots_to_show do
 
for i = 1, slots_to_show do
local equipment, size, estimation, icon, color, equipment_type
+
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 = false
+
icon = disabled and "" or false
 
color = 0
 
color = 0
equipment = equipment == false and "- Unequipped -" or Formatting:format_stat(equipment)
+
equipment = equipment == false and (disabled and "- Locked -" or "- Unequipped -") or Formatting:format_stat(equipment)
 
equipment_type = false
 
equipment_type = false
 
end
 
end
if size == false then
+
if icon ~= "" then
equipment = Formatting:strike(equipment)
+
icon = Formatting:format_image{Formatting:format_equipment_icon(icon), caption = Formatting:format_equipment_type(equipment_type)}
 
end
 
end
icon = Formatting:format_image{Formatting:format_equipment_icon(icon), caption = Formatting:format_equipment_type(equipment_type)}
   
end
 
end
 
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 415: Line 477:  
function ShipInfoKai:scrap()
 
function ShipInfoKai:scrap()
 
self._vars.scrap = Formatting:format_resources(self._ship:scrap())
 
self._vars.scrap = Formatting:format_resources(self._ship:scrap())
 +
end
 +
 +
function ShipInfoKai:gun_fit_properties()
 +
local ship_type = self._ship:type()
 +
if ship_type == 8 or ship_type == 9 or ship_type == 10 then
 +
local rows = {}
 +
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))})
 +
end
 +
self._vars.gun_fit_properties = format{self._gun_fit_properties_template, gun_fit_groups = table.concat(rows)}
 +
else
 +
self._vars.gun_fit_properties = ""
 +
end
 +
end
 +
 +
function ShipInfoKai:improvement()
 +
    self._vars.improvement = format{self._improvement_template, category_tree = tostring(require('Module:CategoryTree'){category = format{self._improvement_category_template, ship_name = self._ship:name()}, depth = 1})}
 
end
 
end
   Line 422: Line 501:  
else
 
else
 
self._ship = Ship(self._args[1])
 
self._ship = Ship(self._args[1])
 +
end
 +
if self._args.override and self._ship then
 +
    for key, value in pairs(self._args.override) do
 +
            self._ship[key] = value
 +
    end
 
end
 
end
 
end
 
end
Line 448: 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
 
self._vars = {icons = icons, labels = labels}
 
self._vars = {icons = icons, labels = labels}
local table_classes = {"typography-xl-optout", "infobox"}
+
local table_classes = {"typography-xl-optout", "infobox", "infobox-kai", "infobox-ship"}
 
if self._args.classes then
 
if self._args.classes then
 
table.insert(table_classes, self._args.classes)
 
table.insert(table_classes, self._args.classes)
advmod, cssedit, Interface administrators, janitor, Moderators, prechecked, Widget editors
7,360

edits

Navigation menu