| Line 314: |
Line 314: |
| | end | | end |
| | | | |
| − | function Formatting:format_remodel_level_and_item_cost(remodel_level, blueprint, catapult, report, gunmat, airmat, armament) | + | function Formatting:format_remodel_level_and_item_cost(remodel_level, blueprint, catapult, report, gunmat, airmat, armament, overseas) |
| − | local item_requirements = self:format_remodel_items(blueprint, catapult, report, gunmat, airmat, armament) | + | local item_requirements = self:format_remodel_items(blueprint, catapult, report, gunmat, airmat, armament, overseas) |
| | if remodel_level == nil then | | if remodel_level == nil then |
| | remodel_level = "??" | | remodel_level = "??" |
| Line 329: |
Line 329: |
| | local title = Formatting:format_resource_name(item) | | local title = Formatting:format_resource_name(item) |
| | return self:format_image{DataAsset[item], caption = title, link = title, size = "24px"} | | return self:format_image{DataAsset[item], caption = title, link = title, size = "24px"} |
| − | .. (value == nil and "?" or type(value) == "number" and "×" .. value or "")
| + | .. (value == nil and "×??" or type(value) == "number" and "×" .. value or "") |
| | end | | end |
| | | | |
| − | function Formatting:format_remodel_items(blueprint, catapult, report, gunmat, airmat, armament) | + | function Formatting:format_remodel_items(blueprint, catapult, report, gunmat, airmat, armament, overseas) |
| | local items = {} | | local items = {} |
| | -- explicit items | | -- explicit items |
| Line 354: |
Line 354: |
| | table.insert(items, self:format_remodel_item("new_model_armament_material_item", armament)) | | table.insert(items, self:format_remodel_item("new_model_armament_material_item", armament)) |
| | end | | end |
| | + | if overseas then |
| | + | table.insert(items, self:format_remodel_item("latest_overseas_warship_technology_item", overseas)) |
| | + | end |
| | return #items > 0 and table.concat(items, " ") or nil | | return #items > 0 and table.concat(items, " ") or nil |
| | end | | end |
| | | | |
| − | function Formatting:format_blueprint_requirement(blueprint, force) | + | function Formatting:format_item_requirement(item, value, show_false) |
| − | if force or (blueprint ~= false) then | + | return value == false and not show_false and "" or |
| − | local value
| + | value == false and "❌" or value and self:format_remodel_item(item, value) or "??" |
| − | if blueprint == false then
| + | end |
| − | value = "✗"
| + | |
| − | elseif blueprint == true then | + | function Formatting:format_blueprint_requirement(value, show_false) |
| − | value = self:format_image{DataAsset.blueprint_item, size = "24px", caption = Formatting:format_resource_name("blueprint")}
| + | return self:format_item_requirement("blueprint_item", value, show_false) |
| − | else
| |
| − | value = "??"
| |
| − | end
| |
| − | return value
| |
| − | end
| |
| − | return "" | |
| | end | | end |
| | | | |
| | Formatting.format_blueprint_requirement_simple = Formatting.format_blueprint_requirement | | Formatting.format_blueprint_requirement_simple = Formatting.format_blueprint_requirement |
| | | | |
| − | function Formatting:format_catapult_requirement(catapult, force) | + | function Formatting:format_catapult_requirement(value, show_false) |
| − | if force or (catapult ~= false) then | + | return self:format_item_requirement("prototype_deck_catapult_item", value, show_false) |
| − | local value
| |
| − | if catapult == false then
| |
| − | value = "✗"
| |
| − | elseif catapult == true then
| |
| − | value = self:format_image{DataAsset.prototype_deck_catapult_item, size = "24px", caption = Formatting:format_resource_name("prototype_deck_catapult_item")}
| |
| − | else
| |
| − | value = "??"
| |
| − | end
| |
| − | return value
| |
| − | end
| |
| − | return ""
| |
| | end | | end |
| | | | |
| Line 680: |
Line 666: |
| | | | |
| | 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 693: |
Line 679: |
| | shelling_accuracy = "Accuracy", | | shelling_accuracy = "Accuracy", |
| | evasion = "Evasion", | | evasion = "Evasion", |
| − | los = "LOS", | + | los = "LoS", |
| | speed = "Speed", | | speed = "Speed", |
| | luck = "Luck", | | luck = "Luck", |
| Line 742: |
Line 728: |
| | new_model_armament_material = "New Model Armament Material", | | new_model_armament_material = "New Model Armament Material", |
| | new_model_armament_material_item = "New Model Armament Material", | | new_model_armament_material_item = "New Model Armament Material", |
| | + | latest_overseas_warship_technology = "Latest Overseas Warship Technology", |
| | + | latest_overseas_warship_technology_item = "Latest Overseas Warship Technology", |
| | }) | | }) |
| | | | |
| Line 782: |
Line 770: |
| | | | |
| | 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 814: |
Line 803: |
| | | | |
| | 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 837: |
Line 826: |
| | 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 880: |
Line 870: |
| | }) | | }) |
| | | | |
| | + | --[=[ TODO: use something else, e.g. merge EquipmentTypes and EquipmentTypesPlural and use them in EquipmentInfoKai |
| | local equipment_types = { | | local equipment_types = { |
| | [3] = { | | [3] = { |
| Line 891: |
Line 882: |
| | [39] = { | | [39] = { |
| | [48] = { | | [48] = { |
| − | -- [38] = "Interceptor", | + | [38] = "Interceptor", |
| | } | | } |
| | } | | } |
| Line 916: |
Line 907: |
| | return type_name | | return type_name |
| | end | | end |
| | + | ]=]-- |
| | | | |
| | return Formatting | | return Formatting |