Changes

no edit summary
Line 53: Line 53:  
_all = "All",
 
_all = "All",
 
_all_except = "All except ",
 
_all_except = "All except ",
_ship_image_template = "${ship_type} ${ship_name} ${api_id:3} ${image_type}.${extension}",
+
_ship_image_template = "${type} ${image_type} ${ship_name}${suffix}.${extension}",
_ship_image_simple_template = "${ship_name} ${image_type}.${extension}",
+
_ship_image_simple_template = "Ship ${image_type} ${ship_name}${suffix}.${extension}",
 
_equipment_image_template = "Equipment ${image_type} ${equipment_name}.png",
 
_equipment_image_template = "Equipment ${image_type} ${equipment_name}.png",
 
_equipment_image_template_simple = "${equipment_name} ${image_type}.png",
 
_equipment_image_template_simple = "${equipment_name} ${image_type}.png",
Line 63: Line 63:  
_banner_suffix = "Banner",
 
_banner_suffix = "Banner",
 
_banner_damaged_suffix = "Banner Damaged",
 
_banner_damaged_suffix = "Banner Damaged",
_battle_card_suffix = "Battle",
+
_battle_card_suffix = "Banner",
_battle_card_damaged_suffix = "Battle Damaged",
+
_battle_card_damaged_suffix = "Banner Damaged",
 
_cg_suffix = "Full",
 
_cg_suffix = "Full",
 
_cg_damaged_suffix = "Full Damaged",
 
_cg_damaged_suffix = "Full Damaged",
Line 72: Line 72:  
["Card"] = "png",
 
["Card"] = "png",
 
["Card Damaged"] = "png",
 
["Card Damaged"] = "png",
["Battle"] = "png",
+
["Banner"] = "png",
["Battle Damaged"] = "png",
+
["Banner Damaged"] = "png",
 
["Full"] = "png",
 
["Full"] = "png",
 
["Full Damaged"] = "png",
 
["Full Damaged"] = "png",
Line 191: Line 191:     
function Formatting:ship_card(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
 
function Formatting:ship_card(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
     return self:ship_image_simple(self._card_suffix, ship_name, extension_override)
+
     return self:ship_image_simple(self._card_suffix, ship_name, extension_override, '')
 
end
 
end
    
function Formatting:ship_card_damaged(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
 
function Formatting:ship_card_damaged(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
    if hd then
+
return self:ship_image(self._card_suffix, api_id, ship_name, ship_type, extension_override, ' Damaged')
        return self:ship_image_simple(self._card_damaged_suffix, ship_name, extension_override)
  −
    end
  −
    if simple_naming then
  −
        return self:ship_image_simple(self._card_damaged_suffix, ship_name, extension_override)
  −
    end
  −
return self:ship_image(self._card_damaged_suffix, api_id, ship_name, ship_type, extension_override)
   
end
 
end
    
function Formatting:ship_battle_card(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
 
function Formatting:ship_battle_card(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
    if hd then
+
return self:ship_image(self._battle_card_suffix, api_id, ship_name, ship_type, extension_override, '')
        return self:ship_image_simple(self._banner_suffix, ship_name, extension_override)
  −
    end
  −
    if simple_naming then
  −
        return self:ship_image_simple(self._battle_card_suffix, ship_name, extension_override)
  −
    end
  −
return self:ship_image(self._battle_card_suffix, api_id, ship_name, ship_type, extension_override)
   
end
 
end
    
function Formatting:ship_battle_card_damaged(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
 
function Formatting:ship_battle_card_damaged(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
    if hd then
+
     return self:ship_image(self._battle_card_suffix, api_id, ship_name, ship_type, extension_override, ' Damaged')
        return self:ship_image_simple(self._banner_damaged_suffix, ship_name, extension_override)
  −
    end
  −
    if simple_naming then
  −
        return self:ship_image_simple(self._battle_card_damaged_suffix, ship_name, extension_override)
  −
    end
  −
     return self:ship_image(self._battle_card_damaged_suffix, api_id, ship_name, ship_type, extension_override)
   
end
 
end
    
function Formatting:ship_cg(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
 
function Formatting:ship_cg(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
    if hd then
+
     return self:ship_image(self._cg_suffix, api_id, ship_name, ship_type, extension_override, '')
        return self:ship_image_simple(self._cg_suffix, ship_name, extension_override)
  −
    end
  −
if simple_naming then
  −
return self:ship_image_simple(self._cg_suffix, ship_name, extension_override)
  −
end
  −
     return self:ship_image(self._cg_suffix, api_id, ship_name, ship_type, extension_override)
   
end
 
end
    
function Formatting:ship_cg_damaged(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
 
function Formatting:ship_cg_damaged(api_id, ship_name, ship_type, extension_override, simple_naming, hd)
    if hd then
+
     return self:ship_image(self._cg_suffix, api_id, ship_name, ship_type, extension_override, ' Damaged')
        return self:ship_image_simple(self._cg_damaged_suffix, ship_name, extension_override)
  −
    end
  −
if simple_naming then
  −
return self:ship_image_simple(self._cg_damaged_suffix, ship_name, extension_override)
  −
end
  −
     return self:ship_image(self._cg_damaged_suffix, api_id, ship_name, ship_type, extension_override)
   
end
 
end
   −
function Formatting:ship_image(image_type, api_id, ship_name, ship_type, extension_override)
+
function Formatting:ship_image(image_type, api_id, ship_name, ship_type, extension_override, suffix)
 
return format{
 
return format{
 
    self._ship_image_template,
 
    self._ship_image_template,
 +
    type = api_id and api_id >= 1501 and 'Enemy' or 'Ship',
 
    image_type = image_type,
 
    image_type = image_type,
 
    api_id = api_id,
 
    api_id = api_id,
 
    ship_name = ship_name,
 
    ship_name = ship_name,
    ship_type = self:format_ship_code(ship_type),
+
    suffix = suffix,
 
    extension = extension_override or self._default_extension[image_type] or 'png',
 
    extension = extension_override or self._default_extension[image_type] or 'png',
 
}
 
}
 
end
 
end
   −
function Formatting:ship_image_simple(image_type, ship_name, extension_override)
+
function Formatting:ship_image_simple(image_type, ship_name, extension_override, suffix)
 
return format{
 
return format{
 
    self._ship_image_simple_template,
 
    self._ship_image_simple_template,
 
    image_type = image_type,
 
    image_type = image_type,
 
    ship_name = ship_name,
 
    ship_name = ship_name,
 +
    suffix = suffix or '',
 
    extension = extension_override or self._default_extension[image_type] or 'png',
 
    extension = extension_override or self._default_extension[image_type] or 'png',
 
}
 
}
Line 281: Line 253:     
function Formatting:equipment_image(image_type, api_id, equipment_name)
 
function Formatting:equipment_image(image_type, api_id, equipment_name)
return format{self._equipment_image_template, image_type = image_type, api_id = api_id, equipment_name = equipment_name}
+
return format{self._equipment_image_template, image_type = image_type, api_id = api_id, equipment_name = equipment_name:gsub('/', ' ')}
 
end
 
end
   Line 472: Line 444:  
     end
 
     end
 
     return format{
 
     return format{
         [[<span title="${title}" style="cursor:help;border-bottom:1px dotted">${text}</span>]],
+
         [[<span class="explain" title="${title}">${text}</span>]],
 
         text = text,
 
         text = text,
 
         title = title,
 
         title = title,
Line 708: Line 680:     
Formatting.format_boolean_short = Formatting:create_formatter({
 
Formatting.format_boolean_short = Formatting:create_formatter({
[true] = "", -- HEAVY CHECK MARK
+
[true] = "✔️", -- HEAVY CHECK MARK
[false] = "", -- HEAVY BALLOT X
+
[false] = "", -- HEAVY BALLOT X
 
})
 
})
   Line 721: Line 693:  
shelling_accuracy = "Accuracy",
 
shelling_accuracy = "Accuracy",
 
evasion = "Evasion",
 
evasion = "Evasion",
los = "LOS",
+
los = "LoS",
 
speed = "Speed",
 
speed = "Speed",
 
luck = "Luck",
 
luck = "Luck",
Line 810: Line 782:     
Formatting.format_equipment_compatibility = Formatting:create_formatter({
 
Formatting.format_equipment_compatibility = Formatting:create_formatter({
[0] = "whitesmoke",
+
[0] = "whitesmoke", -- false
[1] = "#73ff4d",
+
[1] = "#73ff4d", -- true
[2] = "#ffff40",
+
[2] = "#ffff40", -- only
 +
[3] = "#ddffbb", -- except
 
}, "transparent")
 
}, "transparent")
   Line 842: Line 815:     
function Formatting:format_ship_compatibility(compatibility_table)
 
function Formatting:format_ship_compatibility(compatibility_table)
if compatibility_table[3] == compatibility_table[4] then
+
--[=[ if compatibility_table[3] == compatibility_table[4] then
 
compatibility_table[3] = {value = compatibility_table[3], code = "CL(T)"}
 
compatibility_table[3] = {value = compatibility_table[3], code = "CL(T)"}
 
compatibility_table[4] = false
 
compatibility_table[4] = false
Line 850: Line 823:  
compatibility_table[6] = false
 
compatibility_table[6] = false
 
end
 
end
if compatibility_table[18] == compatibility_table[11] then
+
if compatibility_table[11] == compatibility_table[18] then
 
compatibility_table[18] = false
 
compatibility_table[18] = false
end
+
if compatibility_table[7] == compatibility_table[11] then
if compatibility_table[7] == compatibility_table[11] then
+
compatibility_table[7] = false
compatibility_table[7] = false
+
compatibility_table[11] = {value = compatibility_table[11], code = "CV(L/B)"}
compatibility_table[11] = {value = compatibility_table[11], code = "CV(L)"}
+
else compatibility_table[11] = {value = compatibility_table[11], code = "CV(B)"}
 +
end
 
end
 
end
 
if compatibility_table[9] == compatibility_table[10] then
 
if compatibility_table[9] == compatibility_table[10] then
Line 864: Line 838:  
compatibility_table[13] = {value = compatibility_table[13], code = "SS(V)"}
 
compatibility_table[13] = {value = compatibility_table[13], code = "SS(V)"}
 
compatibility_table[14] = false
 
compatibility_table[14] = false
end
+
end]=]--
 
compatibility_table[12] = false
 
compatibility_table[12] = false
 
compatibility_table[15] = false
 
compatibility_table[15] = false
 
local compatible = {}
 
local compatible = {}
 
local incompatible = {}
 
local incompatible = {}
for ship_type, compatibility_value in ipairs(compatibility_table) do
+
local complex = false
local code = Formatting:format_ship_code(ship_type)
+
for ship_type, value in ipairs(compatibility_table) do
if type(compatibility_value) == "table" then
+
local ship_code = Formatting:format_ship_code(ship_type)
code = compatibility_value.code
+
local note = type(value) == "table" and value.note
compatibility_value = compatibility_value.value
+
value = type(value) == "table" and value.value or value
end
+
if value == 0 then
if compatibility_value == 0 then
+
table.insert(incompatible, ship_code)
table.insert(incompatible, code)
+
elseif value == 1 then
elseif compatibility_value == 1 then
+
table.insert(compatible, ship_code)
table.insert(compatible, code)
+
elseif value == 2 or value == 3 then
elseif compatibility_value == 2 then
+
complex = true
table.insert(compatible, code)
+
table.insert(compatible, string.format("%s (%s)", ship_code, note))
table.insert(incompatible, format{self._excluding_exception_template, ship_type = Formatting:format_ship_code(ship_type), exception = code})
   
end
 
end
 +
end
 +
if complex then
 +
return table.concat(compatible, ", ")
 +
end
 +
if #incompatible == 0 then
 +
return self._all
 
end
 
end
 
if #incompatible < 5 then
 
if #incompatible < 5 then
if #incompatible == 0 then
  −
return self._all
  −
end
   
return self._all_except .. table.concat(incompatible, ", ")
 
return self._all_except .. table.concat(incompatible, ", ")
else
  −
return table.concat(compatible, ", ")
   
end
 
end
 +
return table.concat(compatible, ", ")
 
end
 
end
   Line 907: Line 882:  
})
 
})
    +
--[=[ TODO: use something else, e.g. merge EquipmentTypes and EquipmentTypesPlural and use them in EquipmentInfoKai
 
local equipment_types = {
 
local equipment_types = {
 
     [3] = {
 
     [3] = {
Line 918: Line 894:  
         [39] = {
 
         [39] = {
 
             [48] = {
 
             [48] = {
                 -- [38] = "Interceptor",
+
                 [38] = "Interceptor",
 
             }
 
             }
 
         }
 
         }
Line 943: Line 919:  
     return type_name
 
     return type_name
 
end
 
end
 +
]=]--
    
return Formatting
 
return Formatting
cssedit, gkautomate
6,928

edits