- 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
Created page with "local BaseTable = require('Module:BaseTable') local Formatting = require('Module:Formatting') local StatIcons = require('Module:StatIcons') local Ship = require('Module:Ship')..."
local BaseTable = require('Module:BaseTable')
local Formatting = require('Module:Formatting')
local StatIcons = require('Module:StatIcons')
local Ship = require('Module:Ship')
local format = require('Module:StringInterpolation').format
local ShipModernizationListKai = BaseTable{
_header_template = [[! style="width: 75px;" | Class
! style="width: 100px;" | Name
! 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: #F2E279;" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}
! style="width: 100px;" | Name
! 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: #F2E279;" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}]],
_columns = {
"class",
"name1",
"firepower_mod1",
"torpedo_mod1",
"aa_mod1",
"armor_mod1",
"luck_mod1",
"name2",
"firepower_mod2",
"torpedo_mod2",
"aa_mod2",
"armor_mod2",
"luck_mod2",
},
_empty_cell = [[| style="text-align: center; vertical-align: middle;" | -]],
_column_empty_cells = {
arrow = [[| style="text-align: center; vertical-align: middle;" | ⇒]],
},
_item_class = Ship,
_dash = "-",
_question_marks = "??",
}
function ShipModernizationListKai:class(pair)
self._left = pair[1]
self._right = pair[2]
self._left_modernization = self._left and self._left:modernization() or false
self._right_modernization = self._right and self._right:modernization() or false
local class = (pair[1] or pair[2]):class()
return {values = {value = class and class:base_name() or self._question_marks}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:name1()
if self._left then
return self:name(self._left)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:name2()
if self._right then
return self:name(self._right)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:firepower_mod1()
if self._left then
return self:firepower_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:firepower_mod2()
if self._right then
return self:firepower_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:torpedo_mod1()
if self._left then
return self:torpedo_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:torpedo_mod2()
if self._right then
return self:torpedo_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:aa_mod1()
if self._left then
return self:aa_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:aa_mod2()
if self._right then
return self:aa_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:armor_mod1()
if self._left then
return self:armor_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:armor_mod2()
if self._right then
return self:armor_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:luck_mod1()
if self._left then
return self:luck_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:luck_mod2()
if self._right then
return self:luck_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai: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 {values = {value = table.concat(value, " ")}, bg_color = self._transparent, text_align = self._start_align}
end
function ShipModernizationListKai:firepower_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.firepower)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:torpedo_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.torpedo)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:aa_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.aa)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:armor_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.armor)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:luck_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.luck, nil, true)}, bg_color = self._transparent, text_align = self._center_align}
end
ShipModernizationListKai.create_data_rows = ShipModernizationListKai.create_data_rows_merge_vertical
function BaseTable:create_items_post()
local items = {}
for _, item in ipairs(self._items) do
local left = item
local right = item:remodel_to()
if right then
right = Ship(right)
end
table.insert(items, {left, right})
if right then
left = right:remodel_to()
while left do
left = Ship(left)
right = left:remodel_to()
if right then
right = Ship(right)
else
table.insert(items, {false, left})
break
end
table.insert(items, {left, right})
left = right:remodel_to()
end
end
end
self._items = items
end
function ShipModernizationListKai:create_header()
local header_icons = {
firepower = StatIcons.firepower,
torpedo = StatIcons.torpedo,
aa = StatIcons.aa,
armor = StatIcons.armor,
luck = StatIcons.luck,
}
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
return ShipModernizationListKai
local Formatting = require('Module:Formatting')
local StatIcons = require('Module:StatIcons')
local Ship = require('Module:Ship')
local format = require('Module:StringInterpolation').format
local ShipModernizationListKai = BaseTable{
_header_template = [[! style="width: 75px;" | Class
! style="width: 100px;" | Name
! 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: #F2E279;" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}
! style="width: 100px;" | Name
! 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: #F2E279;" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}]],
_columns = {
"class",
"name1",
"firepower_mod1",
"torpedo_mod1",
"aa_mod1",
"armor_mod1",
"luck_mod1",
"name2",
"firepower_mod2",
"torpedo_mod2",
"aa_mod2",
"armor_mod2",
"luck_mod2",
},
_empty_cell = [[| style="text-align: center; vertical-align: middle;" | -]],
_column_empty_cells = {
arrow = [[| style="text-align: center; vertical-align: middle;" | ⇒]],
},
_item_class = Ship,
_dash = "-",
_question_marks = "??",
}
function ShipModernizationListKai:class(pair)
self._left = pair[1]
self._right = pair[2]
self._left_modernization = self._left and self._left:modernization() or false
self._right_modernization = self._right and self._right:modernization() or false
local class = (pair[1] or pair[2]):class()
return {values = {value = class and class:base_name() or self._question_marks}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:name1()
if self._left then
return self:name(self._left)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:name2()
if self._right then
return self:name(self._right)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:firepower_mod1()
if self._left then
return self:firepower_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:firepower_mod2()
if self._right then
return self:firepower_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:torpedo_mod1()
if self._left then
return self:torpedo_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:torpedo_mod2()
if self._right then
return self:torpedo_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:aa_mod1()
if self._left then
return self:aa_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:aa_mod2()
if self._right then
return self:aa_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:armor_mod1()
if self._left then
return self:armor_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:armor_mod2()
if self._right then
return self:armor_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:luck_mod1()
if self._left then
return self:luck_mod(self._left_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai:luck_mod2()
if self._right then
return self:luck_mod(self._right_modernization)
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
end
end
function ShipModernizationListKai: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 {values = {value = table.concat(value, " ")}, bg_color = self._transparent, text_align = self._start_align}
end
function ShipModernizationListKai:firepower_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.firepower)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:torpedo_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.torpedo)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:aa_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.aa)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:armor_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.armor)}, bg_color = self._transparent, text_align = self._center_align}
end
function ShipModernizationListKai:luck_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.luck, nil, true)}, bg_color = self._transparent, text_align = self._center_align}
end
ShipModernizationListKai.create_data_rows = ShipModernizationListKai.create_data_rows_merge_vertical
function BaseTable:create_items_post()
local items = {}
for _, item in ipairs(self._items) do
local left = item
local right = item:remodel_to()
if right then
right = Ship(right)
end
table.insert(items, {left, right})
if right then
left = right:remodel_to()
while left do
left = Ship(left)
right = left:remodel_to()
if right then
right = Ship(right)
else
table.insert(items, {false, left})
break
end
table.insert(items, {left, right})
left = right:remodel_to()
end
end
end
self._items = items
end
function ShipModernizationListKai:create_header()
local header_icons = {
firepower = StatIcons.firepower,
torpedo = StatIcons.torpedo,
aa = StatIcons.aa,
armor = StatIcons.armor,
luck = StatIcons.luck,
}
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
return ShipModernizationListKai