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

Difference between revisions of "Module:EliteShipsKai"

From Kancolle Wiki
Jump to navigation Jump to search
com>Ckwng
(ship level cap 175 -> 180)
 
(122 intermediate revisions by 5 users not shown)
Line 1: Line 1:
local ResourceIcons = require('Module:ResourceIcons')
+
local BaseTable = require('Module:BaseTable')
local StatIcons = require('Module:StatIcons')
+
local Formatting = require('Module:Formatting')
local MiscIcons = require('Module:MiscIcons')
+
local ResourceIcons = require('Module:Data/Asset')
 
local Ship = require('Module:Ship')
 
local Ship = require('Module:Ship')
local Formatting = require('Module:Formatting')
+
local StatIcons = require('Module:Data/Asset')
local format = require('Module:StringInterpolation').format
+
 
 +
local format = require('Module:Core').format
 +
local split = require('Module:Core').split
  
local EliteShipsKai = {
+
local EliteShipsKai = BaseTable({
_table_start = [[{| class="wikitable"]],
+
_table_start = [[{| class="wikitable typography-xl-optout" style="width: -moz-max-content; width: -webkit-max-content; width: max-content;"]],
_row_starter = "|-",
 
 
_header_template = [[!No.
 
_header_template = [[!No.
 
!Name
 
!Name
 
!Class
 
!Class
! style="white-space:nowrap;" | ${remodel_icon}
+
! style="white-space:nowrap;" | ${remodel}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: LightCoral;" | ${firepower_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: LightSkyBlue;" | ${torpedo_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: SandyBrown;" | ${aa_icon}
+
${night_battle_header_cell}! style="width: 24px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: Aquamarine;" | ${los_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: aquamarine;" | ${los}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: PaleGreen;" | ${luck_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: Pink;" | ${hp_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: pink;" | ${hp}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: Violet;" | ${evasion_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #72E6E6;" | ${speed_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #72E6E6;" | ${speed}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: Silver;" | ${aircraft_icon}
+
${range_header_cell}! style="width: 24px; text-align: center; vertical-align: middle; background-color: silver;" | ${aircraft}
! ${fuel_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: forestgreen;" | ${fuel}
! ${ammo_icon}
+
! style="width: 24px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
! style="text-align:left;" | Notes]],
+
! class="toggle-target-eliteshipskai-detail" style="text-align:left;" | Notes]],
 
_column_cell_templates = {
 
_column_cell_templates = {
name = [[| colspan="1" rowspan="${rowspan}" style="text-align:center; background-color: ${bg_color}" | ${value.link} ${value.japanese_name}]],
+
luck = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;" | ${values.luck}(${values.luck_max})]],
luck = [[| colspan="1" rowspan="${rowspan}" style="text-align:center; background-color: ${bg_color}" | ${value.initial} (${value.max})]],
+
id = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;${extra_style}" |${values.value}]],
aircraft = [[| colspan="1" rowspan="${rowspan}" style="text-align:center; background-color: ${bg_color}" | ${value.total}<br />(${value.slots})]],
+
notes = [[| class="${class}" colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;" |<small>${values.value}</small>]],
 +
["!"] = [[| class="${class}" colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;" |<div style="max-width: 600px;">${values.value}</div>]]
 
},
 
},
_columns = {
+
_night_battle_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle; background-color: slategrey;" | ${firepower}${torpedo}
 +
]],
 +
_range_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle;" | ${range}
 +
]],
 +
_base_columns = { --gets copied to self._columns in create_table_prep so we can mutate it. Don't mutate base_columns!
 
"id",
 
"id",
 
"name",
 
"name",
Line 38: Line 44:
 
"remodel",
 
"remodel",
 
"firepower",
 
"firepower",
"torpedo",
+
"torpedo", --night_battle is added after this depending on args in create_table_prep. If adding columns please preserve this behaviour.
 
"aa",
 
"aa",
 
"asw",
 
"asw",
Line 46: Line 52:
 
"armor",
 
"armor",
 
"evasion",
 
"evasion",
"speed",
+
"speed", --range is added after this depending on args in create_table_prep. If adding columns please preserve this behaviour.
 
"aircraft",
 
"aircraft",
 
"fuel",
 
"fuel",
Line 52: Line 58:
 
"notes",
 
"notes",
 
},
 
},
_cell_color = {
+
_no_remodel_level = "-",
firepower = "#F0C0C0",
+
_simple_class = "toggle-anti-target-eliteshipskai-detail",
torpedo = "#C0E4FA",
+
_detailed_class = "toggle-target-eliteshipskai-detail hidden",
aa = "#F4CAA6",
+
_detailed_start = '<span class="toggle-target-eliteshipskai-detail hidden">',
asw = "#C5BEEE",
+
_detailed_end = '</span>',
los = "#CCFFEE",
+
_name_style = {["max-width"] = "150px"},
luck = "#C9FBC9",
+
_detailed_columns = 1,
hp = "#FFD9DF",
+
_detail_toggle = '<div class="toggle" data-target="eliteshipskai-detail" data-anti-target="eliteshipskai-detail" data-default="hide" style="display: none;"><span class="toggle-show" style="cursor: pointer; color: #006cb0;">☑ Show details</span><span class="toggle-hide" style="cursor: pointer; color: #006cb0;">☒ Show details</span></div>',
armor = "#F2ECC2",
+
_nickname_template = "''${nick} ${japanese_nick}''",
evasion = "#EEBEEE",
+
_kekkon_max_template = "Maximum after marriage: ${value}",
speed = "#B8E6E6",
+
_kekkon_template = "After marriage: ${value}",
aircraft = "#D9D9D9",
+
_item_class = Ship,
},
+
})
_good_stat_color = "yellow",
 
_outstanding_stat_color = "lime",
 
_cell = [[| colspan="1" rowspan="${rowspan}" style="text-align:center; background-color: ${bg_color}" | ${value.value}]],
 
_table_end = [[|}]],
 
_rowspan_suffix = "_rowspan",
 
_bg_color_suffix = "_bg_color",
 
_outstanding_suffix = "_outstanding",
 
_good_suffix = "_good",
 
_operator_suffix = "_operator",
 
_notes_suffix = "_notes",
 
_transparent = "transparent",
 
_emphasis_template = "''${value}''",
 
_operators = {
 
["<"] = function(x,y) return x < y end,
 
[">"] = function(x,y) return x > y end,
 
}
 
}
 
  
function EliteShipsKai:get_bg_color(value, operator, outstanding, good)
+
function EliteShipsKai:name(ship)
if not value then
+
local link, text, section = ship:link()
return self._transparent
+
local value = {Formatting:inline_block(Formatting:format_link(link, text, section))}
 +
local japanese_name = ship:japanese_name()
 +
if japanese_name and (text or link) ~= japanese_name then
 +
table.insert(value, self._detailed_start)
 +
table.insert(value, " ")
 +
table.insert(value, self._detailed_end)
 +
table.insert(value, self._detailed_start)
 +
table.insert(value, Formatting:inline_block(Formatting:format_stat(japanese_name)))
 +
table.insert(value, self._detailed_end)
 
end
 
end
local comparison = self._operators[operator or ">"]
+
local nick = ship:nick()
if outstanding and comparison(value, tonumber(outstanding)) then
+
if nick then
return self._outstanding_stat_color
+
table.insert(value, "<br />")
elseif good and comparison(value, tonumber(good)) then
+
table.insert(value, self._detailed_start)
return self._good_stat_color
+
table.insert(value, Formatting:inline_block(format{self._nickname_template,
else
+
    nick = Formatting:format_stat(nick),  
return self._transparent
+
    japanese_nick = Formatting:format_stat(ship:japanese_nick())}))
 +
table.insert(value, self._detailed_end)
 
end
 
end
 +
return {values = {value = Formatting:inline_block(table.concat(value), nil, self._name_style)}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:get_emphasis(value, formatted, operator, good)
+
function EliteShipsKai:id(ship)
local comparison = self._operators[operator or ">"]
+
local back = ship:back()
if value and good and comparison(value, tonumber(good)) then
+
return {values = {value = Formatting:format_stat(ship:id())},
return format{self._emphasis_template, value = formatted}
+
bg_color = self._transparent, --Formatting:format_ship_back(back),
end
+
extra_style = "", --Formatting:extra_style_background_image(back and back > 7, back and back > 6) or ""
return formatted
+
text_align = self._center_align
 +
}
 
end
 
end
  
function EliteShipsKai:name(ship)
+
function EliteShipsKai:class(ship)
return {values = {link = ship:link(), japanese_name = ship:japanese_name()}, bg_color = self._transparent}
+
local class = ship:class()
 +
if class then
 +
local ship_type = ship:type()
 +
local value = class:short_base_name()
 +
local show_type
 +
if self._reference_types then
 +
show_type = not self._reference_types[ship_type]
 +
else
 +
show_type = ship_type ~= class:base_type()
 +
end
 +
if show_type then
 +
value = Formatting:format_stat_with_detail(value, Formatting:format_ship_code(ship_type))
 +
end
 +
return {values = {value = value}, bg_color = self._transparent, text_align = self._center_align}
 +
else
 +
return {values = {value = "??"}, bg_color = self._transparent, text_align = self._center_align}
 +
end
 
end
 
end
  
function EliteShipsKai:id(ship)
+
function EliteShipsKai:remodel(ship)
return {values = {value = ship:id()}, bg_color = self._transparent}
+
local remodel_level = ship:remodel_level()
 +
return {values = {value = Formatting:format_stat(remodel_level == false and self._no_remodel_level or remodel_level)}, bg_color = self:get_bg_color(self._cell_color.remodel, remodel_level, self._args.remodel_level_operator, self._args.remodel_level_outstanding, self._args.remodel_level_good, self._args.remodel_level_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:class(ship)
+
function EliteShipsKai:firepower(ship)
return {values = {value = ship:class()}, bg_color = self._transparent}
+
local firepower_max = ship:firepower_max()
 +
if firepower_max == false then
 +
firepower_max = ship:firepower()
 +
end
 +
return {values = {value = Formatting:format_stat(firepower_max)}, bg_color = self:get_bg_color(self._cell_color.firepower, firepower_max, self._args.firepower_operator, self._args.firepower_outstanding, self._args.firepower_good, self._args.firepower_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:remodel(ship, args)
+
function EliteShipsKai:torpedo(ship)
local remodel_level = ship:remodel_level()
+
local torpedo_max = ship:torpedo_max()
return {values = {value = Formatting:format_stat(remodel_level)}, bg_color = self:get_bg_color(remodel_level, args.remodel_level_operator, args.remodel_level_outstanding, args.remodel_level_good)}
+
if torpedo_max == false then
 +
torpedo_max = ship:torpedo()
 +
end
 +
return {values = {value = Formatting:format_stat(torpedo_max)}, bg_color = self:get_bg_color(self._cell_color.torpedo, torpedo_max, self._args.torpedo_operator, self._args.torpedo_outstanding, self._args.torpedo_good, self._args.torpedo_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:firepower(ship, args)
+
function EliteShipsKai:night_battle(ship)
 
local firepower_max = ship:firepower_max()
 
local firepower_max = ship:firepower_max()
return {values = {value = Formatting:format_stat(firepower_max)}, bg_color = self:get_bg_color(firepower_max, args.firepower_operator, args.firepower_outstanding, args.firepower_good)}
+
if firepower_max == false then
 +
firepower_max = ship:firepower()
 +
end
 +
local torpedo_max = ship:torpedo_max()
 +
if torpedo_max == false then
 +
torpedo_max = ship:torpedo()
 +
end
 +
local night_battle = firepower_max
 +
if not firepower_max then
 +
    night_battle = torpedo_max
 +
elseif torpedo_max then
 +
    night_battle = night_battle + torpedo_max
 +
end
 +
return {values = {value = Formatting:format_stat(night_battle)}, bg_color = self:get_bg_color(self._cell_color.night_battle, night_battle, self._args.night_battle_operator, self._args.night_battle_outstanding, self._args.night_battle_good, self._args.night_battle_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:torpedo(ship, args)
+
function EliteShipsKai:range(ship)
local torpedo_max = ship:torpedo_max()
+
local range = ship:range()
return {values = {value = Formatting:format_stat(torpedo_max)}, bg_color = self:get_bg_color(torpedo_max, args.torpedo_operator, args.torpedo_outstanding, args.torpedo_good)}
+
return {values = {value = Formatting:format_range(range)}, bg_color = self:get_bg_color(self._cell_color.range, range, self._args.range_operator, self._args.range_outstanding, self._args.range_good, self._args.range_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:aa(ship, args)
+
function EliteShipsKai:aa(ship)
 
local aa_max = ship:aa_max()
 
local aa_max = ship:aa_max()
return {values = {value = Formatting:format_stat(aa_max)}, bg_color = self:get_bg_color(aa_max, args.aa_operator, args.aa_outstanding, args.aa_good)}
+
if aa_max == false then
 +
aa_max = ship:aa()
 +
end
 +
return {values = {value = Formatting:format_stat(aa_max)}, bg_color = self:get_bg_color(self._cell_color.aa, aa_max, self._args.aa_operator, self._args.aa_outstanding, self._args.aa_good, self._args.aa_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:asw(ship, args)
+
function EliteShipsKai:asw(ship)
 
local asw_max = ship:asw_max()
 
local asw_max = ship:asw_max()
return {values = {value = Formatting:format_stat(asw_max)}, bg_color = self:get_bg_color(asw_max, args.asw_operator, args.asw_outstanding, args.asw_good)}
+
if asw_max == false then
 +
asw_max = ship:asw()
 +
return {values = {value = Formatting:format_stat(asw_max)}, bg_color = self:get_bg_color(self._cell_color.asw, asw_max, self._args.asw_operator, self._args.asw_outstanding, self._args.asw_good, self._args.asw_bad), text_align = self._center_align}
 +
end
 +
return {values = {value = Formatting:tooltip(Formatting:format_stat(asw_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:asw_leveled(180))})}, bg_color = self:get_bg_color(self._cell_color.asw, asw_max, self._args.asw_operator, self._args.asw_outstanding, self._args.asw_good, self._args.asw_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:los(ship, args)
+
function EliteShipsKai:los(ship)
 
local los_max = ship:los_max()
 
local los_max = ship:los_max()
return {values = {value = Formatting:format_stat(los_max)}, bg_color = self:get_bg_color(los_max, args.los_operator, args.los_outstanding, args.los_good)}
+
if los_max == false then
 +
los_max = ship:los()
 +
return {values = {value = Formatting:format_stat(los_max)}, bg_color = self:get_bg_color(self._cell_color.los, los_max, self._args.los_operator, self._args.los_outstanding, self._args.los_good, self._args.los_bad), text_align = self._center_align}
 +
end
 +
return {values = {value = Formatting:tooltip(Formatting:format_stat(los_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:los_leveled(180))})}, bg_color = self:get_bg_color(self._cell_color.los, los_max, self._args.los_operator, self._args.los_outstanding, self._args.los_good, self._args.los_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:luck(ship, args)
+
function EliteShipsKai:luck(ship)
 
local luck = ship:luck()
 
local luck = ship:luck()
 
local luck_max = ship:luck_max()
 
local luck_max = ship:luck_max()
return {values = {luck = Formatting:format_stat(luck), luck_max = self:get_emphasis(luck_max, Formatting:format_stat(luck_max), args.luck_max_operator, args.luck_max_good)}, bg_color = self:get_bg_color(luck, args.luck_operator, args.luck_outstanding, args.luck_good)}
+
return {values = {luck = Formatting:format_stat(luck), luck_max = self:get_emphasis(luck_max, Formatting:format_stat(luck_max), self._args.luck_max_operator, self._args.luck_max_good)}, bg_color = self:get_bg_color(self._cell_color.luck, luck, self._args.luck_operator, self._args.luck_outstanding, self._args.luck_good, self._args.luck_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:hp(ship, args)
+
function EliteShipsKai:hp(ship)
 
local hp = ship:hp()
 
local hp = ship:hp()
return {values = {value = Formatting:format_stat(hp)}, bg_color = self:get_bg_color(hp, args.hp_operator, args.hp_outstanding, args.hp_good)}
+
local hp_married = ship:hp_married()
 +
if hp_married then
 +
    local hp_mod_married = ship:hp_mod_married()
 +
return {values = {value = Formatting:tooltip(Formatting:format_stat(hp), format{
 +
    self._kekkon_template,
 +
    value = hp_mod_married and hp_mod_married > 0 and Formatting:format_stat_with_max(hp_married, hp_married + hp_mod_married) or Formatting:format_stat(hp_married)
 +
        })}, bg_color = self:get_bg_color(self._cell_color.hp, hp, self._args.hp_operator, self._args.hp_outstanding, self._args.hp_good, self._args.hp_bad), text_align = self._center_align}
 +
else
 +
return {values = {value = Formatting:format_stat(hp)}, bg_color = self:get_bg_color(self._cell_color.hp, hp, self._args.hp_operator, self._args.hp_outstanding, self._args.hp_good, self._args.hp_bad), text_align = self._center_align}
 +
end
 
end
 
end
  
function EliteShipsKai:armor(ship, args)
+
function EliteShipsKai:armor(ship)
 
local armor_max = ship:armor_max()
 
local armor_max = ship:armor_max()
return {values = {value = Formatting:format_stat(armor_max)}, bg_color = self:get_bg_color(armor_max, args.armor_operator, args.armor_outstanding, args.armor_good)}
+
if armor_max == false then
 +
armor_max = ship:armor()
 +
end
 +
return {values = {value = Formatting:format_stat(armor_max)}, bg_color = self:get_bg_color(self._cell_color.armor, armor_max, self._args.armor_operator, self._args.armor_outstanding, self._args.armor_good, self._args.armor_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:evasion(ship, args)
+
function EliteShipsKai:evasion(ship)
 
local evasion_max = ship:evasion_max()
 
local evasion_max = ship:evasion_max()
return {values = {value = Formatting:format_stat(evasion_max)}, bg_color = self:get_bg_color(evasion_max, args.evasion_operator, args.evasion_outstanding, args.evasion_good)}
+
if evasion_max == false then
 +
evasion_max = ship:evasion()
 +
return {values = {value = Formatting:format_stat(evasion_max)}, bg_color = self:get_bg_color(self._cell_color.evasion, evasion_max, self._args.evasion_operator, self._args.evasion_outstanding, self._args.evasion_good, self._args.evasion_bad), text_align = self._center_align}
 +
end
 +
return {values = {value = Formatting:tooltip(Formatting:format_stat(evasion_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:evasion_leveled(180))})}, bg_color = self:get_bg_color(self._cell_color.evasion, evasion_max, self._args.evasion_operator, self._args.evasion_outstanding, self._args.evasion_good, self._args.evasion_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:speed(ship, args)
+
function EliteShipsKai:speed(ship)
 
local speed = ship:speed()
 
local speed = ship:speed()
return {values = {value = Formatting:format_speed(speed)}, bg_color = self:get_bg_color(speed, args.speed_operator, args.speed_outstanding, args.speed_good)}
+
return {values = {value = Formatting:format_speed(speed)}, bg_color = self:get_bg_color(self._cell_color.speed, speed, self._args.speed_operator, self._args.speed_outstanding, self._args.speed_good, self._args.speed_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:aircraft(ship, args)
+
function EliteShipsKai:aircraft(ship)
local aircraft_max = ship:aircraft_max()
+
local aircraft = ship:total_space()
 
local slots = {}
 
local slots = {}
if aircraft_max > 0 then
+
if aircraft and aircraft > 0 then
for i = 1, ship:slots() do
+
for i = 1, ship:slots_length() do
_, size = ship:slot(i)
+
local size = ship:slot_space(i)
table.insert(slots, self:get_emphasis(size, Formatting:format_stat(size), args.aircraft_slot_operator, args.aircraft_slot_good))
+
table.insert(slots, self:get_emphasis(size, Formatting:format_stat(size), self._args.aircraft_slot_operator, self._args.aircraft_slot_good))
 
end
 
end
 
end
 
end
return {values = {value = Formatting:format_detailed_aircraft(aircraft_max, slots)}, bg_color = self:get_bg_color(aircraft_max, args.aircraft_operator, args.aircraft_outstanding, args.aircraft_good)}
+
return {values = {value = Formatting:format_detailed_aircraft(aircraft, slots)}, bg_color = self:get_bg_color(self._cell_color.aircraft, aircraft, self._args.aircraft_operator, self._args.aircraft_outstanding, self._args.aircraft_good, self._args.aircraft_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:fuel(ship, args)
+
function EliteShipsKai:fuel(ship)
 
local fuel = ship:fuel()
 
local fuel = ship:fuel()
return {values = {value = Formatting:format_stat(fuel)}, bg_color = self:get_bg_color(fuel, args.fuel_operator, args.fuel_outstanding, args.fuel_good)}
+
return {values = {value = Formatting:format_stat(fuel)}, bg_color = self:get_bg_color(self._cell_color.fuel, fuel, self._args.fuel_operator, self._args.fuel_outstanding, self._args.fuel_good, self._args.fuel_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:ammo(ship, args)
+
function EliteShipsKai:ammo(ship)
 
local ammo = ship:ammo()
 
local ammo = ship:ammo()
return {values = {value = Formatting:format_stat(ammo)}, bg_color = self:get_bg_color(ammo, args.ammo_operator, args.ammo_outstanding, args.ammo_good)}
+
return {values = {value = Formatting:format_stat(ammo)}, bg_color = self:get_bg_color(self._cell_color.ammo, ammo, self._args.ammo_operator, self._args.ammo_outstanding, self._args.ammo_good, self._args.ammo_bad), text_align = self._center_align}
 
end
 
end
  
function EliteShipsKai:notes(ship, args)
+
function EliteShipsKai:notes(ship)
return {values = {value = args.notes[ship]}, bg_color = self._transparent}
+
local note = self._notes[ship]
 +
if note then
 +
local bg_color
 +
if note.highlight == "outstanding" then
 +
bg_color = self._outstanding_stat_color
 +
elseif note.highlight == "good" then
 +
bg_color = self._good_stat_color
 +
elseif note.highlight == "bad" then
 +
bg_color = self._bad_stat_color
 +
else
 +
bg_color = self._transparent
 +
end
 +
return {values = {value = note.note or ""}, bg_color = bg_color, class = self._detailed_class}
 +
end
 +
return {values = {value = ""}, bg_color = self._transparent, class = self._detailed_class}
 
end
 
end
  
function EliteShipsKai:compare_values(val1, val2)
+
function EliteShipsKai:start_rows()
if #val1 == #val2 then
+
self._rows = {self._detail_toggle, self._table_start, self._header}
for value_type, value in pairs(val1) do
+
end
if value ~= val2[value_type] then
+
 
return false
+
EliteShipsKai.create_data_rows = EliteShipsKai.create_data_rows_merge_vertical
end
+
 
 +
function EliteShipsKai:create_table_prep()
 +
    self._columns = {}
 +
    for _, column in ipairs(self._base_columns) do
 +
        table.insert(self._columns, column)
 +
    end
 +
if self._args.reference_type then
 +
self._reference_types = {}
 +
for _, reference_type in ipairs(split(self._args.reference_type, ',%s*')) do
 +
self._reference_types[tonumber(reference_type)] = true
 
end
 
end
else
+
    end
return false
+
    if self._args.night_battle then
end
+
        table.insert(self._columns, 7, "night_battle")
return true
+
    end
 +
    if self._args.range then
 +
        table.insert(self._columns, self._args.night_battle and 16 or 15, "range")
 +
    end
 
end
 
end
  
function EliteShipsKai:Table(args)
+
function EliteShipsKai:append_custom_row(custom_row_key)
--Process requested ships
+
table.insert(self._rows, self._row_starter)
local ships = {}
+
table.insert(self._rows,
args.notes = {}
+
format{self._column_cell_templates["!"] or self._cell,
for index, ship_name in ipairs(args) do
+
class = "",
local split = mw.ustring.find(ship_name, '/')
+
colspan = #self._columns, rowspan = 1,
local ship_base_name, ship_suffix
+
text_align = self._args[self._custom_row_prefix .. custom_row_key .. self._text_align_suffix] or self._start_align,
if split == nil then
+
bg_color = self._args[self._custom_row_prefix .. custom_row_key .. self._bg_color_suffix] or self._transparent,
ship_base_name = ship_name
+
values = {
else
+
value = self._args[self._custom_row_prefix .. custom_row_key .. self._content_suffix] or "",
ship_base_name = mw.ustring.sub(ship_name, 1, split - 1)
+
},
ship_suffix = mw.ustring.sub(ship_name, split + 1, -1)
+
}
end
+
)
local ship = Ship:create(ship_base_name, ship_suffix)
+
end
ships[index] = ship
 
args.notes[ship] = args[ship_name .. self._notes_suffix]
 
end
 
  
 +
function EliteShipsKai:create_header()
 
local header_icons = {
 
local header_icons = {
remodel_icon = MiscIcons.remodel,  
+
remodel = StatIcons.remodel,  
firepower_icon = StatIcons.firepower,  
+
firepower = StatIcons.firepower,  
torpedo_icon = StatIcons.torpedo,  
+
torpedo = StatIcons.torpedo,  
aa_icon = StatIcons.aa,  
+
aa = StatIcons.aa,  
asw_icon = StatIcons.asw,  
+
asw = StatIcons.asw,  
los_icon = StatIcons.los,  
+
los = StatIcons.los,  
luck_icon = StatIcons.luck,  
+
luck = StatIcons.luck,  
hp_icon = StatIcons.hp,  
+
hp = StatIcons.hp,  
armor_icon = StatIcons.armor,
+
armor = StatIcons.armor,
evasion_icon = StatIcons.evasion,
+
evasion = StatIcons.evasion,
speed_icon = StatIcons.speed,
+
speed = StatIcons.speed,
aircraft_icon = StatIcons.aircraft,
+
range = StatIcons.range,
fuel_icon = ResourceIcons.fuel,
+
aircraft = StatIcons.aircraft,
ammo_icon = ResourceIcons.ammo,
+
fuel = ResourceIcons.fuel,
 +
ammo = ResourceIcons.ammo,
 
}
 
}
 
for key, value in pairs(header_icons) do
 
for key, value in pairs(header_icons) do
header_icons[key] = Formatting:format_image(value)
+
header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
end
 
local header = format(self._header_template, header_icons)
 
 
 
local rows = {self._table_start, header}
 
 
 
local data_rows = {}
 
for index, ship in ipairs(ships) do
 
local row_values = {}
 
for _, column in ipairs(self._columns) do
 
row_values[column] = self[column](self, ship, args)
 
end
 
if index > 1 then
 
for _, column in ipairs(self._columns) do
 
for i=index-1,1,-1 do
 
if data_rows[i][column] then
 
if self.compare_values(row_values[column].values, data_rows[i][column].values) then
 
data_rows[i][column].rowspan = data_rows[i][column].rowspan + 1
 
row_values[column] = nil
 
else
 
row_values[column].rowspan = 1
 
end
 
end
 
end
 
end
 
end
 
table.insert(data_rows, row_values)
 
 
end
 
end
 
+
self._header = format(format{
for index, row_values in ipairs(data_rows) do
+
self._header_template,
table.insert(rows, self._row_starter)
+
night_battle_header_cell = self._args.night_battle and self._night_battle_header_cell or "",
table.insert(rows, format{self._cell, value = row_values.id, rowspan = 1, bg_color = self._transparent})
+
range_header_cell = self._args.range and self._range_header_cell or ""
table.insert(rows, format{self._cell, value = row_values.name, rowspan = 1, bg_color = self._transparent})
+
}, header_icons)
for _, column in ipairs(self._columns) do
 
if row_values[column] then
 
table.insert(rows, format{self._cell, value = row_values[column].values, rowspan = row_values[column].rowspan, bg_color = row_values[column].bg_color})
 
end
 
end
 
end
 
 
 
table.insert(rows, self._row_starter)
 
table.insert(rows, header)
 
table.insert(rows, self._table_end)
 
return table.concat(rows, "\n")
 
 
end
 
end
  
 
return EliteShipsKai
 
return EliteShipsKai

Latest revision as of 07:45, 19 June 2023

Documentation for this module may be created at Module:EliteShipsKai/doc

local BaseTable = require('Module:BaseTable')
local Formatting = require('Module:Formatting')
local ResourceIcons = require('Module:Data/Asset')
local Ship = require('Module:Ship')
local StatIcons = require('Module:Data/Asset')

local format = require('Module:Core').format
local split = require('Module:Core').split

local EliteShipsKai = BaseTable({
	_table_start = [[{| class="wikitable typography-xl-optout" style="width: -moz-max-content; width: -webkit-max-content; width: max-content;"]],
	_header_template = [[!No.
!Name
!Class
! style="white-space:nowrap;" | ${remodel}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
${night_battle_header_cell}! style="width: 24px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: aquamarine;" | ${los}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: pink;" | ${hp}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #72E6E6;" | ${speed}
${range_header_cell}! style="width: 24px; text-align: center; vertical-align: middle; background-color: silver;" | ${aircraft}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: forestgreen;" | ${fuel}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
! class="toggle-target-eliteshipskai-detail" style="text-align:left;" | Notes]],
	_column_cell_templates = {
		luck = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;" | ${values.luck}(${values.luck_max})]],
		id = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;${extra_style}" |${values.value}]],
		notes = [[| class="${class}" colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;" |<small>${values.value}</small>]],
		["!"] = [[| class="${class}" colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;" |<div style="max-width: 600px;">${values.value}</div>]]
	},
	_night_battle_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle; background-color: slategrey;" | ${firepower}${torpedo}
]],
	_range_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle;" | ${range}
]],
	_base_columns = { --gets copied to self._columns in create_table_prep so we can mutate it. Don't mutate base_columns!
		"id",
		"name",
		"class",
		"remodel",
		"firepower",
		"torpedo", --night_battle is added after this depending on args in create_table_prep. If adding columns please preserve this behaviour.
		"aa",
		"asw",
		"los",
		"luck",
		"hp",
		"armor",
		"evasion",
		"speed", --range is added after this depending on args in create_table_prep. If adding columns please preserve this behaviour.
		"aircraft",
		"fuel",
		"ammo",
		"notes",
	},
	_no_remodel_level = "-",
	_simple_class = "toggle-anti-target-eliteshipskai-detail",
	_detailed_class = "toggle-target-eliteshipskai-detail hidden",
	_detailed_start = '<span class="toggle-target-eliteshipskai-detail hidden">',
	_detailed_end = '</span>',
	_name_style = {["max-width"] = "150px"},
	_detailed_columns = 1,
	_detail_toggle = '<div class="toggle" data-target="eliteshipskai-detail" data-anti-target="eliteshipskai-detail" data-default="hide" style="display: none;"><span class="toggle-show" style="cursor: pointer; color: #006cb0;">☑ Show details</span><span class="toggle-hide" style="cursor: pointer; color: #006cb0;">☒ Show details</span></div>',
	_nickname_template = "''${nick} ${japanese_nick}''",
	_kekkon_max_template = "Maximum after marriage: ${value}",
	_kekkon_template = "After marriage: ${value}",
	_item_class = Ship,
})

function EliteShipsKai:name(ship)
	local link, text, section = ship:link()
	local value = {Formatting:inline_block(Formatting:format_link(link, text, section))}
	local japanese_name = ship:japanese_name()
	if japanese_name and (text or link) ~= japanese_name then
		table.insert(value, self._detailed_start)
		table.insert(value, " ")
		table.insert(value, self._detailed_end)
		table.insert(value, self._detailed_start)
		table.insert(value, Formatting:inline_block(Formatting:format_stat(japanese_name)))
		table.insert(value, self._detailed_end)
	end
	local nick = ship:nick()
	if nick then
		table.insert(value, "<br />")
		table.insert(value, self._detailed_start)
		table.insert(value, Formatting:inline_block(format{self._nickname_template, 
		    nick = Formatting:format_stat(nick), 
		    japanese_nick = Formatting:format_stat(ship:japanese_nick())}))
		table.insert(value, self._detailed_end)
	end
	return {values = {value = Formatting:inline_block(table.concat(value), nil, self._name_style)}, bg_color = self._transparent, text_align = self._center_align}
end

function EliteShipsKai:id(ship)
	local back = ship:back()
	return {values = {value = Formatting:format_stat(ship:id())}, 
		bg_color = self._transparent, --Formatting:format_ship_back(back), 
		extra_style = "", --Formatting:extra_style_background_image(back and back > 7, back and back > 6) or ""
		text_align = self._center_align
	}
end

function EliteShipsKai:class(ship)
	local class = ship:class()
	if class then
		local ship_type = ship:type()
		local value = class:short_base_name()
		local show_type
		if self._reference_types then
			show_type = not self._reference_types[ship_type]
		else
			show_type = ship_type ~= class:base_type()
		end
		if show_type then
			value = Formatting:format_stat_with_detail(value, Formatting:format_ship_code(ship_type))
		end
		return {values = {value = value}, bg_color = self._transparent, text_align = self._center_align}
	else
		return {values = {value = "??"}, bg_color = self._transparent, text_align = self._center_align}
	end
end

function EliteShipsKai:remodel(ship)
	local remodel_level = ship:remodel_level()
	return {values = {value = Formatting:format_stat(remodel_level == false and self._no_remodel_level or remodel_level)}, bg_color = self:get_bg_color(self._cell_color.remodel, remodel_level, self._args.remodel_level_operator, self._args.remodel_level_outstanding, self._args.remodel_level_good, self._args.remodel_level_bad), text_align = self._center_align}
end

function EliteShipsKai:firepower(ship)
	local firepower_max = ship:firepower_max()
	if firepower_max == false then
		firepower_max = ship:firepower()
	end
	return {values = {value = Formatting:format_stat(firepower_max)}, bg_color = self:get_bg_color(self._cell_color.firepower, firepower_max, self._args.firepower_operator, self._args.firepower_outstanding, self._args.firepower_good, self._args.firepower_bad), text_align = self._center_align}
end

function EliteShipsKai:torpedo(ship)
	local torpedo_max = ship:torpedo_max()
	if torpedo_max == false then
		torpedo_max = ship:torpedo()
	end
	return {values = {value = Formatting:format_stat(torpedo_max)}, bg_color = self:get_bg_color(self._cell_color.torpedo, torpedo_max, self._args.torpedo_operator, self._args.torpedo_outstanding, self._args.torpedo_good, self._args.torpedo_bad), text_align = self._center_align}
end

function EliteShipsKai:night_battle(ship)
	local firepower_max = ship:firepower_max()
	if firepower_max == false then
		firepower_max = ship:firepower()
	end
	local torpedo_max = ship:torpedo_max()
	if torpedo_max == false then
		torpedo_max = ship:torpedo()
	end
	local night_battle = firepower_max
	if not firepower_max then
	    night_battle = torpedo_max
	elseif torpedo_max then
	    night_battle = night_battle + torpedo_max
	end
	return {values = {value = Formatting:format_stat(night_battle)}, bg_color = self:get_bg_color(self._cell_color.night_battle, night_battle, self._args.night_battle_operator, self._args.night_battle_outstanding, self._args.night_battle_good, self._args.night_battle_bad), text_align = self._center_align}
end

function EliteShipsKai:range(ship)
	local range = ship:range()
	return {values = {value = Formatting:format_range(range)}, bg_color = self:get_bg_color(self._cell_color.range, range, self._args.range_operator, self._args.range_outstanding, self._args.range_good, self._args.range_bad), text_align = self._center_align}
end

function EliteShipsKai:aa(ship)
	local aa_max = ship:aa_max()
	if aa_max == false then
		aa_max = ship:aa()
	end
	return {values = {value = Formatting:format_stat(aa_max)}, bg_color = self:get_bg_color(self._cell_color.aa, aa_max, self._args.aa_operator, self._args.aa_outstanding, self._args.aa_good, self._args.aa_bad), text_align = self._center_align}
end

function EliteShipsKai:asw(ship)
	local asw_max = ship:asw_max()
	if asw_max == false then
		asw_max = ship:asw()
		return {values = {value = Formatting:format_stat(asw_max)}, bg_color = self:get_bg_color(self._cell_color.asw, asw_max, self._args.asw_operator, self._args.asw_outstanding, self._args.asw_good, self._args.asw_bad), text_align = self._center_align}
	end
	return {values = {value = Formatting:tooltip(Formatting:format_stat(asw_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:asw_leveled(180))})}, bg_color = self:get_bg_color(self._cell_color.asw, asw_max, self._args.asw_operator, self._args.asw_outstanding, self._args.asw_good, self._args.asw_bad), text_align = self._center_align}
end

function EliteShipsKai:los(ship)
	local los_max = ship:los_max()
	if los_max == false then
		los_max = ship:los()
		return {values = {value = Formatting:format_stat(los_max)}, bg_color = self:get_bg_color(self._cell_color.los, los_max, self._args.los_operator, self._args.los_outstanding, self._args.los_good, self._args.los_bad), text_align = self._center_align}
	end
	return {values = {value = Formatting:tooltip(Formatting:format_stat(los_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:los_leveled(180))})}, bg_color = self:get_bg_color(self._cell_color.los, los_max, self._args.los_operator, self._args.los_outstanding, self._args.los_good, self._args.los_bad), text_align = self._center_align}
end

function EliteShipsKai:luck(ship)
	local luck = ship:luck()
	local luck_max = ship:luck_max()
	return {values = {luck = Formatting:format_stat(luck), luck_max = self:get_emphasis(luck_max, Formatting:format_stat(luck_max), self._args.luck_max_operator, self._args.luck_max_good)}, bg_color = self:get_bg_color(self._cell_color.luck, luck, self._args.luck_operator, self._args.luck_outstanding, self._args.luck_good, self._args.luck_bad), text_align = self._center_align}
end

function EliteShipsKai:hp(ship)
	local hp = ship:hp()
	local hp_married = ship:hp_married()
	if hp_married then
	    local hp_mod_married = ship:hp_mod_married()
		return {values = {value = Formatting:tooltip(Formatting:format_stat(hp), format{
		    self._kekkon_template,
		    value = hp_mod_married and hp_mod_married > 0 and Formatting:format_stat_with_max(hp_married, hp_married + hp_mod_married) or Formatting:format_stat(hp_married)
        })}, bg_color = self:get_bg_color(self._cell_color.hp, hp, self._args.hp_operator, self._args.hp_outstanding, self._args.hp_good, self._args.hp_bad), text_align = self._center_align}
	else
		return {values = {value = Formatting:format_stat(hp)}, bg_color = self:get_bg_color(self._cell_color.hp, hp, self._args.hp_operator, self._args.hp_outstanding, self._args.hp_good, self._args.hp_bad), text_align = self._center_align}
	end
end

function EliteShipsKai:armor(ship)
	local armor_max = ship:armor_max()
	if armor_max == false then
		armor_max = ship:armor()
	end
	return {values = {value = Formatting:format_stat(armor_max)}, bg_color = self:get_bg_color(self._cell_color.armor, armor_max, self._args.armor_operator, self._args.armor_outstanding, self._args.armor_good, self._args.armor_bad), text_align = self._center_align}
end

function EliteShipsKai:evasion(ship)
	local evasion_max = ship:evasion_max()
	if evasion_max == false then
		evasion_max = ship:evasion()
		return {values = {value = Formatting:format_stat(evasion_max)}, bg_color = self:get_bg_color(self._cell_color.evasion, evasion_max, self._args.evasion_operator, self._args.evasion_outstanding, self._args.evasion_good, self._args.evasion_bad), text_align = self._center_align}
	end
	return {values = {value = Formatting:tooltip(Formatting:format_stat(evasion_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:evasion_leveled(180))})}, bg_color = self:get_bg_color(self._cell_color.evasion, evasion_max, self._args.evasion_operator, self._args.evasion_outstanding, self._args.evasion_good, self._args.evasion_bad), text_align = self._center_align}
end

function EliteShipsKai:speed(ship)
	local speed = ship:speed()
	return {values = {value = Formatting:format_speed(speed)}, bg_color = self:get_bg_color(self._cell_color.speed, speed, self._args.speed_operator, self._args.speed_outstanding, self._args.speed_good, self._args.speed_bad), text_align = self._center_align}
end

function EliteShipsKai:aircraft(ship)
	local aircraft = ship:total_space()
	local slots = {}
	if aircraft and aircraft > 0 then
		for i = 1, ship:slots_length() do
			local size = ship:slot_space(i)
			table.insert(slots, self:get_emphasis(size, Formatting:format_stat(size), self._args.aircraft_slot_operator, self._args.aircraft_slot_good))
		end
	end
	return {values = {value = Formatting:format_detailed_aircraft(aircraft, slots)}, bg_color = self:get_bg_color(self._cell_color.aircraft, aircraft, self._args.aircraft_operator, self._args.aircraft_outstanding, self._args.aircraft_good, self._args.aircraft_bad), text_align = self._center_align}
end

function EliteShipsKai:fuel(ship)
	local fuel = ship:fuel()
	return {values = {value = Formatting:format_stat(fuel)}, bg_color = self:get_bg_color(self._cell_color.fuel, fuel, self._args.fuel_operator, self._args.fuel_outstanding, self._args.fuel_good, self._args.fuel_bad), text_align = self._center_align}
end

function EliteShipsKai:ammo(ship)
	local ammo = ship:ammo()
	return {values = {value = Formatting:format_stat(ammo)}, bg_color = self:get_bg_color(self._cell_color.ammo, ammo, self._args.ammo_operator, self._args.ammo_outstanding, self._args.ammo_good, self._args.ammo_bad), text_align = self._center_align}
end

function EliteShipsKai:notes(ship)
	local note = self._notes[ship]
	if note then
		local bg_color
		if note.highlight == "outstanding" then
			bg_color = self._outstanding_stat_color
		elseif note.highlight == "good" then
			bg_color = self._good_stat_color
		elseif note.highlight == "bad" then
			bg_color = self._bad_stat_color
		else
			bg_color = self._transparent
		end
		return {values = {value = note.note or ""}, bg_color = bg_color, class = self._detailed_class}
	end
	return {values = {value = ""}, bg_color = self._transparent, class = self._detailed_class}
end

function EliteShipsKai:start_rows()
	self._rows = {self._detail_toggle, self._table_start, self._header}
end

EliteShipsKai.create_data_rows = EliteShipsKai.create_data_rows_merge_vertical

function EliteShipsKai:create_table_prep()
    self._columns = {}
    for _, column in ipairs(self._base_columns) do
        table.insert(self._columns, column)
    end
	if self._args.reference_type then
		self._reference_types = {}
		for _, reference_type in ipairs(split(self._args.reference_type, ',%s*')) do
			self._reference_types[tonumber(reference_type)] = true
		end
    end
    if self._args.night_battle then
        table.insert(self._columns, 7, "night_battle")
    end
    if self._args.range then
        table.insert(self._columns, self._args.night_battle and 16 or 15, "range")
    end
end

function EliteShipsKai:append_custom_row(custom_row_key)
	table.insert(self._rows, self._row_starter)
	table.insert(self._rows,
		format{self._column_cell_templates["!"] or self._cell,
			class = "",
			colspan = #self._columns, rowspan = 1,
			text_align = self._args[self._custom_row_prefix .. custom_row_key .. self._text_align_suffix] or self._start_align,
			bg_color = self._args[self._custom_row_prefix .. custom_row_key .. self._bg_color_suffix] or self._transparent,
			values = {
				value = self._args[self._custom_row_prefix .. custom_row_key .. self._content_suffix] or "",
			},
		}
	)
end

function EliteShipsKai:create_header()
	local header_icons = {
		remodel = StatIcons.remodel, 
		firepower = StatIcons.firepower, 
		torpedo = StatIcons.torpedo, 
		aa = StatIcons.aa, 
		asw = StatIcons.asw, 
		los = StatIcons.los, 
		luck = StatIcons.luck, 
		hp = StatIcons.hp, 
		armor = StatIcons.armor,
		evasion = StatIcons.evasion,
		speed = StatIcons.speed,
		range = StatIcons.range,
		aircraft = StatIcons.aircraft,
		fuel = ResourceIcons.fuel,
		ammo = ResourceIcons.ammo,
	}
	for key, value in pairs(header_icons) do
		header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
	end
	self._header = format(format{
		self._header_template,
		night_battle_header_cell = self._args.night_battle and self._night_battle_header_cell or "",
		range_header_cell = self._args.range and self._range_header_cell or ""
	}, header_icons)
end

return EliteShipsKai