Module:EnemyShipListKai

local BaseTable = require('Module:BaseTable') local EnemyShip = require('Module:Ship') local Formatting = require('Module:Formatting') local ShipBattleCardKai = require('Module:ShipBattleCardKai') local StatIcons = require('Module:StatIcons')

local format = require('Module:StringInterpolation').format

local EnemyShipListKai = BaseTable({	_header_template = Card ! style="width: 75px;" | Name ! style="width: 30px; text-align: center; vertical-align: middle; background-color: pink;" | ${hp} ! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower} ! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo} ! style="width: 30px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa} ! style="width: 30px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw} ! style="width: 30px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor} ! style="width: 30px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion} ! style="width: 250px; text-align: center; vertical-align: middle;" | Equipment ! style="text-align:left;" | Notes, _columns = { "card", "name", "hp", "firepower", "torpedo", "aa", "asw", "armor", "evasion", "equipment", "notes", },	_column_cell_templates = { card = ${value}, },	_cell = ${value}, _item_class = EnemyShip, _fragment_prefix = "enemyshiplistkai", })

function EnemyShipListKai:name(ship) local link, text, section = ship:link local value = {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, Formatting:format_stat(ship:japanese_name)) end return {value = Formatting:id_span(tostring(ship:api_id or mw.ustring.lower(mw.ustring.gsub(ship:name, "%s+"))), self._fragment_prefix, table.concat(value, " ")), text_align = self._start_align} end

function EnemyShipListKai:card(ship) local value if ship == false then value = Formatting:format_image{self._blank, size = self._size} else value = ShipBattleCardKai:get{ship = ship, size = self._size, link = ship:link, caption = ship:name} end return {values = value, bg_color = self._transparent, text_align = self._center_align} end

function EnemyShipListKai:type(ship) return {value = Formatting:format_ship_code(ship:type), text_align = self._start_align} end

function EnemyShipListKai:firepower(ship) return {value = Formatting:format_stat(ship:firepower), text_align = self._center_align} end

function EnemyShipListKai:torpedo(ship) return {value = Formatting:format_stat(ship:torpedo), text_align = self._center_align} end

function EnemyShipListKai:aa(ship) return {value = Formatting:format_stat(ship:aa), text_align = self._center_align} end

function EnemyShipListKai:asw(ship) return {value = Formatting:format_stat(ship:asw), text_align = self._center_align} end

function EnemyShipListKai:hp(ship) return {value = Formatting:format_stat(ship:hp), text_align = self._center_align} end

function EnemyShipListKai:armor(ship) return {value = Formatting:format_stat(ship:armor), text_align = self._center_align} end

function EnemyShipListKai:evasion(ship) return {value = Formatting:format_stat(ship:evasion), text_align = self._center_align} end

function EnemyShipListKai:notes(ship) local note = self._notes[ship] if note then return {value = note.note or "", text_align = self._start_align} end return {value = "", text_align = self._start_align} end

EnemyShipListKai.process_item_key = Ship.process_item_key

EnemyShipListKai.build_rows = EnemyShipListKai.build_rows_breaks_as_empty_rows

function EnemyShipListKai:create_header local header_icons = { firepower = StatIcons.firepower, torpedo = StatIcons.torpedo, aa = StatIcons.aa, asw = StatIcons.asw, hp = StatIcons.hp, armor = StatIcons.armor, evasion = StatIcons.evasion, }	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(self._header_template, header_icons) end

function EnemyShipListKai.Invoke local args = getArgs{frame = frame:getParent} return EnemyShipListKai:Table(args) end

return EnemyShipListKai