• 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
Add night battle column option
Line 17: Line 17:  
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightcoral;" | ${firepower}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: lightskyblue;" | ${torpedo}
! style="width: 24px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
+
${night_battle_header_cell}! style="width: 24px; text-align: center; vertical-align: middle; background-color: sandybrown;" | ${aa}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: #9C8FEE;" | ${asw}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: aquamarine;" | ${los}
 
! style="width: 24px; text-align: center; vertical-align: middle; background-color: aquamarine;" | ${los}
Line 35: Line 35:  
["!"] = [[| class="${class}" colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;${extra_style}" |${values.value}]]
 
["!"] = [[| class="${class}" colspan="${colspan}" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color}; padding:3px;${extra_style}" |${values.value}]]
 
},
 
},
 +
_night_battle_header_cell = [[! style="width: 24px; text-align: center; vertical-align: middle; background-color: midnightblue;" | ${firepower}${torpedo}
 +
]],
 
_columns = {
 
_columns = {
 
"id",
 
"id",
Line 41: Line 43:  
"remodel",
 
"remodel",
 
"firepower",
 
"firepower",
"torpedo",
+
"torpedo", --night_battle is added after this depending on args in create_table_prep. If adding columns please preserve this behaviour.
 
"aa",
 
"aa",
 
"asw",
 
"asw",
Line 141: Line 143:  
end
 
end
 
return {values = {value = Formatting:format_stat(torpedo_max)}, bg_color = self:get_bg_color(self._cell_color.torpedo, torpedo_max, self._args.torpedo_operator, self._args.torpedo_outstanding, self._args.torpedo_good, self._args.torpedo_bad), text_align = self._center_align}
 
return {values = {value = Formatting:format_stat(torpedo_max)}, bg_color = self:get_bg_color(self._cell_color.torpedo, torpedo_max, self._args.torpedo_operator, self._args.torpedo_outstanding, self._args.torpedo_good, self._args.torpedo_bad), text_align = self._center_align}
 +
end
 +
 +
function EliteShipsKai:night_battle(ship)
 +
local firepower_max = ship:firepower_max()
 +
if firepower_max == false then
 +
firepower_max = ship:firepower()
 +
end
 +
local torpedo_max = ship:torpedo_max()
 +
if torpedo_max == false then
 +
torpedo_max = ship:torpedo()
 +
end
 +
local night_battle = firepower_max
 +
if not firepower_max then
 +
    night_battle = torpedo_max
 +
elseif torpedo_max then
 +
    night_battle = night_battle + torpedo_max
 +
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}
 
end
 
end
   Line 266: Line 286:  
self._reference_types[tonumber(reference_type)] = true
 
self._reference_types[tonumber(reference_type)] = true
 
end
 
end
end
+
    end
 +
    if self._args.night_battle then
 +
        table.insert(self._columns, 7, "night_battle")
 +
    end
 
end
 
end
   Line 316: Line 339:  
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(self._header_template, header_icons)
+
self._header = format(format{self._header_template, night_battle_header_cell = self._args.night_battle and self._night_battle_header_cell or ""}, header_icons)
 
end
 
end
    
return EliteShipsKai
 
return EliteShipsKai
Anonymous user

Navigation menu