• 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
no edit summary
Line 317: Line 317:  
end
 
end
   −
function Self.formatResources(eq)
+
function Self.formatResources(eq, rates)
 
     if eq:buildable() then
 
     if eq:buildable() then
 
         local result = {}
 
         local result = {}
Line 327: Line 327:  
         local bauxite = (eq:scrap().bauxite or 1) * 10
 
         local bauxite = (eq:scrap().bauxite or 1) * 10
 
         for typeGroup, resourceGroups in pairs(groups) do
 
         for typeGroup, resourceGroups in pairs(groups) do
             for resourceGroup, _ in pairs(resourceGroups) do
+
             for resourceGroup, n in pairs(resourceGroups) do
 
                 local fuel, ammo, steel, bauxite = ensureResourceGroup(fuel, ammo, steel, bauxite, resourceGroup)
 
                 local fuel, ammo, steel, bauxite = ensureResourceGroup(fuel, ammo, steel, bauxite, resourceGroup)
 
                 local recipe = U.format{
 
                 local recipe = U.format{
Line 337: Line 337:  
                 }
 
                 }
 
                 result[recipe] = result[recipe] or {}
 
                 result[recipe] = result[recipe] or {}
                 result[recipe][Self.typeGroups[typeGroup]] = true
+
                 result[recipe][Self.typeGroups[typeGroup]] = U.round(100 * n / 50)
 
             end
 
             end
 
         end
 
         end
Line 344: Line 344:  
                 U.isort(U.keys(result)),
 
                 U.isort(U.keys(result)),
 
                 function(recipe)
 
                 function(recipe)
 +
                    local types = U.isort(U.keys(result[recipe]))
 
                     return U.format{
 
                     return U.format{
                         "${recipe} (${types})",
+
                         rates and "${rates}" or "${recipe} (${types})",
 
                         recipe = recipe,
 
                         recipe = recipe,
                         types = U.ijoin(U.isort(U.keys(result[recipe])), "/")
+
                         types = U.ijoin(types, "/"),
 +
                        rates = U.ijoin(U.imap(types, function(type) return tostring(result[recipe][type]) .. "%" end, "/")),
 
                     }
 
                     }
 
                 end
 
                 end
Line 354: Line 356:  
         )
 
         )
 
     else
 
     else
         return 'N/A'
+
         return "-"
 
     end
 
     end
 
end
 
end
    
function Self.formatRates(eq)
 
function Self.formatRates(eq)
     return "?"
+
     return Self.formatResources(eq, true)
 
end
 
end
    
function Self.formatHQ(eq)
 
function Self.formatHQ(eq)
     return math.max(math.max((eq:rarity() or 0) - 2, 0) * 10, 1)
+
     if eq:buildable() then
 +
        return math.max(math.max((eq:rarity() or 0) - 2, 0) * 10, 1)
 +
    else
 +
        return "-"
 +
    end
 
end
 
end
   Line 370: Line 376:  
     return
 
     return
 
         Self.formatResources(Equipment("46cm Triple Gun Mount")) ..
 
         Self.formatResources(Equipment("46cm Triple Gun Mount")) ..
 +
        "\n" ..
 +
        Self.formatRates(Equipment("46cm Triple Gun Mount")) ..
 
         "\n" ..
 
         "\n" ..
 
         Self.formatResources(Equipment("12cm Single Gun Mount"))
 
         Self.formatResources(Equipment("12cm Single Gun Mount"))
cssedit, gkautomate
7,064

edits

Navigation menu