• 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
Trying to improve performance
Line 50: Line 50:  
"notes",
 
"notes",
 
},
 
},
 +
_cell = [[| style="text-align: ${text_align}; padding:5px 5px 5px 5px;" |${value}]],
 
_empty_cell = [[| colspan="1" rowspan="1" |]],
 
_empty_cell = [[| colspan="1" rowspan="1" |]],
 
_item_class = Ship,
 
_item_class = Ship,
Line 69: Line 70:  
table.insert(value, Formatting:format_stat(ship:japanese_name()))
 
table.insert(value, Formatting:format_stat(ship:japanese_name()))
 
end
 
end
return {values = {value = table.concat(value, "<br />")}, bg_color = self._transparent, text_align = self._start_align}
+
return {value = table.concat(value, "<br />"), text_align = self._start_align}
 
end
 
end
    
function ShipListKai:id(ship)
 
function ShipListKai:id(ship)
return {values = {value = Formatting:format_stat(ship:id())},
+
return {value = Formatting:format_stat(ship:id()),
bg_color = self._transparent,
   
text_align = self._center_align,
 
text_align = self._center_align,
 
}
 
}
Line 86: Line 86:  
class_number = "??"
 
class_number = "??"
 
end
 
end
return {values = {value = class_number and format{self._class_number_template, class_name = class_name, class_number = class_number} or class_name}, bg_color = self._transparent, text_align = self._start_align}
+
return {value = class_number and format{self._class_number_template, class_name = class_name, class_number = class_number} or class_name, text_align = self._start_align}
 
end
 
end
    
function ShipListKai:type(ship)
 
function ShipListKai:type(ship)
return {values = {value = Formatting:format_ship_code(ship:type())}, bg_color = self._transparent, text_align = self._start_align}
+
return {value = Formatting:format_ship_code(ship:type()), text_align = self._start_align}
 
end
 
end
    
function ShipListKai:firepower(ship)
 
function ShipListKai:firepower(ship)
return {values = {value = Formatting:format_stat(ship:firepower())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:firepower()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:torpedo(ship)
 
function ShipListKai:torpedo(ship)
return {values = {value = Formatting:format_stat(ship:torpedo())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:torpedo()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:aa(ship)
 
function ShipListKai:aa(ship)
return {values = {value = Formatting:format_stat(ship:aa())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:aa()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:asw(ship)
 
function ShipListKai:asw(ship)
return {values = {value = Formatting:format_stat(ship:asw())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:asw()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:los(ship)
 
function ShipListKai:los(ship)
return {values = {value = Formatting:format_stat(ship:los())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:los()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:luck(ship)
 
function ShipListKai:luck(ship)
return {values = {value = Formatting:format_stat(ship:luck())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:luck()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:hp(ship)
 
function ShipListKai:hp(ship)
return {values = {value = Formatting:format_stat(ship:hp())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:hp()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:armor(ship)
 
function ShipListKai:armor(ship)
return {values = {value = Formatting:format_stat(ship:armor())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:armor()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:evasion(ship)
 
function ShipListKai:evasion(ship)
return {values = {value = Formatting:format_stat(ship:evasion())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:evasion()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:speed(ship)
 
function ShipListKai:speed(ship)
return {values = {value = Formatting:format_speed(ship:speed())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_speed(ship:speed()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:aircraft(ship)
 
function ShipListKai:aircraft(ship)
return {values = {value = Formatting:format_stat(ship:total_space())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:total_space()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:range(ship)
 
function ShipListKai:range(ship)
return {values = {value = Formatting:format_range(ship:range())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_range(ship:range()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:fuel(ship)
 
function ShipListKai:fuel(ship)
return {values = {value = Formatting:format_stat(ship:fuel())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:fuel()), text_align = self._center_align}
 
end
 
end
    
function ShipListKai:ammo(ship)
 
function ShipListKai:ammo(ship)
return {values = {value = Formatting:format_stat(ship:ammo())}, bg_color = self._transparent, text_align = self._center_align}
+
return {value = Formatting:format_stat(ship:ammo()), text_align = self._center_align}
 
end
 
end
   Line 177: Line 177:  
table.insert(build_info, self._remodel_to_label .. format{self._remodel_template, link = Formatting:format_link(remodel_to:link()), level = remodel_to:remodel_level()})
 
table.insert(build_info, self._remodel_to_label .. format{self._remodel_template, link = Formatting:format_link(remodel_to:link()), level = remodel_to:remodel_level()})
 
end
 
end
return {values = {value = table.concat(build_info, "<br />")}, bg_color = self._transparent, text_align = self._start_align}
+
return {value = table.concat(build_info, "<br />"), text_align = self._start_align}
 
end
 
end
   Line 183: Line 183:  
local note = self._notes[ship]
 
local note = self._notes[ship]
 
if note then
 
if note then
return {values = {value = note.note or ""}, bg_color = self._transparent, text_align = self._start_align}
+
return {value = note.note or "", text_align = self._start_align}
 
end
 
end
return {values = {value = ""}, bg_color = self._transparent, text_align = self._start_align}
+
return {value = "", text_align = self._start_align}
 
end
 
end
   Line 202: Line 202:  
function BaseTable:build_rows()
 
function BaseTable:build_rows()
 
for index, row_values in ipairs(self._data_rows) do
 
for index, row_values in ipairs(self._data_rows) do
table.insert(self._rows, self._row_starter)
+
table.insert(self._rows, self._row_starter)
if row_values == "break" then
+
if row_values == "break" then
for _, column in ipairs(self._columns) do
+
for i=1, #self._columns do
table.insert(self._rows, self._empty_cell)
+
table.insert(self._rows, self._empty_cell)
end
+
end
elseif row_values == "header" then
+
elseif row_values == "header" then
table.insert(self._rows, self._header)
+
table.insert(self._rows, self._header)
elseif type(row_values) == "table" then
+
elseif type(row_values) == "table" then
for _, column in ipairs(self._columns) do
+
for _, column in ipairs(self._columns) do
if row_values[column] then
+
if row_values[column] then
table.insert(self._rows, format(self._column_cell_templates[column] or self._cell, row_values[column]))
+
table.insert(self._rows, format(self._column_cell_templates[column] or self._cell, row_values[column]))
end
   
end
 
end
else
  −
table.insert(self._rows,
  −
format{self._cell,
  −
colspan = #self._columns, rowspan = 1,
  −
text_align = self._args[self._custom_row_prefix .. row_values .. self._text_align_suffix] or self._start_align,
  −
bg_color = self._args[self._custom_row_prefix .. row_values .. self._bg_color_suffix] or self._transparent,
  −
values = {
  −
value = self._args[self._custom_row_prefix .. row_values .. self._content_suffix] or "",
  −
},
  −
}
  −
)
   
end
 
end
 +
else
 +
table.insert(self._rows,
 +
format{self._cell,
 +
colspan = #self._columns, rowspan = 1,
 +
text_align = self._args[self._custom_row_prefix .. row_values .. self._text_align_suffix] or self._start_align,
 +
bg_color = self._args[self._custom_row_prefix .. row_values .. self._bg_color_suffix] or self._transparent,
 +
values = {
 +
value = self._args[self._custom_row_prefix .. row_values .. self._content_suffix] or "",
 +
},
 +
}
 +
)
 +
end
 
end
 
end
 
end
 
end
Anonymous user

Navigation menu