• 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 stat bonus highlighting in comparison mode
Line 79: Line 79:  
},
 
},
 
_cell_color = {
 
_cell_color = {
firepower = "#F0C0C0",
  −
torpedo = "#C0E4FA",
  −
aa = "#F4CAA6",
  −
asw = "#C5BEEE",
  −
los = "#CCFFEE",
  −
luck = "#C9FBC9",
  −
hp = "#FFD9DF",
  −
armor = "#F2ECC2",
  −
evasion = "#EEBEEE",
  −
speed = "#B8E6E6",
  −
aircraft = "#D9D9D9",
  −
fuel = "#94E094",
  −
ammo = "palegoldenrod",
   
},
 
},
 
_cell = [[| colspan="1" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color};" |${values.value}]],
 
_cell = [[| colspan="1" rowspan="${rowspan}" style="text-align: ${text_align}; background-color: ${bg_color};" |${values.value}]],
 +
_good_stat_color = "#ffff40",
 +
_outstanding_stat_color = "#73ff4d",
 
_transparent = "transparent",
 
_transparent = "transparent",
 
_start_align = "start",
 
_start_align = "start",
Line 100: Line 89:  
_stats_column_label = "Stats",
 
_stats_column_label = "Stats",
 
_table_end = [[|}]],
 
_table_end = [[|}]],
 +
_operators = {
 +
["<"] = function(x,y) return x < y end,
 +
[">"] = function(x,y) return x > y end,
 +
},
 
}
 
}
   Line 160: Line 153:  
firepower = 0
 
firepower = 0
 
end
 
end
return {values = {value = Formatting:format_stat(firepower)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(firepower)}, bg_color = self:get_bg_color(self._cell_color.firepower, firepower, self.args.firepower_operator, self.args.firepower_outstanding, self.args.firepower_good), text_align = self._center_align}
 
end
 
end
   Line 170: Line 163:  
torpedo = 0
 
torpedo = 0
 
end
 
end
return {values = {value = Formatting:format_stat(torpedo)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(torpedo)}, bg_color = self:get_bg_color(self._cell_color.torpedo, torpedo, self.args.torpedo_operator, self.args.torpedo_outstanding, self.args.torpedo_good), text_align = self._center_align}
 
end
 
end
   Line 180: Line 173:  
bombing = 0
 
bombing = 0
 
end
 
end
return {values = {value = Formatting:format_stat(bombing)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(bombing)}, bg_color = self:get_bg_color(self._cell_color.bombing, bombing, self.args.bombing_operator, self.args.bombing_outstanding, self.args.bombing_good), text_align = self._center_align}
 
end
 
end
   Line 190: Line 183:  
aa = 0
 
aa = 0
 
end
 
end
return {values = {value = Formatting:format_stat(aa)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(aa)}, bg_color = self:get_bg_color(self._cell_color.aa, aa, self.args.aa_operator, self.args.aa_outstanding, self.args.aa_good), text_align = self._center_align}
 
end
 
end
   Line 200: Line 193:  
asw = 0
 
asw = 0
 
end
 
end
return {values = {value = Formatting:format_stat(asw)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(asw)}, bg_color = self:get_bg_color(self._cell_color.asw, asw, self.args.asw_operator, self.args.asw_outstanding, self.args.asw_good), text_align = self._center_align}
 
end
 
end
   Line 210: Line 203:  
los = 0
 
los = 0
 
end
 
end
return {values = {value = Formatting:format_stat(los)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(los)}, bg_color = self:get_bg_color(self._cell_color.los, los, self.args.los_operator, self.args.los_outstanding, self.args.los_good), text_align = self._center_align}
 
end
 
end
   Line 220: Line 213:  
luck = 0
 
luck = 0
 
end
 
end
return {values = {value = Formatting:format_stat(luck)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(luck)}, bg_color = self:get_bg_color(self._cell_color.luck, luck, self.args.luck_operator, self.args.luck_outstanding, self.args.luck_good), text_align = self._center_align}
 
end
 
end
   Line 230: Line 223:  
armor = 0
 
armor = 0
 
end
 
end
return {values = {value = Formatting:format_stat(armor)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(armor)}, bg_color = self:get_bg_color(self._cell_color.armor, armor, self.args.armor_operator, self.args.armor_outstanding, self.args.armor_good), text_align = self._center_align}
 
end
 
end
   Line 240: Line 233:  
shelling_accuracy = 0
 
shelling_accuracy = 0
 
end
 
end
return {values = {value = Formatting:format_stat(shelling_accuracy)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(shelling_accuracy)}, bg_color = self:get_bg_color(self._cell_color.shelling_accuracy, shelling_accuracy, self.args.shelling_accuracy_operator, self.args.shelling_accuracy_outstanding, self.args.shelling_accuracy_good), text_align = self._center_align}
 
end
 
end
   Line 250: Line 243:  
evasion = 0
 
evasion = 0
 
end
 
end
return {values = {value = Formatting:format_stat(evasion)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_stat(evasion)}, bg_color = self:get_bg_color(self._cell_color.evasion, evasion, self.args.evasion_operator, self.args.evasion_outstanding, self.args.evasion_good), text_align = self._center_align}
 
end
 
end
   Line 260: Line 253:  
speed = 0
 
speed = 0
 
end
 
end
return {values = {value = Formatting:format_speed(speed)}, bg_color = self._transparent, text_align = self._center_align}
+
return {values = {value = Formatting:format_speed(speed)}, bg_color = self:get_bg_color(self._cell_color.speed, speed, self.args.speed_operator, self.args.speed_outstanding, self.args.speed_good), text_align = self._center_align}
 
end
 
end
   Line 270: Line 263:  
range = 0
 
range = 0
 
end
 
end
return {values = {value = Formatting:format_range(range)}, bg_color = self._transparent, text_align = self._center_align}
+
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), text_align = self._center_align}
 
end
 
end
   Line 283: Line 276:  
function EquipmentListKai:notes(equipment)
 
function EquipmentListKai:notes(equipment)
 
return {values = {value = ""}, bg_color = self._transparent, text_align = self._start_align}
 
return {values = {value = ""}, bg_color = self._transparent, text_align = self._start_align}
 +
end
 +
 +
function EquipmentListKai:get_bg_color(default, value, operator, outstanding, good)
 +
if not value then
 +
return default or self._transparent
 +
end
 +
local comparison = self._operators[operator or ">"]
 +
if outstanding and comparison(value, tonumber(outstanding)) then
 +
return self._outstanding_stat_color
 +
elseif good and comparison(value, tonumber(good)) then
 +
return self._good_stat_color
 +
else
 +
return default or self._transparent
 +
end
 
end
 
end
  
Anonymous user

Navigation menu