• 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
m
19 revisions imported
Line 1: Line 1:  
local BaseTable = require('Module:BaseTable')
 
local BaseTable = require('Module:BaseTable')
 
local Formatting = require('Module:Formatting')
 
local Formatting = require('Module:Formatting')
local StatIcons = require('Module:StatIcons')
+
local StatIcons = require('Module:Data/Asset')
 
local Ship = require('Module:Ship')
 
local Ship = require('Module:Ship')
   −
local format = require('Module:StringInterpolation').format
+
local format = require('Module:Core').format
    
local ShipModernizationListKai = BaseTable{
 
local ShipModernizationListKai = BaseTable{
_header_template = [[! style="width: 75px;" | Class
+
_header_template = [[! Class
! style="width: 100px;" | Name
+
! Name
! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
+
! style="text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
+
! style="text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
+
! style="text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
+
! style="text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}
+
! style="text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}
! style="width: 100px;" | Name
+
! Name
! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
+
! ${remodel}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
+
! style="text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
+
! style="text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
+
! style="text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
! style="width: 30px; text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}]],
+
! style="text-align: center; vertical-align: middle; background-color: #F2E279;" | ${armor}
 +
! style="text-align: center; vertical-align: middle; background-color: palegreen;" | ${luck}]],
 
_columns = {
 
_columns = {
 
"class",
 
"class",
Line 29: Line 30:  
"luck_mod1",
 
"luck_mod1",
 
"name2",
 
"name2",
 +
"remodel",
 
"firepower_mod2",
 
"firepower_mod2",
 
"torpedo_mod2",
 
"torpedo_mod2",
Line 43: Line 45:  
_question_marks = "??",
 
_question_marks = "??",
 
_column_bg_colors = {
 
_column_bg_colors = {
firepower = "lightcoral",
+
{
torpedo = "lightskyblue",
+
firepower = "#e6cfcf",
aa = "sandybrown",
+
torpedo = "#cfdde6",
armor = "#F2E279",
+
aa = "#e6d9cf",
luck = "palegreen",
+
armor = "#e6e3cf",
},
+
},
 +
{
 +
firepower = "#e6c3c3",
 +
torpedo = "#c3d9e6",
 +
aa = "#e6d3c3",
 +
armor = "#e6e2c3",
 +
},
 +
{
 +
firepower = "#e6b8b8",
 +
torpedo = "#b8d4e6",
 +
aa = "#e6ccb8",
 +
armor = "#e6e0b8",
 +
},
 +
{
 +
firepower = "#e6adad",
 +
torpedo = "#add0e6",
 +
aa = "#e6c5ad",
 +
armor = "#e6dead",
 +
},
 +
{
 +
firepower = "#e6a1a1",
 +
torpedo = "#a1cbe6",
 +
aa = "#e6bfa1",
 +
armor = "#e6dda1",
 +
},
 +
{
 +
firepower = "#e69696",
 +
torpedo = "#96c7e6",
 +
aa = "#e6b996",
 +
armor = "#e6db96",
 +
},
 +
{
 +
firepower = "#e68a8a",
 +
torpedo = "#8ac2e6",
 +
aa = "#e6b28a",
 +
armor = "#e6da8a",
 +
},
 +
{
 +
firepower = "#e67f7f",
 +
torpedo = "#7fbee6",
 +
aa = "#e6ab7f",
 +
armor = "#e6d87f",
 +
},
 +
[1.2] = {
 +
luck = "#b8e6b8",
 +
},
 +
[1.6] = {
 +
luck = "#8ae68a",
 +
},
 +
firepower = "#e6cfcf",
 +
torpedo = "#cfdde6",
 +
aa = "#e6d9cf",
 +
armor = "#e6e3cf",
 +
luck = "#cfe6cf",
 +
}
 
}
 
}
    
function ShipModernizationListKai:class(pair)
 
function ShipModernizationListKai:class(pair)
 
self._left = pair[1]
 
self._left = pair[1]
 +
self._left_modernization = self._left and self._left:modernization() or false
 
self._right = pair[2]
 
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
 
self._right_modernization = self._right and self._right:modernization() or false
local class = (pair[1] or pair[2]):class()
+
local left_class, right_class, class_name = self._left and self._left:class(), self._right and self._right:class(), false
return {values = {value = class and class:base_name() or self._question_marks}, bg_color = self._transparent, text_align = self._center_align}
+
if left_class or right_class then
 +
if left_class == right_class or not right_class then
 +
class_name = left_class:short_base_name()
 +
elseif not left_class then
 +
class_name = right_class:short_base_name()
 +
else
 +
class_name = left_class:short_base_name() .. "/" .. right_class:short_base_name()
 +
end
 +
end
 +
return {values = {value = class_name or self._question_marks}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
   Line 64: Line 129:  
return self:name(self._left)
 
return self:name(self._left)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 72: Line 137:  
return self:name(self._right)
 
return self:name(self._right)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 80: Line 145:  
return self:firepower_mod(self._left_modernization)
 
return self:firepower_mod(self._left_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.firepower, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 88: Line 153:  
return self:firepower_mod(self._right_modernization)
 
return self:firepower_mod(self._right_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.firepower, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 96: Line 161:  
return self:torpedo_mod(self._left_modernization)
 
return self:torpedo_mod(self._left_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.torpedo, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 104: Line 169:  
return self:torpedo_mod(self._right_modernization)
 
return self:torpedo_mod(self._right_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.torpedo, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 112: Line 177:  
return self:aa_mod(self._left_modernization)
 
return self:aa_mod(self._left_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.aa, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 120: Line 185:  
return self:aa_mod(self._right_modernization)
 
return self:aa_mod(self._right_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.aa, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 128: Line 193:  
return self:armor_mod(self._left_modernization)
 
return self:armor_mod(self._left_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.armor, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 136: Line 201:  
return self:armor_mod(self._right_modernization)
 
return self:armor_mod(self._right_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.armor, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 144: Line 209:  
return self:luck_mod(self._left_modernization)
 
return self:luck_mod(self._left_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.luck, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 152: Line 217:  
return self:luck_mod(self._right_modernization)
 
return self:luck_mod(self._right_modernization)
 
else
 
else
return {values = {value = self._dash}, bg_color = self._column_bg_colors.luck, text_align = self._start_align}
+
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 
end
 
end
 
end
 
end
Line 158: Line 223:  
function ShipModernizationListKai:name(ship)
 
function ShipModernizationListKai:name(ship)
 
local link, text, section = ship:link()
 
local link, text, section = ship:link()
local value = {Formatting:format_link(link, text, section)}
+
local value = {Formatting:inline_block(Formatting:format_link(link, text, section))}
 
local japanese_name = ship:japanese_name()
 
local japanese_name = ship:japanese_name()
 
if japanese_name and (text or link) ~= japanese_name then
 
if japanese_name and (text or link) ~= japanese_name then
table.insert(value, Formatting:format_stat(ship:japanese_name()))
+
table.insert(value, Formatting:inline_block(Formatting:format_stat(ship:japanese_name())))
 
end
 
end
 
return {values = {value = table.concat(value, " ")}, bg_color = self._transparent, text_align = self._start_align}
 
return {values = {value = table.concat(value, " ")}, bg_color = self._transparent, text_align = self._start_align}
 +
end
 +
 +
function ShipModernizationListKai:remodel()
 +
if self._right then
 +
local remodel_level = self._right:remodel_level()
 +
return {values = {value = Formatting:format_stat(remodel_level == false and self._dash or remodel_level)}, bg_color = self._transparent, text_align = self._center_align}
 +
else
 +
return {values = {value = self._dash}, bg_color = self._transparent, text_align = self._center_align}
 +
end
 
end
 
end
    
function ShipModernizationListKai:firepower_mod(modernization)
 
function ShipModernizationListKai:firepower_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.firepower, nil, self._dash)}, bg_color = self._column_bg_colors.firepower, text_align = self._center_align}
+
return {values = {value = Formatting:format_bonus(modernization.firepower, nil, self._dash)}, bg_color = modernization.firepower and (self._column_bg_colors[modernization.firepower] or self._column_bg_colors).firepower or self._transparent, text_align = self._center_align}
 
end
 
end
    
function ShipModernizationListKai:torpedo_mod(modernization)
 
function ShipModernizationListKai:torpedo_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.torpedo, nil, self._dash)}, bg_color = self._column_bg_colors.torpedo, text_align = self._center_align}
+
return {values = {value = Formatting:format_bonus(modernization.torpedo, nil, self._dash)}, bg_color = modernization.torpedo and (self._column_bg_colors[modernization.torpedo] or self._column_bg_colors).torpedo or self._transparent, text_align = self._center_align}
 
end
 
end
    
function ShipModernizationListKai:aa_mod(modernization)
 
function ShipModernizationListKai:aa_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.aa, nil, self._dash)}, bg_color = self._column_bg_colors.aa, text_align = self._center_align}
+
return {values = {value = Formatting:format_bonus(modernization.aa, nil, self._dash)}, bg_color = modernization.aa and (self._column_bg_colors[modernization.aa] or self._column_bg_colors).aa or self._transparent, text_align = self._center_align}
 
end
 
end
    
function ShipModernizationListKai:armor_mod(modernization)
 
function ShipModernizationListKai:armor_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.armor, nil, self._dash)}, bg_color = self._column_bg_colors.armor, text_align = self._center_align}
+
return {values = {value = Formatting:format_bonus(modernization.armor, nil, self._dash)}, bg_color = modernization.armor and (self._column_bg_colors[modernization.armor] or self._column_bg_colors).armor or self._transparent, text_align = self._center_align}
 
end
 
end
    
function ShipModernizationListKai:luck_mod(modernization)
 
function ShipModernizationListKai:luck_mod(modernization)
return {values = {value = Formatting:format_bonus(modernization.luck, nil, self._dash, true)}, bg_color = self._column_bg_colors.luck, text_align = self._center_align}
+
return {values = {value = Formatting:format_bonus(modernization.luck, nil, self._dash, true)}, bg_color = modernization.luck and (self._column_bg_colors[modernization.luck] or self._column_bg_colors).luck or self._transparent, text_align = self._center_align}
 
end
 
end
    
ShipModernizationListKai.create_data_rows = ShipModernizationListKai.create_data_rows_merge_vertical
 
ShipModernizationListKai.create_data_rows = ShipModernizationListKai.create_data_rows_merge_vertical
   −
function BaseTable:create_items_post()
+
function ShipModernizationListKai:create_items_post()
 
local items = {}
 
local items = {}
 
local left = false
 
local left = false
 
local right = false
 
local right = false
local even = false
   
for _, item in ipairs(self._items) do
 
for _, item in ipairs(self._items) do
 
if type(item) == "string" then
 
if type(item) == "string" then
if item == "empty" then
+
table.insert(items, {left, right})
if even then
+
left, right = false, false
right = false
+
if item == "break" then
table.insert(items, {left, right})
+
table.insert(items, item)
left = false
+
end
right = false
+
elseif left then
even = false
+
if right then
else
  −
left = false
  −
even = true
  −
end
  −
elseif even then
   
table.insert(items, {left, right})
 
table.insert(items, {left, right})
left = false
  −
even = false
   
end
 
end
elseif even then
   
right = item
 
right = item
table.insert(items, {left, right})
  −
left = false
  −
right = false
  −
even = false
   
else
 
else
 
left = item
 
left = item
even = true
+
right = false
 
end
 
end
 
end
 
end
if even then
+
if left then
 
table.insert(items, {left, right})
 
table.insert(items, {left, right})
 
end
 
end
Line 235: Line 296:  
armor = StatIcons.armor,
 
armor = StatIcons.armor,
 
luck = StatIcons.luck,
 
luck = StatIcons.luck,
 +
remodel = StatIcons.remodel,
 
}
 
}
 
for key, value in pairs(header_icons) do
 
for key, value in pairs(header_icons) do
Bots, gkautomate
12,557

edits

Navigation menu