Changes

ship level cap 175 -> 180
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 MiscIcons = require('Module:MiscIcons')
+
local ResourceIcons = require('Module:Data/Asset')
local ResourceIcons = require('Module:ResourceIcons')
   
local Ship = require('Module:Ship')
 
local Ship = require('Module:Ship')
local StatIcons = require('Module:StatIcons')
+
local StatIcons = require('Module:Data/Asset')
   −
local format = require('Module:StringOperations').format
+
local format = require('Module:Core').format
local split = require('Module:StringOperations').split
+
local split = require('Module:Core').split
    
local EliteShipsKai = BaseTable({
 
local EliteShipsKai = BaseTable({
Line 25: Line 24:  
! style="width: 24px; text-align: center; vertical-align: middle; background-color: violet;" | ${evasion}
 
! 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}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #72E6E6;" | ${speed}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: silver;" | ${aircraft}
+
${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: forestgreen;" | ${fuel}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: darkgoldenrod;" | ${ammo}
Line 33: Line 32:  
id = [[| colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;${extra_style}" |${values.value}]],
 
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>]],
 
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;" |${values.value}]]
+
["!"] = [[| 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}
 
_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!
 
_base_columns = { --gets copied to self._columns in create_table_prep so we can mutate it. Don't mutate base_columns!
Line 51: 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 161: Line 162:  
end
 
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}
 
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
 
end
   Line 177: Line 183:  
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}
 
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
 
end
return {values = {value = Formatting:tooltip(Formatting:format_stat(asw_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:asw_leveled(155))})}, 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}
+
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
   Line 186: Line 192:  
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}
 
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
 
end
return {values = {value = Formatting:tooltip(Formatting:format_stat(los_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:los_leveled(155))})}, 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}
+
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
   Line 199: Line 205:  
local hp_married = ship:hp_married()
 
local hp_married = ship:hp_married()
 
if hp_married then
 
if hp_married then
return {values = {value = Formatting:tooltip(Formatting:format_stat(hp), format{self._kekkon_template, value = 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}
+
    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
 
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}
 
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}
Line 219: Line 229:  
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}
 
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
 
end
return {values = {value = Formatting:tooltip(Formatting:format_stat(evasion_max), format{self._kekkon_max_template, value = Formatting:format_stat(ship:evasion_leveled(155))})}, 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}
+
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
   Line 265: Line 275:  
end
 
end
 
return {values = {value = ""}, bg_color = self._transparent, class = self._detailed_class}
 
return {values = {value = ""}, bg_color = self._transparent, class = self._detailed_class}
end
  −
  −
function EliteShipsKai:process_item_key(item_key)
  −
local split = mw.ustring.find(item_key, '/')
  −
local ship_base_name, ship_suffix
  −
if split == nil then
  −
ship_base_name = item_key
  −
else
  −
ship_base_name = mw.ustring.sub(item_key, 1, split - 1)
  −
ship_suffix = mw.ustring.sub(item_key, split + 1, -1)
  −
end
  −
return ship_base_name, ship_suffix
   
end
 
end
   Line 298: Line 296:  
     if self._args.night_battle then
 
     if self._args.night_battle then
 
         table.insert(self._columns, 7, "night_battle")
 
         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
 
end
 
end
Line 303: Line 304:  
function EliteShipsKai:append_custom_row(custom_row_key)
 
function EliteShipsKai:append_custom_row(custom_row_key)
 
table.insert(self._rows, self._row_starter)
 
table.insert(self._rows, self._row_starter)
table.insert(self._rows,  
+
table.insert(self._rows,
 
format{self._column_cell_templates["!"] or self._cell,
 
format{self._column_cell_templates["!"] or self._cell,
class = self._detailed_class,
+
class = "",
 
colspan = #self._columns, rowspan = 1,
 
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 "",
  −
},
  −
}
  −
)
  −
table.insert(self._rows,
  −
format{self._column_cell_templates["!"] or self._cell,
  −
class = self._simple_class,
  −
colspan = #self._columns - self._detailed_columns, rowspan = 1,
   
text_align = self._args[self._custom_row_prefix .. custom_row_key .. self._text_align_suffix] or self._start_align,
 
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,
 
bg_color = self._args[self._custom_row_prefix .. custom_row_key .. self._bg_color_suffix] or self._transparent,
Line 329: Line 319:  
function EliteShipsKai:create_header()
 
function EliteShipsKai:create_header()
 
local header_icons = {
 
local header_icons = {
remodel = MiscIcons.remodel,  
+
remodel = StatIcons.remodel,  
 
firepower = StatIcons.firepower,  
 
firepower = StatIcons.firepower,  
 
torpedo = StatIcons.torpedo,  
 
torpedo = StatIcons.torpedo,  
Line 340: Line 330:  
evasion = StatIcons.evasion,
 
evasion = StatIcons.evasion,
 
speed = StatIcons.speed,
 
speed = StatIcons.speed,
 +
range = StatIcons.range,
 
aircraft = StatIcons.aircraft,
 
aircraft = StatIcons.aircraft,
 
fuel = ResourceIcons.fuel,
 
fuel = ResourceIcons.fuel,
Line 347: Line 338:  
header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
 
header_icons[key] = Formatting:format_image{value, caption = Formatting:format_stat_name(key)}
 
end
 
end
self._header = format(format{self._header_template, night_battle_header_cell = self._args.night_battle and self._night_battle_header_cell or ""}, header_icons)
+
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
 
end
    
return EliteShipsKai
 
return EliteShipsKai
advmod, cssedit, janitor, Moderators, prechecked, Widget editors
6,956

edits